The current Primary Keys table helper for Postgres doesn't list primary keys as expected because it joins against information_schema.referential_constraints, which only has foreign keys.
To reproduce:
Spin up the current stable version of PostgreSQL (16.3).
Create a table with a primary key:
CREATE TABLE pk_test (
id INT,
name TEXT,
PRIMARY KEY (id)
);
Run the existing Primary Keys table helper and see that the primary key is not listed.
This PR fixes the Primary Keys table helper by simply querying against information_schema.table_constraints. It also renames basic_constraint_query to indicate it should only be used for foreign key queries.
The current Primary Keys table helper for Postgres doesn't list primary keys as expected because it joins against
information_schema.referential_constraints
, which only has foreign keys.To reproduce:
This PR fixes the Primary Keys table helper by simply querying against
information_schema.table_constraints
. It also renamesbasic_constraint_query
to indicate it should only be used for foreign key queries.