Peter Eisentraut <peter_e@gmx.net> writes:
> On fre, 2010-04-09 at 18:01 -0400, Josh Kupershmidt wrote:
>> I often come across tables with either a unique index or a unique
>> constraint on them, and psql isn't helpful at showing the difference
>> between the two. Normally, I don't care which is which, except for
>> when I have to manually drop and recreate the index or constraint to
>> speed up a bulk load.
> Yes, I have also been annoyed by that. Perhaps you could work out a
> proposed change and send it to the hackers list. You don't necessarily
> need to code it up, but make some mock-ups about how things would look
> in different situations.
Please note that we already rejected the use of a separate constraints
subheading in connection with EXCLUDE constraints; a patch to introduce
one in order to distinguish unique constraints from manually-created
unique indexes isn't likely to fare much better. My recollection is
that it's intentional that psql obscures the difference, because for
most querying purposes there isn't any difference. I agree that
sometimes you'd like to know the difference, so I could see making some
small change that would make it possible to tell the difference when
needed. But I think it shouldn't make the two cases look completely
unrelated. Maybe something like saying "unique constraint" vs just
"unique" would fly.
regards, tom lane