which data type should I choose for a unique key (id of a user for example) in postgresql database's table?
does bigint is the one?
thanks
which data type should I choose for a unique key (id of a user for example) in postgresql database's table?
does bigint is the one?
thanks
According to this answer the current recommended approach to doing auto-increment unique IDs is to use the generated as identity syntax instead of serial.
Here's an example:
-- the old way
create table t1 (id serial primary key);
-- the new way
create table t2 (id integer primary key generated always as identity);