Warning: Cannot Select - Primary Key Column Is Not Usable: GENERATED ALWAYS Column
Issue
When you try to select a table in the Schema tab, the following warning appears:
Cannot select - This table is excluded because a primary key column is not usable: GENERATED ALWAYS column.
Environment
Connector: Azure PostgreSQL
Resolution
To resolve this issue:
- Upgrade your PostgreSQL database to version 18 or later. If you can't upgrade, replace the stored generated primary key column with a standard primary key column, such as an IDENTITY or SERIAL column, instead of completing the remaining steps.
- Run the following query to check whether your publication is configured to replicate stored generated columns:
SELECT pubname, pubgencols FROM pg_publication; - If
pubgencolsis notsfor your publication, enable replication of stored generated columns:ALTER PUBLICATION <publication_name> SET (publish_generated_columns = stored); - Check the publication's column lists:If a column list excludes the generated primary key column, update it to include that column.
SELECT schemaname, tablename, attnames FROM pg_publication_tables WHERE pubname = '<publication_name>'; - In Fivetran, go to your Azure PostgreSQL connection page.
- Select the Schema tab
- Click the Refresh button (Update latest schema from source).
For more details, see the PostgreSQL Generated Column Replication documentation.
Cause
This issue occurs because PostgreSQL 17 and earlier can't publish generated columns through logical replication. Even though the table is in the publication, PostgreSQL excludes the generated primary key. We need a usable primary key to replicate your data, so we disable the table when this happens.