Re: [HACKERS] [GENERAL] to_timestamp() and quarters

2010-03-03 Thread Brendan Jurd
On 4 March 2010 04:08, Tom Lane wrote: > Brendan Jurd writes: >> For example, you're trying to import a date that is written as "Wed >> 3rd March, Q1 2010".  You might give to_date a format string like 'Dy >> FMDDTH Month, "Q"Q ' and expect to get the correct answer.  If we >> start throwing

Re: [HACKERS] [GENERAL] to_timestamp() and quarters

2010-03-03 Thread Tom Lane
Brendan Jurd writes: > For example, you're trying to import a date that is written as "Wed > 3rd March, Q1 2010". You might give to_date a format string like 'Dy > FMDDTH Month, "Q"Q ' and expect to get the correct answer. If we > start throwing an error on the Q field, then users would have

Re: [HACKERS] [GENERAL] to_timestamp() and quarters

2010-03-03 Thread Bruce Momjian
Brendan Jurd wrote: > > Well, I can easily make it do what you expect, and I don't see many > > error returns in that area of the code, so I just wrote a patch that > > does what you would expect rather than throw an error. > > > > ? ? ? ?test=> select to_date('2010-1', '-Q'); > > ? ? ? ? ?to_d

Re: [HACKERS] [GENERAL] to_timestamp() and quarters

2010-03-03 Thread Brendan Jurd
On 3 March 2010 14:34, Bruce Momjian wrote: > Scott Bailey wrote: >> Tom Lane wrote: >> > Asher Hoskins writes: >> >> I can't seem to get to_timestamp() or to_date() to work with quarters, >> > >> > The source code says >> > >> >                  * We ignore Q when converting to date because it i

Re: [HACKERS] [GENERAL] to_timestamp() and quarters

2010-03-03 Thread Bruce Momjian
Albe Laurenz wrote: > > But stop, now i see: > > > > test=*# select to_date('2010-02-29', '-MM-DD'); > > to_date > > > > 2010-03-01 > > (1 row) > > > > So it is maybe a congruously behavior ;-) > > Ugh. I thought that to_date was an Oracle compatibility function. > > SQL> se

Re: [HACKERS] [GENERAL] to_timestamp() and quarters

2010-03-03 Thread Albe Laurenz
A. Kretschmer *EXTERN* > > Well, I can easily make it do what you expect, and I don't see many > > error returns in that area of the code, so I just wrote a patch that > > does what you would expect rather than throw an error. > > Well, that's great and better than an error, thx. > > > test=>

Re: [HACKERS] [GENERAL] to_timestamp() and quarters

2010-03-02 Thread A. Kretschmer
In response to Bruce Momjian : > Well, I can easily make it do what you expect, and I don't see many > error returns in that area of the code, so I just wrote a patch that > does what you would expect rather than throw an error. Well, that's great and better than an error, thx. > test=> sel

Re: [HACKERS] [GENERAL] to_timestamp() and quarters

2010-03-02 Thread Bruce Momjian
Scott Bailey wrote: > Tom Lane wrote: > > Asher Hoskins writes: > >> I can't seem to get to_timestamp() or to_date() to work with quarters, > > > > The source code says > > > > * We ignore Q when converting to date because it is not > > * normative. > >