Re: BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jeremy Ford" <jeremford(at)gmail(dot)com>, Brendan Jurd <direvus(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1
Date: 2009-06-19 13:47:01
Message-ID: 4877.1245419221@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

"Jeremy Ford" <jeremford(at)gmail(dot)com> writes:
> select
> to_char(2009,'9999') as year,
> to_char(3,'09') as month,
> to_date(to_char(2009,'9999')||to_char(3,'99') ,'YYYYMM') as method1,
> to_date(to_char(2009,'9999')||'-'||to_char(3,'09') || '-01','YYYY-MM-DD')
> as method2

Or, eliminating the extraneous stuff, the point is that

regression=# select to_date(' 2009 07', 'YYYYMM');
to_date
------------
0200-09-01
(1 row)

doesn't do what it used to. Ordinarily I might say "well, if you want
leading spaces you need to say that in the format", viz

regression=# select to_date(' 2009 07', ' YYYYMM');
to_date
------------
2009-07-01
(1 row)

However, that just begs the question --- it seems that leading space is
allowed in MM, just not in YYYY. Brendan, is that intentional or is it
a bug?

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-06-19 13:57:05 Re: BUG #4865: replace function returns null
Previous Message Jamolkhon Khakimov 2009-06-19 12:40:11 BUG #4865: replace function returns null

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-06-19 13:52:49 Re: PSQLException: FATAL: semctl(9335088, 3, SETVAL, 0) failed
Previous Message Kenneth Marshall 2009-06-19 12:40:00 Re: 8.4 open item: copy performance regression?