Re: Bug in date arithmetic

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Bug in date arithmetic
Дата
Msg-id 14437.1251132406@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Bug in date arithmetic  (David Fetter <david@fetter.org>)
Ответы Re: Bug in date arithmetic  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
David Fetter <david@fetter.org> writes:
> While debugging an error with Aziz (postgres_newbie) Sharief in the
> #postgresql IRC channel, I found a major POLA violation:

I see no bug here.  There is only one '+' operator with timestamptz
as left input, and it is timestamptz plus interval, so the system
takes the unknown literal as an interval.  Possibly it should throw
error instead of assuming that the unmarked value is in seconds, but
I'll bet money that people are depending on that longstanding behavior.
As for the other case, there are two possible interpretations:

regression=# select oid::regoperator from pg_operator where oprname = '-' and oprleft = 'timestamptz'::regtype;
              oid                          
 
-------------------------------------------------------(timestamp with time zone,timestamp with time zone)-(timestamp
withtime zone,interval)
 
(2 rows)

and the first one is preferred due to an ancient and generally correct
heuristic.  I'm not sure why it's complaining about field overflow
rather than syntax error when the literal is taken as a timestamp,
but that's a pretty minor issue.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: hba load error and silent mode
Следующее
От: Tom Lane
Дата:
Сообщение: Re: DELETE syntax on JOINS