From: | Andreas 'ads' Scherbaum <adsmail(at)wars-nicht(dot)de> |
---|---|
To: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | to_date_valid() |
Date: | 2016-07-03 01:04:16 |
Message-ID: | 57786490.9010201@wars-nicht.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
we have customers complaining that to_date() accepts invalid dates, and
returns a different date instead. This is a known issue:
http://sql-info.de/postgresql/notes/to_date-to_timestamp-gotchas.html
On the other hand this leads to wrong dates when loading dates into the
database, because the database happily accepts invalid dates and ends up
writing something completely different into the table.
The attached patch adds a new function "to_date_valid()" which will
validate the date and return an error if the input and output date do
not match. Tests included, documentation update as well.
--
Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project
Attachment | Content-Type | Size |
---|---|---|
to_date_valid.patch.gz | application/gzip | 3.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2016-07-03 01:07:40 | Re: Docs, backups, and MS VSS |
Previous Message | Fabrízio de Royes Mello | 2016-07-03 00:31:55 | Re: Column COMMENTs in CREATE TABLE? |