Re: [HACKERS] Inputting relative datetimes

2011-08-31 Thread Dean Rasheed
On 30 August 2011 16:40, Robert Haas robertmh...@gmail.com wrote: OK, committed. Thanks. I'm fine with not back-patching it, on the grounds given. Cheers, Dean -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription:

Re: [HACKERS] Inputting relative datetimes

2011-08-30 Thread Robert Haas
On Sun, Aug 28, 2011 at 5:39 AM, Dean Rasheed dean.a.rash...@gmail.com wrote: On 28 August 2011 00:39, Robert Haas robertmh...@gmail.com wrote: On Sat, Aug 27, 2011 at 7:43 AM, Dean Rasheed dean.a.rash...@gmail.com wrote: On 27 August 2011 12:29, Dean Rasheed dean.a.rash...@gmail.com wrote:

Re: [HACKERS] Inputting relative datetimes

2011-08-30 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Sun, Aug 28, 2011 at 5:39 AM, Dean Rasheed dean.a.rash...@gmail.com wrote: The attached patch makes today, tomorrow and yesterday only set the year, month and day fields. All the other fields are already initialised to 0 at the start, and may be

Re: [HACKERS] Inputting relative datetimes

2011-08-30 Thread Robert Haas
On Tue, Aug 30, 2011 at 11:52 AM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: On Sun, Aug 28, 2011 at 5:39 AM, Dean Rasheed dean.a.rash...@gmail.com wrote: The attached patch makes today, tomorrow and yesterday only set the year, month and day fields. All the

Re: [HACKERS] Inputting relative datetimes

2011-08-30 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: Well, I'm fine with not back-patching it, but think the existing behavior is flat wrong. I'm not arguing that this way isn't better, just that it's different. There have been zero user complaints about this behavior since Tom Lockhart put it in, more

Re: [HACKERS] Inputting relative datetimes

2011-08-28 Thread Dean Rasheed
On 28 August 2011 00:39, Robert Haas robertmh...@gmail.com wrote: On Sat, Aug 27, 2011 at 7:43 AM, Dean Rasheed dean.a.rash...@gmail.com wrote: On 27 August 2011 12:29, Dean Rasheed dean.a.rash...@gmail.com wrote: ... if nothing else it has been a fun exercise figuring out how the datetime

Re: [HACKERS] Inputting relative datetimes

2011-08-28 Thread Dean Rasheed
On 28 August 2011 00:00, Jeff MacDonald j...@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

Re: [HACKERS] Inputting relative datetimes

2011-08-27 Thread Dean Rasheed
On 27 August 2011 02:32, Robert Haas robertmh...@gmail.com wrote: Frankly, our current date parsing code is pretty darn strange and flaky... So Robert and Merlin both expressed concerns that the existing datetime string parsing code is so complicated that adding to it would likely just

Re: [HACKERS] Inputting relative datetimes

2011-08-27 Thread Dean Rasheed
On 27 August 2011 12:29, Dean Rasheed dean.a.rash...@gmail.com wrote: ... if nothing else it has been a fun exercise figuring out how the datetime string parsing code works. While looking through the current code, I spotted the following oddity: select timestamp 'yesterday 10:30';

Re: [HACKERS] Inputting relative datetimes

2011-08-27 Thread Peter Eisentraut
On lör, 2011-08-27 at 12:29 +0100, Dean Rasheed wrote: So Robert and Merlin both expressed concerns that the existing datetime string parsing code is so complicated that adding to it would likely just introduce more bugs. My first thought was 'how hard can it be?' - famous last words :-)

Re: [HACKERS] Inputting relative datetimes

2011-08-27 Thread Jeff MacDonald
Greetings, On Thursday, August 25, 2011 05:39:09 AM Dean Rasheed wrote: As background, I have an app that accepts user text input and casts it to a timestamp in order to produce reports. I use PostgreSQL's timestamp input conversion for this, since it gives a lot of flexibility, and can parse

Re: [HACKERS] Inputting relative datetimes

2011-08-27 Thread Dean Rasheed
On 27 August 2011 14:14, Peter Eisentraut pete...@gmx.net wrote: On lör, 2011-08-27 at 12:29 +0100, Dean Rasheed wrote: So Robert and Merlin both expressed concerns that the existing datetime string parsing code is so complicated that adding to it would likely just introduce more bugs. My

Re: [HACKERS] Inputting relative datetimes

2011-08-27 Thread Dean Rasheed
On 27 August 2011 14:29, Jeff MacDonald j...@zoidtechnologies.com wrote: Greetings, On Thursday, August 25, 2011 05:39:09 AM Dean Rasheed wrote: As background, I have an app that accepts user text input and casts it to a timestamp in order to produce reports. I use PostgreSQL's timestamp

Re: [HACKERS] Inputting relative datetimes

2011-08-27 Thread Jeff MacDonald
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

Re: [HACKERS] Inputting relative datetimes

2011-08-27 Thread Robert Haas
On Sat, Aug 27, 2011 at 7:43 AM, Dean Rasheed dean.a.rash...@gmail.com wrote: On 27 August 2011 12:29, Dean Rasheed dean.a.rash...@gmail.com wrote: ... if nothing else it has been a fun exercise figuring out how the datetime string parsing code works. While looking through the current code, I

Re: [HACKERS] Inputting relative datetimes

2011-08-26 Thread Jim Nasby
On Aug 25, 2011, at 5:08 AM, Dean Rasheed wrote: Funny you should mention intervals... timestamptz 'today' - interval '5 days' timestamptz 'now' + interval '2 hours' Yes, but what I am trying to achieve is a way of entering such relative timestamps using a single input value, so that

Re: [HACKERS] Inputting relative datetimes

2011-08-26 Thread Robert Haas
On Fri, Aug 26, 2011 at 4:32 PM, Jim Nasby j...@nasby.net wrote: On Aug 25, 2011, at 5:08 AM, Dean Rasheed wrote: Funny you should mention intervals... timestamptz 'today' - interval '5 days' timestamptz 'now' + interval '2 hours' Yes, but what I am trying to achieve is a way of entering

[HACKERS] Inputting relative datetimes

2011-08-25 Thread Dean Rasheed
As background, I have an app that accepts user text input and casts it to a timestamp in order to produce reports. I use PostgreSQL's timestamp input conversion for this, since it gives a lot of flexibility, and can parse pretty much anything the users throw at it. It is also handy that it

Re: [HACKERS] Inputting relative datetimes

2011-08-25 Thread Vik Reykja
On Thu, Aug 25, 2011 at 11:39, Dean Rasheed dean.a.rash...@gmail.comwrote: My first thought was to have some general way of adding or subtracting an interval at the end of an input timestamp, eg. by adding another couple of special values - plus interval and minus interval. This would allow

Re: [HACKERS] Inputting relative datetimes

2011-08-25 Thread Dean Rasheed
On 25 August 2011 10:43, Vik Reykja vikrey...@gmail.com wrote: On Thu, Aug 25, 2011 at 11:39, Dean Rasheed dean.a.rash...@gmail.com wrote: My first thought was to have some general way of adding or subtracting an interval at the end of an input timestamp, eg. by adding another couple of

Re: [HACKERS] Inputting relative datetimes

2011-08-25 Thread Merlin Moncure
On Thu, Aug 25, 2011 at 5:08 AM, Dean Rasheed dean.a.rash...@gmail.com wrote: On 25 August 2011 10:43, Vik Reykja vikrey...@gmail.com wrote: On Thu, Aug 25, 2011 at 11:39, Dean Rasheed dean.a.rash...@gmail.com wrote: My first thought was to have some general way of adding or subtracting an

Re: [HACKERS] Inputting relative datetimes

2011-08-25 Thread Josh Berkus
Yes, but what I am trying to achieve is a way of entering such relative timestamps using a single input value, so that absolute and relative timestamps can both be bound to a SQL query using just one variable. I think adding a function would be the way to go then. Maybe extending