pg_get_constraintdef

Started by Christopher Kings-Lynnealmost 23 years ago5 messages
#1Christopher Kings-Lynne
chriskl@familyhealth.com.au

Is there some reason why pg_get_constraintdef only supports Foreign Key
constraints? Why not have it output ALTER TABLE commands for UNIQUE and
PRIMARY KEY constraints? That would make my life so much easier for
phpPgAdmin and also pg_dump could be simplified quite considerably...?

Chris

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Christopher Kings-Lynne (#1)
Re: pg_get_constraintdef

"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:

Is there some reason why pg_get_constraintdef only supports Foreign Key
constraints?

Lack of implementation effort --- the original definition/implementation
was FK-specific, but now, as the code says,

* XXX The present implementation only works for foreign-key constraints, but
* it could and should handle anything pg_constraint stores.

Feel free to contribute some code.

Why not have it output ALTER TABLE commands for UNIQUE and
PRIMARY KEY constraints? That would make my life so much easier for
phpPgAdmin and also pg_dump could be simplified quite considerably...?

I do not think pg_dump would gain anything much, since it has to be able
to deal with older servers.

regards, tom lane

#3Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Tom Lane (#2)
Re: pg_get_constraintdef

"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:

Is there some reason why pg_get_constraintdef only supports Foreign Key
constraints?

Lack of implementation effort --- the original definition/implementation
was FK-specific, but now, as the code says,

* XXX The present implementation only works for foreign-key
constraints, but
* it could and should handle anything pg_constraint stores.

Feel free to contribute some code.

I will, but unfortunately the damage has already been done...since I have to
support 7.3 anyway, fixing the above problem will actually make my life
harder, not easier...

Chris

#4Ross J. Reedstrom
reedstrm@rice.edu
In reply to: Christopher Kings-Lynne (#3)
Re: pg_get_constraintdef

On Mon, Jan 13, 2003 at 11:59:33AM +0800, Christopher Kings-Lynne wrote:

Tom Lane writes:

Feel free to contribute some code.

I will, but unfortunately the damage has already been done...since I have to
support 7.3 anyway, fixing the above problem will actually make my life
harder, not easier...

Yeah, but never let that stop you from doing the right thing. Heck,
isn't that almost a diagnostic for 'the right thing', "Hmm, this is easy:
I must be doing something wrong." ;-)

Ross

#5Kris Jurka
books@ejurka.com
In reply to: Ross J. Reedstrom (#4)
Re: pg_get_constraintdef

On Mon, Jan 13, 2003 at 11:59:33AM +0800, Christopher Kings-Lynne wrote:

I will, but unfortunately the damage has already been done...since I

have to

support 7.3 anyway, fixing the above problem will actually make my life
harder, not easier...

Another issue to consider is that when a dump from 7.2 is loaded into 7.3
no foreign keys are listed in pg_constraint, so some backwards
compatibility will be required because even if the 7.3 server supports
this functionality it does not mean it is being used.

Kris Jurka