Re: How to transform pg_7.4 function 'to_number' to 8.4 equivalent?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ennio-Sr <nasr(dot)laili(at)tin(dot)it>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: How to transform pg_7.4 function 'to_number' to 8.4 equivalent?
Date: 2008-10-17 18:43:44
Message-ID: 25414.1224269024@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Ennio-Sr <nasr(dot)laili(at)tin(dot)it> writes:
> after upgrading from pg_7.4 to pg_8.3 when I run this command:

> psql finanza -c "SELECT titolo, var, pr_chius, pr_aper, \
> diff_aper_ch*(-1) as \"diff. ass.\", \
> to_number(diff_aper_ch*(-1)/pr_aper*100::float(8),'9999.000000') as \"sc. %\" \

to_number works on text arguments. I suppose you could make this work
like 7.4 by explicitly casting the expression to text, but the whole
thing seems like the wrong approach altogether. What are you trying to
accomplish --- round the result to six decimal places? If so, it'd be
better to just cast it to numeric(20,6) or some such.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Ennio-Sr 2008-10-18 16:54:10 Re: How to transform pg_7.4 function 'to_number' to 8.4 equivalent?
Previous Message Tom Lane 2008-10-17 18:36:58 Re: "timestamp without timezone" and at "time zone"