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

Add identity field #91

Merged
merged 1 commit into from
Aug 29, 2023
Merged

Add identity field #91

merged 1 commit into from
Aug 29, 2023

Conversation

Jaime-alv
Copy link
Owner

@Jaime-alv Jaime-alv commented Aug 29, 2023

Delete serial and smallserial as primary key and add identity field instead.
Allow roles to add primary key in a sql statement.

source

Don't use serial
For new applications, identity columns should be used instead.

Why not?
The serial types have some weird behaviors that make schema, dependency, and permission management unnecessarily cumbersome.

When should you?
If you need support to PostgreSQL older than version 10.
In certain combinations with table inheritance (but see there)
More generally, if you somehow use the same sequence for multiple tables, although in those cases an explicit declaration might be preferable over the serial types.

@Jaime-alv Jaime-alv self-assigned this Aug 29, 2023
@Jaime-alv Jaime-alv added this to the Databases milestone Aug 29, 2023
@Jaime-alv Jaime-alv added the bug Something isn't working label Aug 29, 2023
@Jaime-alv Jaime-alv merged commit 0a2bebd into dev Aug 29, 2023
@Jaime-alv Jaime-alv deleted the identity branch August 29, 2023 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant