Re: Junk date getting uploaded into date field

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: "Thomas Kellerer *EXTERN*" <spam_eater(at)gmx(dot)net>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Junk date getting uploaded into date field
Date: 2013-11-05 14:45:54
Message-ID: 16613.1383662754@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2013-11-05 14:51:33 Re: Curious question about physical files to store database
Previous Message Patrick Dung 2013-11-05 14:42:36 Re: Curious question about physical files to store database