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