In the release notes for Version 11 Beta, under changes, I see these scary
remarks:
Remove relhaspkey column from system table pg_class (Peter Eisentraut)
Applications needing to check for a primary key should consult pg_index.
Applications needing to check for a primary key should consult pg_index.
That absolutely breaks my code (and I'm guessing others), as I have a cron
job that checks for tables that were created with no pkey.
IE: SELECT n.nspname,
c.relname as table,
c.reltuples::bigint
FROM pg_class c
JOIN pg_namespace n ON (n.oid =c.relnamespace )
WHERE relkind = 'r' AND
relname NOT LIKE 'pg_%' AND
relname NOT LIKE 'sql_%' AND
relhaspkey = FALSE
ORDER BY n.nspname, c.relname;
c.relname as table,
c.reltuples::bigint
FROM pg_class c
JOIN pg_namespace n ON (n.oid =c.relnamespace )
WHERE relkind = 'r' AND
relname NOT LIKE 'pg_%' AND
relname NOT LIKE 'sql_%' AND
relhaspkey = FALSE
ORDER BY n.nspname, c.relname;
relhaspkey has been in pg_class since the earliest version of PostgreSQL. AFAIK
there is NO NEED to remove it! In fact, the system catalogs should only be changed when there is an absolute requirement, not at someone's whim. Adding a column is fine, but dropping columns that breaks code is ridiculous.
Please restore that column before the final release!
--
Melvin Davidson
Maj. Database & Exploration Specialist
Universe Exploration Command – UXC
Employment by invitation only!
Maj. Database & Exploration Specialist
Universe Exploration Command – UXC
Employment by invitation only!