Closed
Description
🐞 Bug Report
Required Information
? | ! |
---|---|
Operating system | CentOS 7 |
PHP Telegram Bot version | 0.62.00 |
PHP version | 7.2.27 |
MySQL version | 5.7.29-32 Percona |
Update Method | Webhook |
Self-signed certificate | no |
RAW update (if available) | {...} |
Summary
PDOStatement::execute(): SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (kdt
.tgbot_poll_answer
, CONSTRAINT tgbot_poll_answer_ibfk_1
FOREIGN KEY (poll_id
) REFERENCES tgbot_poll
(id
)) {"exception":"[object] (ErrorException(code: 0): PDOStatement::execute(): SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (kdt
.tgbot_poll_answer
, CONSTRAINT tgbot_poll_answer_ibfk_1
FOREIGN KEY (poll_id
) REFERENCES tgbot_poll
(id
)) at "/vendor/longman/telegram-bot/src/DB.php:907)
- Primary key in table poll_answer is poll_id, seems, that right PK is poll_id + user_id
How to reproduce
Create new non-anonymous poll by sendPoll and answer by user in chat group.
Solution:
- Add user id to primary key
- Remove restrict for update