Re: Forcefully adding a CHECK constrained

Поиск
Список
Период
Сортировка
От Marti Raudsepp
Тема Re: Forcefully adding a CHECK constrained
Дата
Msg-id CABRT9RCFrGANgdJ=Mfd5jB9d6LzdECdKxhyntKJWJds4He-Z_g@mail.gmail.com
обсуждение исходный текст
Ответ на Forcefully adding a CHECK constrained  ("Catalin(ux) M. BOIE" <catab@embedromix.ro>)
Список pgsql-general
On Tue, May 15, 2012 at 12:52 PM, Catalin(ux) M. BOIE
<catab@embedromix.ro> wrote:
> The old_stats is so big that I cannot afford to add a check constraint.
> But, I know that all values of the itime field are before 2012_04, so, would
> be great if I could run something like:

If you Really Really need it and if you're feeling adventurous, you
can attempt to create the constraint on another table and then
"rename" the constraint definition in pg_constraint and pg_depend
catalogs. But doing this WILL VOID YOUR WARRANTY! :)

It's fairly complicated, you have to take care to get every bit of
information right. In particular, if there are any deleted columns in
the old_stats table, the attribute numbers will not match, which can
cause errors or segfaults. Double check from pg_attribute.

And certainly do it in a test environment first; make sure with
pg_dump and restore that it understands the constraint correctly.

Regards,
Marti

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

Предыдущее
От: "Catalin(ux) M. Boie"
Дата:
Сообщение: Re: [GENERAL] Forcefully adding a CHECK constrained
Следующее
От: Anthony Bull
Дата:
Сообщение: PostgreSQL reclaiming table space