Re: how to disable all pkey/fkey constraints globally
От | |
---|---|
Тема | Re: how to disable all pkey/fkey constraints globally |
Дата | |
Msg-id | 29F36C7C98AB09499B1A209D48EAA615B767F86C78@mail2a.alliedtesting.com обсуждение исходный текст |
Ответ на | Re: how to disable all pkey/fkey constraints globally ("J.V." <jvsrvcs@gmail.com>) |
Список | pgsql-general |
> -----Original Message----- > From: pgsql-general-owner@postgresql.org [mailto:pgsql-general- > owner@postgresql.org] On Behalf Of J.V. > Sent: Friday, October 21, 2011 1:11 AM > To: pgsql-general@postgresql.org > Subject: Re: [GENERAL] 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 alreadysuggested: > >> 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.
В списке pgsql-general по дате отправления: