Re: changing 'mons' in interval? - Mailing list pgsql-general

From Klint Gore
Subject Re: changing 'mons' in interval?
Date
Msg-id 4664B7072EA.3E57KG@129.180.47.120
Whole thread Raw
In response to Re: changing 'mons' in interval?  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
On Mon, 4 Jun 2007 11:43:08 +0200, Martijn van Oosterhout <kleptog@svana.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@kgb.une.edu.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             :                 :
+---------------------------------------+-----------------+

pgsql-general by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: what to do when pg_cancel_backend() doesnt work?
Next
From: "Carlos H. Reimer"
Date:
Subject: PostgreSQL abnormally terminating with signal 5