Re: to_date_valid()

Поиск
Список
Период
Сортировка
От Andreas 'ads' Scherbaum
Тема Re: to_date_valid()
Дата
Msg-id 81ed5480-9bca-361b-9aa0-cbafc2ec2f63@wars-nicht.de
обсуждение исходный текст
Ответ на Re: to_date_valid()  (Artur Zakirov <a.zakirov@postgrespro.ru>)
Ответы Re: to_date_valid()  (Artur Zakirov <a.zakirov@postgrespro.ru>)
Re: to_date_valid()  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
On 15.08.2016 10:24, Artur Zakirov wrote:
> On 14.08.2016 01:52, Andreas 'ads' Scherbaum wrote:
>>
>> Attached is a patch to "do the right thing". The verification is in
>> "to_date()" now, the extra function is removed. Regression tests are
>> updated - two or three of them returned a wrong date before, and still
>> passed. They fail now. Documentation is also updated.
>>
>>
>> Regards,
>>
>
> Is it right and "true" way to validate date by extra transforming and
> comparison?
>
> 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 
'https://www.postgresql.org/message-id/95738e12-6ed6-daf5-9dcf-6336072e6b15%40postgrespro.ru'


postgres=# SELECT to_date('2011 12  18', 'YYYY MM   DD');  to_date
------------ 2011-12-08
(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.

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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: Declarative partitioning - another take
Следующее
От: Artur Zakirov
Дата:
Сообщение: Re: to_date_valid()