Re: misleading error message in 8.5, and bad (?) way deferred uniqueness works

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)googlemail(dot)com>
Cc: depesz(at)depesz(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: misleading error message in 8.5, and bad (?) way deferred uniqueness works
Date: 2009-08-11 16:40:30
Message-ID: 10730.1250008830@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Dean Rasheed <dean(dot)a(dot)rasheed(at)googlemail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-08-11 17:00:30 Re: misleading error message in 8.5, and bad (?) way deferred uniqueness works
Previous Message Dean Rasheed 2009-08-11 12:21:25 Re: misleading error message in 8.5, and bad (?) way deferred uniqueness works