Search Postgresql Archives

Re: numeric data type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Juan Pablo L." <jpablolorenzetti@xxxxxxxxxxx> writes:
> Hi, i m writing a C module (extension),  the procedure has a parameter that is of type numeric, 
> inside the function i can not read the parameter or so it seems, this what is do:

> float8 db_balance,in_chgval;

> in_chgval = PG_GETARG_FLOAT8(2);

> elog(INFO,"in_chgval = %0.2f",in_chgval);

If the C code is written that way, the function has to be declared to take
type float8 (a/k/a double precision), not numeric.

The parser will insert a conversion from numeric to float8 automatically,
so the function will still work with a numeric data column.  You might
lose some precision in the conversion though.

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux