Re: Inputting relative datetimes

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Jeff MacDonald <jam(at)zoidtechnologies(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Inputting relative datetimes
Date: 2011-08-28 09:59:12
Message-ID: CAEZATCXy=i464zhpdbR6nNFRPRU_ySyMog=vw=a2ibC0SHZmRw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 28 August 2011 00:00, Jeff MacDonald <jam(at)zoidtechnologies(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2011-08-28 12:04:43 confusing invalid UTF8 byte sequence error
Previous Message Greg Smith 2011-08-28 09:54:53 Re: Displaying accumulated autovacuum cost