mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
AutoIncrement pgSQL without identity strategy #7184
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 @vencakrecl on GitHub (Jul 12, 2023).
Bug Report
The
AUTOandSEQUENCEstrategy does not support autoincrement, only 'IDENTITY' works.Summary
Current behavior
IDENTITY
AUTO, SEQUENCE
How to reproduce
Expected behavior
IDENTITY, AUTO, SEQUENCE
@onurkose commented on GitHub (Aug 30, 2023):
When it set to
AUTOand if the platform is pgSql, it's set toSEQUENCE.Then, before the insert query, it runs such query to calculate next id and puts into the
INSERT INTOstatement;SELECT NEXTVAL('table_id_seq')This is fine so far and it works for me if the entity doesn't use any inheritance mapping.
But it's always null when I try to create a new record with these entities that uses inheritance.
What's your case?
@vencakrecl commented on GitHub (Oct 3, 2023):
The
SEQUENCEwithout default value does not make sense because you can insert any value into the ID column and break the sequence. The second thing is the sequence does not respect the last ID and begins from 1.