From: | Mario Weilguni <mweilguni(at)sime(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Strange behaviour of to_date() |
Date: | 2001-04-17 17:46:19 |
Message-ID: | 01041719461900.00830@wotan |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I noticed a quite strange behaviour of to_char() in 7.0 and 7.1. It treats
abbreveated forms of a date completely wrong. Example:
-- this one is ok
mario=# select to_date('04.01.2001', 'dd.mm.yyyy');
to_date
------------
2001-01-04
-- this is completly wrong, but NO error raised
mario=# select to_date('4.01.2001', 'dd.mm.yyyy');
to_date
------------
0001-01-04
-- completly wrong as well
mario=# select to_date('4.1.2001', 'dd.mm.yyyy');
to_date
------------
0001-01-04
IMO to_date() should either recognize the date, even if shorter than the mask
(Oracle compatible), or raise an error. Currently it gives completly wrong
results, which is the worst option.
I tried to fix this myself, but I'm lost within backend/utils/adt/formatting.c
--
===================================================
Mario Weilguni KPNQwest Austria GmbH
Senior Engineer Web Solutions Nikolaiplatz 4
tel: +43-316-813824 8020 graz, austria
fax: +43-316-813824-26 http://www.kpnqwest.at
e-mail: mario(dot)weilguni(at)kpnqwest(dot)com
===================================================
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-04-17 17:51:29 | Re: Re: [PATCHES] Patch for PostgreSQL 7.0.3 to compile on Tru64 UNIX v5.0A |
Previous Message | Lamar Owen | 2001-04-17 17:31:43 | Another news story in need of 'enlightenment' |