Skip site navigation (1) Skip section navigation (2)

Re: psql's \d display of unique index vs. constraint

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Josh Kupershmidt <schmiddy(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: psql's \d display of unique index vs. constraint
Date: 2010-04-13 19:36:00
Message-ID: 8780.1271187360@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-hackers
Peter Eisentraut <peter_e(at)gmx(dot)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

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2010-04-13 20:00:57
Subject: Re: GSoC - proposal - Materialized Views in PostgreSQL
Previous:From: Tom LaneDate: 2010-04-13 19:03:58
Subject: Re: a faster compression algorithm for pg_dump

pgsql-general by date

Next:From: Tom LaneDate: 2010-04-13 20:04:04
Subject: Re: Showing debug messages in my C function
Previous:From: Tom LaneDate: 2010-04-13 19:16:06
Subject: Re: When is an explicit cast necessary?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group