Is their any way to know if an index is a unique constraint from within the
dependency checker?  In testing with pg_dump I've noted that it seems to
know (I assume from contype in pg_constraint) if the index is just a unique
index or a constraint.

How about this:

Cannot drop unique constraint (index t1_pkey) because part of constraint c1
from table t1 requires it

If this is possible it would at least get you in to a 'constraint mindset'
and hopefully make you realise thats its a constraint first and an index as
a bonus/side effect, so to speak.

Is this easily possible?

Best Regards,

Tim Knowles

-----Original Message-----
From: Tom Lane [mailto:[EMAIL PROTECTED]]
Sent: 30 September 2002 15:51
To: Tim Knowles
Cc: [EMAIL PROTECTED]
Subject: Re: [BUGS] Bug #785: 7.3b2 : Possible Inconsistency with DROP
INDEX ... CASCADE and DROP CONSTRAINT


"Tim Knowles" <[EMAIL PROTECTED]> writes:
> ... I do though think the error message could do with a slight change
> of wording from:

> ERROR:  Cannot drop index t1_pkey because constraint c1 on table t1
requires
> it
>         You may drop constraint c1 on table t1 instead
> to:

> ERROR:  Cannot drop index t1_pkey because constraint c1 on table t1
requires
> it
>         To drop index t1_pkey you will need to drop the constraint c1 from
> table t1 first

Well, no, because the second message is not accurate at all for this
situation.  The hint to drop the constraint *instead* is perfectly
correct; when you do that the index will go away too.

I was thinking more of rewording the first line, perhaps like this:

> ERROR:  Cannot drop index t1_pkey because it is part of constraint c1 on
table t1

but wasn't completely satisfied with that either.

                        regards, tom lane


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to