PosgtreSQL — Is it possible to specify a sequence name in a GENERATED BY DEFAULT AS IDENTITY column?
2
votes
2
answers
1597
views
When using PHP’s
lastInsertId()
method with PostgreSQL, it’s necessary to know the name of the sequence.
If I defined the column using GENERATED BY DEFAULT AS IDENTITY
, I know I can get the sequence name using something like pg_get_serial_sequence('whatever', 'id')
.
Is it possible to specify a sequence name in the CREATE TABLE
statement?
Asked by Manngo
(3145 rep)
Sep 16, 2023, 01:45 AM
Last activity: Feb 20, 2024, 09:39 PM
Last activity: Feb 20, 2024, 09:39 PM