mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Different lastval() value with postgres trigger #7468
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 @matlow on GitHub (Jan 23, 2025).
Discussed in https://github.com/doctrine/orm/discussions/11803
Originally posted by matlow January 23, 2025
Summary
I have 2 entities : entityA which has a many to many relationship with entity B with join table named "tableA_tableB"
TableA and tableB use serial type on primary key.
When i persist new entity A, a new entity B is also persisted.
But i got an error if i had a postgresql trigger function on tableA to log insert operation.
There is the postgresql trigger :
Current behavior
Doctrine\ORM\Persisters\CollectionManyToManyPersisterlaunch an exception becauseDoctrine\ORM\Id\IdentityGenerator::generateId() return pdo_pgsql lastInsertId wich is he sequence of the log_audit table
Question
Is there a way to have the correct sequence table ?
@matlow commented on GitHub (Jan 29, 2025):
I drop the serial PK of log_audit table to fix it