BUG #3634: Numeric and Array Data Type

Поиск
Список
Период
Сортировка
От zhuge
Тема BUG #3634: Numeric and Array Data Type
Дата
Msg-id 200709250932.l8P9WUwE054504@wwwmaster.postgresql.org
обсуждение исходный текст
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      3634
Logged by:          zhuge
Email address:      zhuge@Rinaix.cn
PostgreSQL version: 8.1.9
Operating system:   Linux
Description:        Numeric and Array Data Type
Details:

To:    Tom Lane <tgl@sss.pgh.pa.us>

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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "andrew"
Дата:
Сообщение: BUG #3632: couldn't start postgreSQL
Следующее
От: Michael Meskes
Дата:
Сообщение: Re: BUG #3623: initialisation probl.