Re: BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1 - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1
Date
Msg-id 4877.1245419221@sss.pgh.pa.us
Whole thread Raw
In response to BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1  ("Jeremy Ford" <jeremford@gmail.com>)
Responses Re: BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1
List pgsql-bugs
"Jeremy Ford" <jeremford@gmail.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

pgsql-bugs by date:

Previous
From: "Jamolkhon Khakimov"
Date:
Subject: BUG #4865: replace function returns null
Next
From: Tom Lane
Date:
Subject: Re: BUG #4865: replace function returns null