Re: changing 'mons' in interval?

From: Klint Gore <kg(at)kgb(dot)une(dot)edu(dot)au>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: changing 'mons' in interval?
Date: 2007-06-05 01:06:15
Message-ID: 4664B7072EA.3E57KG@129.180.47.120
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 4 Jun 2007 11:43:08 +0200, Martijn van Oosterhout <kleptog(at)svana(dot)org> wrote:
> On Mon, Jun 04, 2007 at 06:51:37PM +1000, Klint Gore wrote:
> > Is there a way to change mons in interval::text to the full word months
> > without resorting to "replace(aninterval::text,'mon','Month')"? If it
> > can handle locales as well that would be good (but I could live without
> > it).
>
> Have you considered using to_char to get the output in the exact format
> you want?

Yes. It turned out to be a fairly complex statement with case's of
extracts to handle plurals and negatives. That's what lead me to asking.

besides
http://www.postgresql.org/docs/7.4/interactive/functions-formatting.html
"Warning: to_char(interval, text) is deprecated and should not be used
in newly-written code. It will be removed in the next version."

http://www.postgresql.org/docs/8.0/interactive/functions-formatting.html
"Warning: to_char(interval, text) is deprecated and should not be used
in newly-written code. It will be removed in the next version."

And 8.1/8.2 seem to have been revived that warning but still has
to_char(interval,text)

klint.

+---------------------------------------+-----------------+
: Klint Gore : "Non rhyming :
: EMail : kg(at)kgb(dot)une(dot)edu(dot)au : slang - the :
: Snail : A.B.R.I. : possibilities :
: Mail University of New England : are useless" :
: Armidale NSW 2351 Australia : L.J.J. :
: Fax : +61 2 6772 5376 : :
+---------------------------------------+-----------------+

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Carlos H. Reimer 2007-06-05 01:10:43 PostgreSQL abnormally terminating with signal 5
Previous Message Michael Fuhr 2007-06-05 00:08:35 Re: what to do when pg_cancel_backend() doesnt work?