declare constraint as valid

Поиск
Список
Период
Сортировка
От Torsten Förtsch
Тема declare constraint as valid
Дата
Msg-id 5255A41B.6010305@gmx.net
обсуждение исходный текст
Ответы Re: declare constraint as valid
Список pgsql-general
Hi,

assuming a constraint is added to a table as NOT VALID. Now I know it IS
valid. Can I simply declare it as valid by

update pg_constraint
   set convalidated='t'
 where conrelid=(select c.oid
                   from pg_class c
                   join pg_namespace n on (n.oid=c.relnamespace)
                  where c.relname='tablename'
                    and n.nspname='schemaname')
   and conname='constraintname';

instead of

alter table tablename validate constraint ...

Or does the latter have other side effects?

I am asking because I want to avoid the ACCESS EXCLUSIVE lock required
by the ALTER TABLE. I am sure there are no rows violating the constraint.

Thanks,
Torsten


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

Предыдущее
От: Jim Nasby
Дата:
Сообщение: Re: [HACKERS] Urgent Help Required
Следующее
От: 高健
Дата:
Сообщение: Re: streaming replication timeout error