pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedPotential to_date(string, string) function malfunction
3+ messages / 2 participants
[nested] [flat]
* Potential to_date(string, string) function malfunction
@ 2019-10-08 12:30 Pavel Pleva <pavel.pleva@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Pleva @ 2019-10-08 12:30 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org
Hi,
I'd like to report you in my opinion weird behaviour of function
to_date(string, string). According to specs using format 'YYYY-MM-DD' in
months portion it should tolerate 01-12 and in days portion 01-31. But
if you try "SELECT to_date('2019-30-50', 'YYYY-MM-DD') instead of
throwing error it outputs "2021-07-23".
This is output of 'SELECT version();' on our system: "PostgreSQL 9.4.23
on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red
Hat 4.8.5-36), 64-bit"
Have a nice day!
Pavel Pleva
Attachments:
ToDatePostgreSql.png (image/png, 5.2K) download
view image
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Potential to_date(string, string) function malfunction
@ 2019-10-08 15:38 Tom Lane <tgl@sss.pgh.pa.us>
parent: Pavel Pleva <pavel.pleva@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2019-10-08 15:38 UTC (permalink / raw)
To: Pavel Pleva <pavel.pleva@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org
Pavel Pleva <pavel.pleva@gmail.com> writes:
> I'd like to report you in my opinion weird behaviour of function
> to_date(string, string). According to specs using format 'YYYY-MM-DD' in
> months portion it should tolerate 01-12 and in days portion 01-31. But
> if you try "SELECT to_date('2019-30-50', 'YYYY-MM-DD') instead of
> throwing error it outputs "2021-07-23".
> This is output of 'SELECT version();' on our system: "PostgreSQL 9.4.23
> on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red
> Hat 4.8.5-36), 64-bit"
PG v10 and later throw an error for this.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Potential to_date(string, string) function malfunction
@ 2019-10-09 14:22 Pavel Pleva <pavel.pleva@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Pavel Pleva @ 2019-10-09 14:22 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs@lists.postgresql.org
Thanks for reply, don't have access to PG v10 so good to know.
Best regards
Pavel Pleva
Dne 08. 10. 19 v 17:38 Tom Lane napsal(a):
> Pavel Pleva <pavel.pleva@gmail.com> writes:
>> I'd like to report you in my opinion weird behaviour of function
>> to_date(string, string). According to specs using format 'YYYY-MM-DD' in
>> months portion it should tolerate 01-12 and in days portion 01-31. But
>> if you try "SELECT to_date('2019-30-50', 'YYYY-MM-DD') instead of
>> throwing error it outputs "2021-07-23".
>> This is output of 'SELECT version();' on our system: "PostgreSQL 9.4.23
>> on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red
>> Hat 4.8.5-36), 64-bit"
> PG v10 and later throw an error for this.
>
> regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2019-10-09 14:22 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08 12:30 Potential to_date(string, string) function malfunction Pavel Pleva <pavel.pleva@gmail.com>
2019-10-08 15:38 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-10-09 14:22 ` Pavel Pleva <pavel.pleva@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