my question is simple what is the current value for the identity and how to retrieve it's sequence name
CREATE TABlE x(
id int2 generated by default as identity
(start 5)
primary key,
name varchar(5))
CodePudding user response:
You can query pg_get_serial_sequence
with the table and column names:
select pg_get_serial_sequence('public.x','id');
CodePudding user response:
on prompt you can \ds is there a better way
CodePudding user response:
From here Info functions:
select pg_get_serial_sequence ('x', 'id' );
pg_get_serial_sequence
--------------------------------
<some_seq_name>
--Then
Select * from <some_seq_name>;