Re: Temporarily disable not null constraints

Поиск
Список
Период
Сортировка
От Michael Lewis
Тема Re: Temporarily disable not null constraints
Дата
Msg-id CAHOFxGp0iWnCGMMH3imUfoPVPq-_bS=qKKYHxtaA7uTUmhSe3g@mail.gmail.com
обсуждение исходный текст
Ответ на Temporarily disable not null constraints  (Nagaraj Raj <nagaraj.sf@yahoo.com>)
Список pgsql-performance
On Thu, Dec 3, 2020 at 1:00 PM Nagaraj Raj <nagaraj.sf@yahoo.com> 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 working for unique constraints violation exception. 

Thanks,
Rj


You can alter the column and remove the not null constraint, do your work, and then add it back, but it will have to verify all rows have that column set, that is, you can't leave some of them null.

В списке pgsql-performance по дате отправления:

Предыдущее
От: Nagaraj Raj
Дата:
Сообщение: Temporarily disable not null constraints
Следующее
От: Milos Babic
Дата:
Сообщение: Re: Temporarily disable not null constraints