Re: Expression indexes and dependecies

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Expression indexes and dependecies
Дата
Msg-id 7513.1374757990@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Expression indexes and dependecies  (Pavan Deolasee <pavan.deolasee@gmail.com>)
Ответы Re: Expression indexes and dependecies  (Pavan Deolasee <pavan.deolasee@gmail.com>)
Список pgsql-hackers
Pavan Deolasee <pavan.deolasee@gmail.com> writes:
> Ok. I will write up something and submit a patch. Constraints probably also
> suffer from the same issue. Whats surprising is we don't mandate that the
> functions used in CHECK constraint are immutable (like we do for indexes).
> What that means is, even if a row was satisfying a constraint while
> insertion, it may not once its there. Is that intentional ?

Well, it's probably somewhat historical, but I doubt we'd want to
tighten it up now.  Here's an example of a sensible CHECK that's
only stable:
create ... last_update timestamptz check (last_update <= now()) ...

More generally, I think the argument was that the behavior of a
non-immutable CHECK would at least be easy to understand, assuming you
know that the check will only be applied at row insertion or update.
Non-immutable indexes could misbehave in much less obvious ways, for
instance causing the results of a query to differ depending on whether
the planner chose to use that index.
        regards, tom lane



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

Предыдущее
От: Fujii Masao
Дата:
Сообщение: Re: comment for "fast promote"
Следующее
От: Bruce Momjian
Дата:
Сообщение: pg_upgrade -j broken on Windows