From: | Brendan Jurd <direvus(at)gmail(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [BUGS] extract(epoch from infinity) is not 0 |
Date: | 2011-07-13 22:44:03 |
Message-ID: | CADxJZo2NsoHaBAmufse1ZVtTRP=WBN7Jrx2qJnCG_H_KaokSpA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
On 14 July 2011 08:16, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Jul 13, 2011, at 4:21 PM, Brendan Jurd <direvus(at)gmail(dot)com> wrote:
>> Well, for example, how do you go about answering the question "what is
>> the day-of-month of the infinite timestamp?" The question is
>> nonsense; it doesn't have a defined day of month, so I think we should
>> be returning NULL or throwing an error. Returning zero is definitely
>> wrong. I think throwing an error is the better way to go, as the user
>> probably didn't intend to ask an incoherent question.
>>
>> It makes sense to special-case 'epoch' because it effectively converts
>> the operation into interval math; if we ask "how many seconds from
>> 1970-01-01 00:00 UTC until the infinite timestamp?" the answer is
>> genuinely "infinite seconds". So +1 for the proposed change for
>> epoch, and let's throw an error for the other date fields instead of
>> returning zero.
>
> I'd rather we avoid throwing an error, because that sometimes forces people who want to handle that case to use a subtransaction to catch it, which is quite slow.
SELECT CASE WHEN isfinite(ts) THEN extract(day from ts) ELSE NULL END
Cheers,
BJ
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2011-07-14 02:10:28 | Re: BUG #6117: psql -c does not work as expected. a documentation bug? a program bug? |
Previous Message | Robert Haas | 2011-07-13 22:16:56 | Re: [BUGS] extract(epoch from infinity) is not 0 |
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2011-07-13 23:38:23 | Re: proposal: a validator for configuration files |
Previous Message | Robert Haas | 2011-07-13 22:16:56 | Re: [BUGS] extract(epoch from infinity) is not 0 |