Alvaro Herrera <alvherre@commandprompt.com> writes:
> Lawrence Cohan wrote:
>> In that case the two separate pg_class relhasindex and relhaspkey would
>> make sense indeed - just a thought nothing else and we'll take it as is.
> What would be the point? If you want to figure out whether a table has
> a primary key, you can query the catalogs.
Note that UNIQUE constraints are implemented by indexes too, so it's not
clear to me that special-casing the pkey would really respond to this
criticism anyway.
But the bottom line is that relhasindex is defined in terms of
possessing physical indexes, not whether those indexes arose from
constraint syntax or CREATE INDEX.
regards, tom lane