Re: Exclusion constraints with time expressions

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: Exclusion constraints with time expressions
Дата
Msg-id D960CB61B694CF459DCFB4B0128514C208A4E94F@exadv11.host.magwien.gv.at
обсуждение исходный текст
Ответ на Exclusion constraints with time expressions  (Thomas Munro <munro@ip9.org>)
Список pgsql-general
Thomas Munro wrote:
> I am using 9.1.6, and I've set up a partitioned table as described in
the manual, with partitions
> based on a timestamptz column called 'time'.  The exclusion
constraints work nicely when I select
> ranges of times with literal constants.  But why would a WHERE clause
like the following not benefit
> from exclusion constraints?
>
>   time > TIMESTAMPTZ '2012-11-03 00:00:00Z' + INTERVAL '24 hours'
>
>
> Isn't that expression on the right reducible to a constant up front?
Obviously I can use a host
> language to do the arithmetic and provide a constant, but I am curious
to understand why that wouldn't
> be constant-folded.

I think the problem is that this + operator is implemented
by the function "timestamptz_pl_interval", which is STABLE
but not IMMUTABLE.

I am not sure why this function cannot be IMMUTABLE, it
seems to me that it should be.

Yours,
Laurenz Albe


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

Предыдущее
От: "Albe Laurenz"
Дата:
Сообщение: Problem with streaming replication over SSL
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: Problem with streaming replication over SSL