Determining primary key columns in PGAdmin, if the constraint name is generated by system I am trying to learn a new schema of a PostgreSQL database, but it's unclear from looking at pgAdmin which columns per the tables constitute the primary keys. It appears that when the tables were created, they were created with the default PRIMARY KEY (primary_key_column_name)
This results in the default naming convention when checking under the constraints in pgAdmin. How can I check to see what the actual names of the columns are for the primary key for a table?
I'm not sure I understood what you're asking, but if your question is how to determine what columns constitute a table's primary key you can query the catalog like so:
select c.conname constraint_name, o.relname table_name, a.attname column_name
from pg_constraint c 
inner join pg_class o
   on c.conrelid = o.oid
inner join pg_attribute a 
  on c.conrelid = a.attrelid 
-- pg_constraint.conkey is an array of pg_attribute.attnum values
-- &quot;with ordinality&quot; clause helps keep proper column ordering
inner join lateral unnest (c.conkey) with ordinality as cols (attnum, pos)
  on a.attnum = cols.attnum
where c.contype = 'p' 
order by conname, relname, pos