-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Auto Increment function #16445
Comments
I agree with @WhiteTrashLord. It would be nice if you could provide something like an auto increment function instead of being obliged to use the serial data type! |
@WhiteTrashLord, @mahaben Is there a performance threshold at which this stops making sense? An auto-increment function requires central coordination of the counter. This might double the time to perform an insert.
Many language and system designers would disagree with this. Your system can end up a confusing mess if this is taken to the extreme. This isn't meant to argue against your suggestion. I imagine the lack of small integer keys for an auto-increment type is surprising to many. PS This is likely a dup of #5811 |
Note that while it's not a function, you can get this behavior today with a subquery: |
@vilterp i assume you're no longer working on this task? I'm bumping the milestone to 2.1. Feel free to unassign yourself and reassign it to PMs for triage. |
I think now that we have sequences this can just be closed. |
I have thought about your current SERIAL data type and came to the conclusion that I don't like it for all use cases. For example if I make a table for User data I would prefer to have very small INT user IDs.
So I would highly appreciate if you could add something like an auto increment function. Even if it's much slower. I think it's always good to give developers some more options.
The text was updated successfully, but these errors were encountered: