Re: [GENERAL] to_timestamp() and quarters

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brendan Jurd <direvus(at)gmail(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Scott Bailey <artacus(at)comcast(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [GENERAL] to_timestamp() and quarters
Date: 2010-03-03 17:08:18
Message-ID: 11420.1267636098@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Brendan Jurd <direvus(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2010-03-03 17:22:21 Re: [GENERAL] to_timestamp() and quartersf
Previous Message Bruce Momjian 2010-03-03 17:07:24 Re: [GENERAL] to_timestamp() and quarters

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2010-03-03 17:22:21 Re: [GENERAL] to_timestamp() and quartersf
Previous Message Bruce Momjian 2010-03-03 17:07:24 Re: [GENERAL] to_timestamp() and quarters