Skip site navigation (1) Skip section navigation (2)

Re: [NOVICE] change data type 'money' to '€'

From: Ognjen Blagojevic <ognjen(dot)d(dot)blagojevic(at)gmail(dot)com>
To: Postgres novice mailing list <pgsql-novice(at)postgresql(dot)org>
Subject: Re: [NOVICE] change data type 'money' to '€'
Date: 2011-06-30 20:02:51
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Hi Mäggi,

On 30.6.2011 17:15, Mäggi Hieber wrote:
> In our project table we have a column with costs, using data typ
> "money". By default PostgreSQL always applys '$', but we would like to
> have '€'.
> How can I change the data type "money" (currency) of a column in an
> existing table to '€'?

It is locale specific thing, defined in variable lc_monetary. If your 
locale uses $, it will display $. If you want to display EUR instead, 
you will need to set lc_monetary to the country using euros (say, Germany).

You may set lc_monetary in postgresql.conf, or within your sql client. 
Here is the latter test case:

create table money_test (
   m money not null,
   primary key(m)
insert into money_test values ('123');
set lc_monetary="de_DE(at)euro";
select * from money_test;


In response to

pgsql-novice by date

Next:From: Jean-Yves F. BarbierDate: 2011-06-30 20:34:51
Subject: Re: change data type 'money' to '€'
Previous:From: Vincent MichelDate: 2011-06-30 16:33:09
Subject: Fast identifiers table creation

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group