Re: Temporarily disable not null constraints

2020-12-03 Thread Justin Pryzby
On Thu, Dec 03, 2020 at 07:58:15PM +, Nagaraj Raj wrote: > Can we disable not null constraints temporarily in the session-based > transaction, like we disable FK constraints?  If you're trying to temporarily violate the not-null constraint.. I don't know if it's a good idea.. ..but maybe thi

Re: Temporarily disable not null constraints

2020-12-03 Thread Milos Babic
generally, you shouldn't be disabling your constraints, especially if you are having multiple parallel processes accessing your db. instead, you should create them DEFERRABLE and have them checked at the end of your transaction. regarding your question about NOT NULL: it is not possible to have it

Re: Temporarily disable not null constraints

2020-12-03 Thread Michael Lewis
On Thu, Dec 3, 2020 at 1:00 PM Nagaraj Raj wrote: > Hi, > > Can we disable not null constraints temporarily in the session-based > transaction, like we disable FK constraints? > > SET session_replication_role = ‘replica’; > alter table table_name disable trigger user;” > > above two options are w

Temporarily disable not null constraints

2020-12-03 Thread Nagaraj Raj
Hi, Can we disable not null constraints temporarily in the session-based transaction, like we disable FK constraints?  SETsession_replication_role = ‘replica’; alter table table_name disable trigger user;” above two options are working for unique constraints violation exception.  Thanks,Rj