Re: How to convert numbers into words in postgresql - Mailing list pgsql-general

From Adrian Klaver
Subject Re: How to convert numbers into words in postgresql
Date
Msg-id 5192C4DF.7080601@gmail.com
Whole thread Raw
In response to Re: How to convert numbers into words in postgresql  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-general
On 05/14/2013 03:27 PM, Merlin Moncure wrote:
> On Tue, May 14, 2013 at 5:24 PM, Adrian Klaver <adrian.klaver@gmail.com> wrote:

>> Seems to only work with money type.
>
> from the source:
> /* cash_words()
>   * This converts a int4 as well but to a representation using words
>   * Obviously way North American centric - sorry
>   */
> Datum
> cash_words(PG_FUNCTION_ARGS)
> {

Well Pg 9.0 did not get that memo:)

test=> SELECT version();
                                                              version


----------------------------------------------------------------------------------------------------------------------------------
  PostgreSQL 9.0.13 on i686-pc-linux-gnu, compiled by GCC gcc (SUSE
Linux) 4.7.1 20120723 [gcc-4_7-branch revision 189773], 32-bit
(1 row)

test=> SELECT cash_words(123);
ERROR:  function cash_words(integer) does not exist
LINE 1: SELECT cash_words(123);
                ^
HINT:  No function matches the given name and argument types. You might
need to add explicit type casts.

Though using text works:

test=> SELECT cash_words('123');
                    cash_words
-------------------------------------------------
  One hundred twenty three dollars and zero cents


>
> so, it comes down to the money type is one of the more bizarre things
> left from postgres past and we try not to advertise too loudly I
> suppose.

Agreed.

>
> merlin
>


--
Adrian Klaver
adrian.klaver@gmail.com


pgsql-general by date:

Previous
From: Julian
Date:
Subject: Re: How to convert numbers into words in postgresql
Next
From: Oscar Calderon
Date:
Subject: PostgreSQL TCL extension - Redhat 5