Re: Inputting relative datetimes - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: Inputting relative datetimes
Date
Msg-id CAEZATCXy=i464zhpdbR6nNFRPRU_ySyMog=vw=a2ibC0SHZmRw@mail.gmail.com
Whole thread Raw
In response to Re: Inputting relative datetimes  (Jeff MacDonald <jam@zoidtechnologies.com>)
List pgsql-hackers
On 28 August 2011 00:00, Jeff MacDonald <jam@zoidtechnologies.com> wrote:
> Greetings,
>
> On Saturday, August 27, 2011 11:36:13 AM Dean Rasheed wrote:
>>
>> I'm not sure how best to handle timezones though, since it's
>> hard-coded list probably won't match the timezones PostgreSQL knows
>> about. Maybe that doesn't matter, I'm not sure.
>>
>
> It'll matter when the expression has a result that crosses the DST date. Does
> Postgres have a library that could be used by the parser?
>

On further examination of this and other datetime parsing code, I am
coming to the conclusion that for absolute timestamps the PostgreSQL
code is (IMO) the best and most flexible in terms of accepting a
variety of commons formats.

While getdate.y and others offer better support for relative
timestamps, it seems to come at the cost of poorer support for
absolute timestamps, which for me is a deal-breaker. There are also
other incompatibilities, such as different handling of "today", which
is just likely to lead to confusion.

It may not be worth the effort of trying to get a patch into core
PostgreSQL for this, but given the already excellent absolute
timestamp and interval support, I'm thinking that maybe the best
answer is to just write a userland function that breaks an input
string up into timestamp and interval parts and returns the resulting
timestamp.

Regards,
Dean


pgsql-hackers by date:

Previous
From: Greg Smith
Date:
Subject: Re: Displaying accumulated autovacuum cost
Next
From: Peter Eisentraut
Date:
Subject: confusing invalid UTF8 byte sequence error