On 15.08.2016 13:44, Artur Zakirov wrote:
On 15.08.2016 14:33, Andreas 'ads' Scherbaum wrote:
Is it right and "true" way to validate date by extra transforming and

Maybe validate date by using ValidateDate(). Attached sample patch.

This does not solve the problem at hand, and let's wrong dates/formats
slip through:

./buildclient.py -v -c demo-config-pg.yaml --run-configure --run-make
--run-install --no-clean-at-all --patch

postgres=# SELECT to_date('2011 12  18', 'YYYY MM   DD');
(1 row)

That is from the regression tests, and obviously handles the date
transformation wrong. My attempt catches this, because I compare the
date with the input date, and do not rely on a valid date only.

I suppose that your sample query is an another issue, not date validate
task. I sent the patch to the thread
. It fixes formatting issues.

I thought that it is better to distinguish this issues to:
- validation of input date/timestmap string and input format string
- result date/timestamp validation

I was a bit confused when I've seen that you modified another function in your patch, but tried it out nevertheless. After all, you answered one of my emails, and I let my tool download your patch directly from the website. The other thread you are mentioning is a different topic.

Anyway, what I'm trying to solve is validate that to_date() produces valid and correct output. It does not, as of today.


                                Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to