Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: insert record with ID assigned doesn't commit the sequence ID #718

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

manish-kharel
Copy link

Explain your user case and expected results

When a record is inserted with an assigned ID using db.Create(), that sequence ID is not committed.
Example: Given the sequence ID for user table is at ID: 2.
and if I create an entity
User {ID: 5, Name: "some user" }
with ID 5 assigned, gorm creates the entity. So, when the turn for ID 5 with auto-sequence comes in, pkey violation error occurs.

The expected result would be , that GORM would see ID 5 is already used by another record and use continue from ID 6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant