mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-2001: Problem nextval sequence persist many object #2526
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Aug 29, 2012).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user sandrocandido:
Seems to be a bug doctrine.
Scenario: You cart table and Product table when trying to persist the products do not set the last sequence postgres. In the example cart will id = 1
products id = 1 ... 5 but the sequence of the final product value is 2 and not 5.
If I run the script again I get the following error.
Sample code:
EchoSQLLogger Cart:
EchoSQLLogger Products( Note that the second interaction forward select nextval was not generated. ) :
Entity Cart:
Entity Product:
Attachment application sample
@doctrinebot commented on GitHub (Aug 29, 2012):
Comment created by @beberlei:
But the SQL Log correctly shows 1,..,5 in case of the INSERT statements for products. Where is the unique id clash happening?
@doctrinebot commented on GitHub (Aug 29, 2012):
Comment created by sandrocandido:
It happens that for each insert must have a nextval to generate the unique id. Log in to run the script the first time the insert works but if you run the script again next products are not generated 6 ... 10 of the error occurring.
PDOException: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "product_pkey" DETAIL: Key (id)=(2) already exists. in /var/www/codeigniter/bugcodeigniterdoctrine/application/third_party/doctrine-orm/Doctrine/DBAL/Statement.php on line 131
@doctrinebot commented on GitHub (Aug 30, 2012):
Comment created by sandrocandido:
Benjamin you could understand the problem now?
@doctrinebot commented on GitHub (Oct 6, 2012):
Comment created by @beberlei:
Its not a bug with Doctrine but your code, your sequence is defined wrong:
If you increment by 100, then the sequence has to increment by 100. This is a low level db vendor feature.
@doctrinebot commented on GitHub (Oct 6, 2012):
Issue was closed with resolution "Invalid"