Re: [HACKERS] bug with constraint dependencies? or bug with

2003-08-29 Thread Greg Stark
Greg Stark <[EMAIL PROTECTED]> writes: > [On that note, one of my pet peeves is that the default names for constraints > are of the form $1 which requires quoting, but that \d doesn't quote them so > that you can almost but not quite copy the \d output into an sql statement > recreating the const

Re: [HACKERS] bug with constraint dependencies? or bug with

2003-08-28 Thread Tom Lane
Greg Stark <[EMAIL PROTECTED]> writes: > Hmmm I think there's still something missing here. I was using pg_restore -r > (actually I was using -L but the list was originally generated with -r) which > seemed like a good idea at the time. Rereading it now it seems like it > shouldn't change anything

Re: [HACKERS] bug with constraint dependencies? or bug with

2003-08-28 Thread Greg Stark
Tom Lane <[EMAIL PROTECTED]> writes: > AFAICT the difference is not whether you create the FK constraint during > table creation or add it later (in fact, the same code is executed > either way). The difference in Greg's example is that he said > "REFERENCES test" in one case and "REFERENCES tes

Re: [HACKERS] bug with constraint dependencies? or bug with

2003-08-28 Thread Tom Lane
> Greg Stark <[EMAIL PROTECTED]> writes: >> Hmmm I think there's still something missing here. I was using pg_restore -r >> (actually I was using -L but the list was originally generated with -r) which >> seemed like a good idea at the time. Rereading it now it seems like it >> shouldn't change any

Re: [HACKERS] bug with constraint dependencies? or bug with

2003-08-28 Thread Tom Lane
It looks like the problem has been introduced by recent changes to dump more stuff as "constraints". pg_dump is careful to dump indexes before constraints --- but the latter category now includes not only foreign key constraints, but unique/primary constraints, and those will all end up sorted by

Re: [HACKERS] bug with constraint dependencies? or bug with

2003-08-28 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > On 28 Aug 2003, Gregory Stark wrote: >> It seems when you create a new table with the "references" syntax the >> constraint is created with a dependency specifically on a "primary key" >> constraint on the target table. >> >> However when you alter a tab

Re: [HACKERS] bug with constraint dependencies? or bug with

2003-08-28 Thread Stephan Szabo
On Thu, 28 Aug 2003, Tom Lane wrote: > Stephan Szabo <[EMAIL PROTECTED]> writes: > > ... that would only help if the unique constraint were created before the > > references constraint. > > But in any case, pg_dump ought to be careful to dump index creation > commands before REFERENCES constraints

Re: [HACKERS] bug with constraint dependencies? or bug with

2003-08-28 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > ... that would only help if the unique constraint were created before the > references constraint. But in any case, pg_dump ought to be careful to dump index creation commands before REFERENCES constraints, I should think. If it isn't doing that, there'

Re: [HACKERS] bug with constraint dependencies? or bug with

2003-08-28 Thread Stephan Szabo
On 28 Aug 2003, Gregory Stark wrote: > It seems when you create a new table with the "references" syntax the > constraint is created with a dependency specifically on a "primary key" > constraint on the target table. > > However when you alter a table to add a foreign key constraint the constraint

[HACKERS] bug with constraint dependencies? or bug with pg_dump/pg_restore?

2003-08-28 Thread Gregory Stark
It seems when you create a new table with the "references" syntax the constraint is created with a dependency specifically on a "primary key" constraint on the target table. However when you alter a table to add a foreign key constraint the constraint is added with a dependency on any unique ind