As you know, we can view the details of a sequence by using '\d' command. I would like to know if there is a way to get these information with a SQL query so that I can view the details for all sequences in PostgreSQL database.
Eventually, the left 'Column' will be displayed horizontally like we see normally when we use a sql statement.
postgres=# \d next_empno
Sequence "public.next_empno"
Column | Type | Value
---------------+---------+---------------------
sequence_name | name | next_empno
last_value | bigint | 8000
start_value | bigint | 8000
increment_by | bigint | 1
max_value | bigint | 9223372036854775807
min_value | bigint | 1
cache_value | bigint | 1
log_cnt | bigint | 0
is_cycled | boolean | f
is_called | boolean | f
\ds *.*, but otherwise, use theinformation_schemapsqlwith the-E(echo hidden) option. It will show you exactly what queries psql uses internallypsqluses the PostgreSQL catalogs directly. Unlikeinformation_schemathese are subject to change from version to version and are not standard across database engines. Where possible, you should prefer theinformation_schema.