data.postgresql_sequences.db_sequences.sequences is an empty list [], while in psql, \ds shows the identity column sequences (also, I'm able to grant privileges on them, so it makes sense to output them).
psql
xtz=> \ds
Liste des relations
Schéma | Nom | Type | Propriétaire
--------+----------------------------------+----------+--------------------
public | test_id_seq | séquence | test
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
Create a table with an identity column
CREATE TABLE IF NOT EXISTS test (
id integer generated by default as identity,
value TEXT,
);
Important Factoids
My database is running on AWS RDS Aurora, but I don't think this changes much.
References
None that i'm aware of
Other notes
The column identity sequences don't appear in select * from information_schema.sequences;, but one can fetch from the column database by asking for colums which have is_identity set to YES. Then, the sequence name can be found with pg_get_serial_sequence:
select pg_get_serial_sequence(table_name, column_name) from information_schema.columns where is_identity = 'YES';
pg_get_serial_sequence
-----------------------------------------
public.test_id_seq
Hi there,
Thank you for opening an issue. Please provide the following information:
Terraform Version
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
Debug Output
I don't have one, please ask if you think it's needed. 🙏
Panic Output
None, terraform/terragrunt completes successfully
Expected Behavior
I'm using identity columns for some tables in my PostgreSQL database. The
postgresql_sequences
data source does not show themdata.postgresql_sequences.db_sequences.sequences
is an empty list[]
, while inpsql
,\ds
shows the identity column sequences (also, I'm able to grant privileges on them, so it makes sense to output them).Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
Important Factoids
My database is running on AWS RDS Aurora, but I don't think this changes much.
References
None that i'm aware of
Other notes
The column identity sequences don't appear in
select * from information_schema.sequences;
, but one can fetch from the column database by asking for colums which haveis_identity
set toYES
. Then, the sequence name can be found withpg_get_serial_sequence
:Credits: https://dba.stackexchange.com/questions/187708/how-to-get-information-about-the-sequence-behind-the-new-identity-column-in-post