> -----Original Message----- > From: pgsql-general-owner@xxxxxxxxxxxxxx [mailto:pgsql-general- > owner@xxxxxxxxxxxxxx] On Behalf Of J.V. > Sent: Friday, October 21, 2011 1:11 AM > To: pgsql-general@xxxxxxxxxxxxxx > Subject: Re: how to disable all pkey/fkey constraints globally > > Is there a simpler way than this to query the database for meta-data and get > the constraint definitions? > > If I have the constraint name (which I do), I could store the constraint > definition to a file or database table and recreate them if I could get the > definition. > > This seems like a very simple thing to do, but nowhere can I find the meta- > data I would need to first save the constraint, to later re-create it. > > thanks If you know constraint name and schema, then I don't see how you could possibly make it any simpler than the way I already suggested: > >> Look into table pg_constraint and function pg_get_constraintdef. Of course, since this involves the use of a system catalogue, this is neither portable nor very reliable in the long run. You can also get all the information about foreign key constraints from information_schema tables, but that is more complicated. You'll need to join table_constraints, referential_constraints and key_column_usage, probably more than once. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general