{"action":"opened","issue":{"url":"https://api.github.com/repos/envms/fluentpdo/issues/274","repository_url":"https://api.github.com/repos/envms/fluentpdo","labels_url":"https://api.github.com/repos/envms/fluentpdo/issues/274/labels{/name}","comments_url":"https://api.github.com/repos/envms/fluentpdo/issues/274/comments","events_url":"https://api.github.com/repos/envms/fluentpdo/issues/274/events","html_url":"https://github.com/envms/fluentpdo/issues/274","id":375046134,"node_id":"MDU6SXNzdWUzNzUwNDYxMzQ=","number":274,"title":"If the table has no primary key with sequence (auto-increment) insert method will throw an error","user":{"login":"roquie","id":3214290,"node_id":"MDQ6VXNlcjMyMTQyOTA=","avatar_url":"https://avatars3.githubusercontent.com/u/3214290?v=4","gravatar_id":"","url":"https://api.github.com/users/roquie","html_url":"https://github.com/roquie","followers_url":"https://api.github.com/users/roquie/followers","following_url":"https://api.github.com/users/roquie/following{/other_user}","gists_url":"https://api.github.com/users/roquie/gists{/gist_id}","starred_url":"https://api.github.com/users/roquie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roquie/subscriptions","organizations_url":"https://api.github.com/users/roquie/orgs","repos_url":"https://api.github.com/users/roquie/repos","events_url":"https://api.github.com/users/roquie/events{/privacy}","received_events_url":"https://api.github.com/users/roquie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-29T14:34:45Z","updated_at":"2018-10-29T14:34:45Z","closed_at":null,"author_association":"NONE","body":"How to reproduce?\r\n\r\n1. create a PostgreSQL table without sequence\r\n2. insert row using Fluentpdo.\r\n3. Catch the following error:\r\n\r\n```bash\r\nPDOException: SQLSTATE[55000]: Object not in prerequisite state: 7 ERROR:  lastval is not yet defined in this session\r\n```\r\n\r\nIt's a bug.\r\n\r\nSolution without breaking changes:\r\n\r\n```php\r\n<?php\r\n\r\n// In Insert.php\r\n\r\npublic function execute($sequence = null, $lastInsertId = true)\r\n{\r\n     $result = parent::execute();\r\n     if ($result && $lastInsertId) {\r\n        return $this->fluent->getPdo()->lastInsertId($sequence);\r\n     }\r\n\r\n     return false;\r\n    }\r\n```"}}
{"actor":{"display_login":"roquie"}}