| От | Justin Pryzby |
|---|---|
| Тема | Re: Temporarily disable not null constraints |
| Дата | |
| Msg-id | 20201203223436.GT24052@telsasoft.com обсуждение исходный текст |
| Ответ на | Temporarily disable not null constraints (Nagaraj Raj <nagaraj.sf@yahoo.com>) |
| Список | pgsql-performance |
On Thu, Dec 03, 2020 at 07:58:15PM +0000, 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 this feature in v12 helps you: https://www.postgresql.org/docs/12/sql-altertable.html | Ordinarily this is checked during the ALTER TABLE by scanning the entire table; however, if a valid CHECK constraint isfound which proves no NULL can exist, then the table scan is skipped. When you're done violating constraints, you can ALTER .. ADD CONSTRAINT .. CHECK (.. IS NOT NULL) NOT VALID, and then ALTER .. VALIDATE CONSTRAINT, and then ALTER column SET NOT NULL. -- Justin
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера