[BUGS] misleading error message in 8.5, and bad (?) way deferred uniqueness works

2009-08-11 Thread hubert depesz lubaczewski
While testing deferred unique constraints I found this: # CREATE TABLE test ( i INT4 PRIMARY KEY ); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index test_pkey for table test CREATE TABLE # set constraints test_pkey deferred; ERROR: constraint test_pkey does not exist The

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

2009-08-11 Thread Dean Rasheed
2009/8/11 hubert depesz lubaczewski dep...@depesz.com: While testing deferred unique constraints I found this: # CREATE TABLE test (    i INT4 PRIMARY KEY ); NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index test_pkey for table test CREATE TABLE # set constraints test_pkey

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

2009-08-11 Thread Tom Lane
Dean Rasheed dean.a.rash...@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

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

2009-08-11 Thread Tom Lane
I wrote: Dean Rasheed dean.a.rash...@googlemail.com writes: [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.]

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

2009-08-11 Thread Andres Freund
On Tuesday 11 August 2009 19:00:30 Tom Lane wrote: I wrote: Dean Rasheed dean.a.rash...@googlemail.com writes: [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

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

2009-08-11 Thread Dean Rasheed
2009/8/11 Tom Lane t...@sss.pgh.pa.us: Anyway it's looking like a slightly nontrivial project.  Maybe we should just rephrase the error message Hubert is complaining about. Yeah, I can't think of any simple way of distinguishing the 2 error conditions in that code. Perhaps adding a suitable