Validation in to_date()
Hitoshi Harada <umi.tanuki@gmail.com>
From: Hitoshi Harada <umi.tanuki@gmail.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2013-01-12T06:28:15Z
Lists: pgsql-hackers
Attachments
- to_date_check.patch (application/octet-stream) patch
to_date() doesn't check the date range, which results in unreadable
data like this.
foo=# create table t as select to_date('9999-12-10 BC', 'YYYY-MM-DD
BC')::timestamp;
SELECT 1
foo=# table t;
ERROR: timestamp out of range
Attached is to add IS_VALID_JULIAN() as we do like in date_in(). I
think to_date() should follow it because it is the entrance place to
check sanity.
Thanks,
--
Hitoshi Harada