Re: [GENERAL] to_timestamp() and quarters - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [GENERAL] to_timestamp() and quarters
Date
Msg-id 11420.1267636098@sss.pgh.pa.us
Whole thread Raw
In response to Re: [GENERAL] to_timestamp() and quarters  (Brendan Jurd <direvus@gmail.com>)
Responses Re: [GENERAL] to_timestamp() and quartersf
Re: [GENERAL] to_timestamp() and quarters
List pgsql-hackers
Brendan Jurd <direvus@gmail.com> 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 YYYY' and expect to get the correct answer.  If we
> start throwing an error on the Q field, then users would have to
> resort to some strange circumlocution to get around it.

Hmm.  That's an interesting test case: if Q throws an error, there
doesn't seem to be any way to do it at all, because there is no format
spec for ignoring non-constant text.  Conversely, Bruce's proposed
patch would actually break it, because the Q code would overwrite the
(correct) month information with the first-month-of-the-quarter.

So at the moment my vote is "leave it alone".  If we want to throw
error for Q then we should provide a substitute method of ignoring
a field.  But we could just document Q as ignoring an integer for
input.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] to_timestamp() and quarters
Next
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] to_timestamp() and quartersf