to_char incompatibility

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: to_char incompatibility
Date: 2008-01-10 12:41:17
Message-ID: 200801101341.18862.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Oracle:

SQL> select to_date('31-DEC-200700:00:00', 'dd-mon-yyyy hh24:mi:ss') from
dual;

TO_DATE('
---------
31-DEC-07

On PostgreSQL:

select to_date('31-DEC-200700:00:00', 'dd-mon-yyyy hh24:mi:ss');
to_date
--------------
200700-12-31

Now the input value is probably a mistake. But according to the theory
described in the PostgreSQL documentation that to_char more or less ignores
whitespace unless FX is used, I think the Oracle behavior is more correct. In
addition, even if it wants to take 6 digits for the year in spite of only 4
Y's, the rest of the format wouldn't match anymore.

Is anyone an Oracle format code expert who can comment on this?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

Browse pgsql-hackers by date

  From Date Subject
Next Message Roberts, Jon 2008-01-10 13:42:51 Re: to_char incompatibility
Previous Message Markus Schiltknecht 2008-01-10 11:01:36 Re: Some ideas about Vacuum