David Fetter <[email protected]> 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 with time 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

-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to