Bug report function to_date should reject HH24:MI:SS formatting options - Mailing list pgsql-bugs

From Sébastien Caunes
Subject Bug report function to_date should reject HH24:MI:SS formatting options
Date
Msg-id CANtq+vRSFrA6R7X1KXkiMVL7=uQFfEWjkKC=o8r358ySiNTMig@mail.gmail.com
Whole thread Raw
Responses Re: Bug report function to_date should reject HH24:MI:SS formatting options  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Hello,

It is very misleading that you can write this :
SELECT * FROM orders WHERE date BETWEEN TO_DATE('2021-09-29 08:30:00', 'YYYY-MM-DD HH24:MI:SS') and TO_DATE('2021-09-30 08:30:37', 'YYYY-MM-DD HH24:MI:SS');

This will ignore the time part and select rows that seem out of range.

TO_DATE function should reject the time part (HH24:MI:SS) in the template string.

I just saw developers coming from Oracle spending a lot of time on this.

Thank you so much for working on this software.

B. R.

Sébastien Caunes

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17205: pg_class.reltuples vakue wrong for brin indexes after vacuum (by many orders of magnitude)
Next
From: Tom Lane
Date:
Subject: Re: Bug report function to_date should reject HH24:MI:SS formatting options