Re: const cast ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: const cast ?
Дата
Msg-id 1631.981185887@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: const cast ?  (Michael Fork <mfork@toledolink.com>)
Список pgsql-sql
Michael Fork <mfork@toledolink.com> writes:
> You can create a function with the IsCacheable attribute...
> CREATE FUNCTION my_date_part(date) RETURNS int4 AS '
>     SELECT date_part('year', $1);
> ' LANGUAGE 'sql' WITH iscachable();

The reason date_part --- and most other datetime-related functions ---
is not marked iscachable already is the existence of the special value
CURRENT in some of the datetime datatypes, which makes the result of
any datetime function potentially dependent on when you execute it.
I believe we have agreed that CURRENT is evil and should be eliminated,
but it hasn't gotten done yet.  See past discussions in the pghackers
archives.
        regards, tom lane


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

Предыдущее
От: Roberto Mello
Дата:
Сообщение: Re: Four Odd Questions
Следующее
От: Florian Steffen
Дата:
Сообщение: Timestamp accuracy