mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Fails to insert to a PostgreSQL master-slave config due to SequenceGenerator(NEXTVAL) issues #5347
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 @mkurzeja on GitHub (Dec 9, 2016).
Originally assigned to: @Ocramius on GitHub.
Background: I have a master-slave connection and I'm using auto-generated id for my entity;
Doctrine ORM fails to insert data because it tries to get the sequence NEXTVAL value from a slave.
PostgreSQL allows to fetch nextval only from a master server, and using fetchColumn runs the query using a slave connection.
I could start a transaction before, but I assume this case should be handled by ORM.
In case someone tries to reproduce this issue, just start a PostgreSQL cluster (docker-compose and https://hub.docker.com/r/bitnami/postgresql/ might be helpful) and try to persist any entity with an auto-generated ID.
@Ocramius commented on GitHub (Jun 21, 2017):
Handled in #6168