Re: misleading error message in 8.5, and bad (?) way deferred uniqueness works - Mailing list pgsql-bugs

From Tom Lane
Subject Re: misleading error message in 8.5, and bad (?) way deferred uniqueness works
Date
Msg-id 10730.1250008830@sss.pgh.pa.us
Whole thread Raw
In response to Re: misleading error message in 8.5, and bad (?) way deferred uniqueness works  (Dean Rasheed <dean.a.rasheed@googlemail.com>)
Responses Re: misleading error message in 8.5, and bad (?) way deferred uniqueness works  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Dean Rasheed <dean.a.rasheed@googlemail.com> writes:
> The constraint needs to be declared DEFERRABLE before you can defer
> it, but yes, I agree this is not a helpful error message.

> [The reason is that it actually searches for the trigger enforcing the
> constraint, and there isn't one if it's not deferrable. So the current
> code can't distinguish between a non-existent unique constraint and a
> non-deferrable one.]

Yeah.  Is it worth searching pg_constraint first, just so that we can
give a better error message?

Actually, it strikes me that if we did it that way, we could search
pg_trigger using the constraint OID instead of name, which would permit
replacing the index on tgconstrname with a presumably much smaller one
on tgconstraint.  And the bogus rechecks on namespace in
AfterTriggerSetState could probably be simplified too ...

            regards, tom lane

pgsql-bugs by date:

Previous
From: Sergei Abramov
Date:
Subject: Malfunction in dropping database with pgAdmin
Next
From: Tom Lane
Date:
Subject: Re: misleading error message in 8.5, and bad (?) way deferred uniqueness works