From: | Henk Enting <h(dot)d(dot)enting(at)mgrid(dot)net> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #6231: weird to_timestamp behaviour with out of range values |
Date: | 2011-09-30 08:43:41 |
Message-ID: | CAAGvj=Dk0saKZtsaa3sjbk-u_w-ocOYpEUzZhFPW3bpVZAyHfg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Thu, Sep 29, 2011 at 5:39 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Wed, Sep 28, 2011 at 11:43 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > "Henk Enting" <h(dot)d(dot)enting(at)mgrid(dot)net> writes:
> >> I would expect the to_timestamp function to return an error when I feed
> it
> >> out of range values, e.g. months > 13 and days > 31. Instead it seems to
> add
> >> the surplus to the timestamp and then return it.
> >
> > What is your reason for using to_timestamp at all? The timestamp input
> > converter is perfectly capable of dealing with standard formats like
> > yyyy-mm-dd, and it does what most people expect in the way of data
> > validation checks.
>
> Well, you might want to insist that the input is in some particular
> format, rather than just "whatever the input function will accept"...
>
Exactly. But I probably can rely on the input function and set the datastyle
parameter to make sure I get the right dates (e.g. in our case 07-04-2011is
in april, not in july).
But still, I think the to_timestamp should throw an error if I put in
something like '21-21-2011'.
Best Regards,
Henk Enting
From | Date | Subject | |
---|---|---|---|
Next Message | Boris Matkov | 2011-09-30 11:41:25 | BUG #6236: Query execution bug |
Previous Message | Yaamini Bist | 2011-09-30 08:10:09 | FW: PostGre compatible to RHEL 6.1 |