Re: Junk date getting uploaded into date field - Mailing list pgsql-general

From Tom Lane
Subject Re: Junk date getting uploaded into date field
Date
Msg-id 16613.1383662754@sss.pgh.pa.us
Whole thread Raw
In response to Re: Junk date getting uploaded into date field  (Albe Laurenz <laurenz.albe@wien.gv.at>)
List pgsql-general
Albe Laurenz <laurenz.albe@wien.gv.at> writes:
> There is a comment in utils/adt/formatting.c:

>  * This function does very little error checking, e.g.
>  * to_timestamp('20096040','YYYYMMDD') works

> So at least this is not by accident.

No, it isn't.  This is in fact the traditional behavior of Unix time
conversion utilities such as mktime(3).  The glibc man page gives the
specific example that "40 October" will be converted to "9 November"
rather than throwing an error.  The POSIX and C standards are not so
explicit, saying only that the inputs are not restricted to the normal
ranges (which I think would entitle an implementation to change 40
October to 31 October instead; but I've never heard of anyone doing
it that way).

            regards, tom lane


pgsql-general by date:

Previous
From: Patrick Dung
Date:
Subject: Re: Curious question about physical files to store database
Next
From: Albe Laurenz
Date:
Subject: Re: Curious question about physical files to store database