From: | "Alex Hunsaker" <badalex(at)gmail(dot)com> |
---|---|
To: | "Brendan Jurd" <direvus(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: Meridiem markers (was: [BUGS] Incorrect "invalid AM/PM string" error from to_timestamp) |
Date: | 2008-09-26 18:03:03 |
Message-ID: | 34d269d40809261103j6d124444oac48e4c86c8b8cb@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Sep 26, 2008 at 11:25 AM, Brendan Jurd <direvus(at)gmail(dot)com> wrote:
> One way to tidy this up would be to re-implement the meridiem markers
> using the seq_search functions, i.e., make it work like the day and
> month names. This would make it easy to accept any flavour of marker,
> and the error messages thrown for bogus input would then be the same
> as those for bogus day and month names.
Yeah if we seq_search then it should be a pretty easy conversion. so +1
However that still leaves the original complaint around (at least IMHO):
select to_timestamp('AN', 'AM');
ERROR: invalid AM/PM string
select to_timestamp('11:47 PM 27 Sep a2008', 'HH:MI PM DD Mon YYYY');
ERROR: invalid value for "YYYY" in source string
Now arguably most to_timestamp calls are going to be short so i can
easily look for the YYYY in my string and see what I did wrong (and
DETAIL: provides Value must be an integer in the second case)... So
really maybe thats good enough I dunno... Personally I find the output
of my dumb patch to be better than both above:
select to_timestamp('AN', 'AM');
ERROR: invalid AM/PM string for 'AN'
And we could improve that by only showing node->key->len chars. And
make that work for both AM/PM and the others YYYY etc
Then again maybe its not worth it?
From | Date | Subject | |
---|---|---|---|
Next Message | Stefan Kaltenbrunner | 2008-09-26 18:07:58 | Re: lock contention on parallel COPY ? |
Previous Message | Chris Browne | 2008-09-26 18:02:42 | Re: PostgreSQL future ideas |