Re: infinity as a date

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: infinity as a date
Дата
Msg-id 3245.1039670008@sss.pgh.pa.us
обсуждение исходный текст
Ответ на infinity as a date  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Список pgsql-general
Jean-Christian Imbeault <jc@mega-bucks.co.jp> writes:
> I see that Postgres has a special keyword "infinity" for use with
> timestamps. Is there an equivalent for dates?

There is not.

> I tried the following but it doesn't quite work:

> JC=# create table test(a date);
> CREATE TABLE
> JC=# insert into test values('infinity'::timestamp);
> INSERT 1030323 1
> JC=# select * from test;
>   a
> ---

> (1 row)

It appears that what actually gets stored in test.a is NULL ... which
is not surprising given the source code for timestamp_date():

    if (TIMESTAMP_NOT_FINITE(timestamp))
        PG_RETURN_NULL();

I think that this is an outright bug: if type DATE doesn't have a
concept of infinity then it should throw an error, not translate
infinity to NULL.  NULL means "unknown", not "I cannot cope with this
value".

Comments?

            regards, tom lane

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

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Potentially serious migration issue from 7.1.3 to 7.2
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Urgent need of (paid) PostgreSQL support in New