vim-dadbod-ui icon indicating copy to clipboard operation
vim-dadbod-ui copied to clipboard

fix(postgres): Primary Keys table helper

Open wburklund opened this issue 7 months ago • 0 comments

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:

  1. Spin up the current stable version of PostgreSQL (16.3).
  2. Create a table with a primary key:
CREATE TABLE pk_test (
  id INT,
  name TEXT,
  PRIMARY KEY (id)
);
  1. 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.

wburklund avatar Jul 23 '24 00:07 wburklund