The following bug has been logged online:
Bug reference: 3634
Logged by: zhuge
Email address: [EMAIL PROTECTED]
PostgreSQL version: 8.1.9
Operating system: Linux
Description: Numeric and Array Data Type
Details:
To: Tom Lane <[EMAIL PROTECTED]>
Thank you for your help. You are right.
Today, I write a function, get_order_total_amount(_order_code_ text), which
reads the order table and compute the amount and return the amount. The
amount belongs to "numeric" data type, but the C function has no relative
numeric data type. If I write the script like the following:
CREATE OR REPLACE FUNCTION get_order_total_amount(text)
RETURNS numeric --> Here, if float8, then right
AS 'libdpa-pg_sql_c_func', 'get_order_total_amount'
LANGUAGE C STRICT;
then error occurs . The C function returns double (i.e. float8). How can I
let the C function return the numeric data type?
And I have another question: How can I access the array argument elements
(passed from SQL script like the following) in C function?
CREATE OR REPLACE FUNCTION get_order_total_amount(text[])
RETURNS numeric
AS 'libdpa-pg_sql_c_func', 'get_order_total_amount'
LANGUAGE C STRICT;
Note that the argument, text[], is array type different from the above
argument, text. In C function, how to access the array elements?
Please help me.
Thank you agian.
zhuge
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match