Re: Need to check disabled constraints

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Sohel Tamboli <sohel(dot)tamboli0016(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Need to check disabled constraints
Date: 2018-01-29 13:27:39
Message-ID: CAKFQuwb2bLY3LQ9N9adkBC-86OjZNWDf-OocvoXGRqwjFHVNaw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Mon, Jan 29, 2018 at 12:19 AM, Sohel Tamboli <sohel(dot)tamboli0016(at)gmail(dot)com
> wrote:

> Hi,
>
> Any updates?
> Also I need to disable all FK in schema/database for database migration.
> How can I achieve that?
>
>
​pg_dump/pg_restore handles this for you...but see:

https://www.postgresql.org/docs/10/static/sql-altertable.html
"DISABLE/ENABLE [ REPLICA | ALWAYS ] TRIGGER"

> On 25-Jan-2018 12:57 pm, "Sohel Tamboli" <sohel(dot)tamboli0016(at)gmail(dot)com>
> wrote:
>
>> Can anyone please let me know how I can check disabled constraints in
>> postgresql 9.1 database.
>> I know that ALTER TABLE tablename DISABLE TRIGGER ALL; can disable
>> foriegn constraints, but how I can check if it is really disabled.
>> Similarly I need to check if constraint is enable.
>>
>> In oracle we have option to check status of constraint in
>> user_constraints table but do we have same in postgresql as well?
>>
>>
A doc skim should have led you to pg_triggers in the "System Catalogs"
chapter. The column tgenabled looks like what you are looking for.

David J.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Egor Duda 2018-01-29 14:01:06 deduplicating backup of multiple pg_dump dumps
Previous Message Siro Mateos De La Rosa 2018-01-29 10:06:14 Disable animations