Home:ALL Converter>PostgreSQL: serial vs identity

PostgreSQL: serial vs identity

Ask Time:2019-03-22T21:10:29         Author:Stijn Sanders

Json Formatter

To have an integer auto-numbering primary key on a table, you can use SERIAL

But I noticed the table information_schema.columns has a number of identity_ fields, and indeed, you could create a column with a GENERATED specifier...

What's the difference? Were they introduced with different PostgreSQL versions? Is one preferred over the other?

Author:Stijn Sanders,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/55300370/postgresql-serial-vs-identity
yy