Re: Re: [GENERAL] Forcefully adding a CHECK constrained

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Re: [GENERAL] Forcefully adding a CHECK constrained
Дата
Msg-id 8014.1338224116@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [GENERAL] Forcefully adding a CHECK constrained  ("Catalin(ux) M. Boie" <catab@embedromix.ro>)
Список pgsql-general
"=?utf-8?B?Q2F0YWxpbih1eCkgTS4gQm9pZQ==?=" <catab@embedromix.ro> writes:
> I hope I make myself clear now: I want a possibility to add a CHECK that will be used for partitioning without having
toread all data for validation. 

Basically, this is unlikely to be accepted, because it does not conform
with the project's worldview.

If you are intent on being smarter than the database is, you could
probably create a NOT VALID constraint and then manually poke the system
catalogs to mark it as valid.  Then, when (not if) you make a mistake,
you will have only yourself to blame.

A patch that would stand some chance of getting accepted would be one
that would act like CREATE INDEX CONCURRENTLY: create the constraint as
NOT VALID (so it's getting enforced against new rows), then in
background scan all the existing rows to make sure they meet the
constraint too, then finally mark the constraint VALID.  But we don't
consider that second step to be optional.

            regards, tom lane

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

Предыдущее
От: Karl Denninger
Дата:
Сообщение: Re: Attempting to do a rolling move to 9.2Beta (as a slave) fails
Следующее
От: Tom Lane
Дата:
Сообщение: Re: PostgreSQL reclaiming table space