pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #6243: Strange result of to_date function
2+ messages / 2 participants
[nested] [flat]
* BUG #6243: Strange result of to_date function
@ 2011-10-07 10:41 pasman <pasman.p@gmail.com>
2011-10-19 12:10 ` Re: BUG #6243: Strange result of to_date function Robert Haas <robertmhaas@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: pasman @ 2011-10-07 10:41 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged online:
Bug reference: 6243
Logged by: pasman
Email address: pasman.p@gmail.com
PostgreSQL version: 9.1.1
Operating system: WinXP sp3
Description: Strange result of to_date function
Details:
Hi.
This is the result of to_date function:
SELECT "data min", to_date("data min",'YYYYMMDD')
"20110211144226";"32522-12-09"
"20110708202145";"24468-03-15"
"20101118110930";"51596-11-15"
"20101216120525";"46147-05-31"
"20110526093630";"73453-04-05"
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #6243: Strange result of to_date function
2011-10-07 10:41 BUG #6243: Strange result of to_date function pasman <pasman.p@gmail.com>
@ 2011-10-19 12:10 ` Robert Haas <robertmhaas@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Robert Haas @ 2011-10-19 12:10 UTC (permalink / raw)
To: pasman <pasman.p@gmail.com>; +Cc: pgsql-bugs
On Fri, Oct 7, 2011 at 6:41 AM, pasman <pasman.p@gmail.com> wrote:
>
> The following bug has been logged online:
>
> Bug reference: 6243
> Logged by: pasman
> Email address: pasman.p@gmail.com
> PostgreSQL version: 9.1.1
> Operating system: WinXP sp3
> Description: Strange result of to_date function
> Details:
>
> Hi.
> This is the result of to_date function:
>
> SELECT "data min", to_date("data min",'YYYYMMDD')
>
> "20110211144226";"32522-12-09"
> "20110708202145";"24468-03-15"
> "20101118110930";"51596-11-15"
> "20101216120525";"46147-05-31"
> "20110526093630";"73453-04-05"
We've had some problems like this before, and I think the date-parsing
code could probably be further improvement to do less silly things
when it sees unexpected input. That having been said, if you pass a
14-digit value to a date format that expects 8 digits, there's not
really any reasonable way for the computer to decide what you meant.
I gather that you'd like 20101216120525 to mean 2010-12-16 (and just
ignore 120525) but it could also be interpreted to mean
2010121612-05-25, which is admittedly an awfully long time from now
but it doesn't seem any less logical than randomly throwing away part
of the input string.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2011-10-19 12:10 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-10-07 10:41 BUG #6243: Strange result of to_date function pasman <pasman.p@gmail.com>
2011-10-19 12:10 ` Robert Haas <robertmhaas@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox