From: | Fabiana Zioti <fabi_zioti(at)hotmail(dot)com> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Receive a string in Composite-type Arguments |
Date: | 2017-08-11 13:09:13 |
Message-ID: | CP1PR80MB074190D34A5C5A8284D7415BFD890@CP1PR80MB0741.lamprd80.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi!
I am studying how to program extensions for PostgreSQL in C language.
In the example to return to return Composite-type Arguments, from the PostgreSQL 9.6 documentation, I could not make the cash from a cstring to the HeapTupleHeader type.
That is, instead of the function receive as a parameter a table:
CREATE FUNCTION c_overpaid (emp, integer) RETURNS boolean
AS DIRECTORY
SELECT name, c_overpaid (emp, 1500) AS overpaid
From emp
WHERE name = 'Bill' OR name = 'Sam';
And in the code in C receive the argument as:
HeapTupleHeader t = PG_GETARG_HEAPTUPLEHEADER (0);
The sql function would be defined as:
CREATE FUNCTION c_overpaid (cstring, integer) RETURNS boolean
AS 'DIRECTORY / funcs', 'c_overpaid'
LANGUAGE C STRICT;
But how would I receive this argument, for example:
Char * str = PG_GETARG_CSTRING (0),
And do the conversion to the HeapTupleHeader type?
What do you guys suggest?
Thanks in advance
From | Date | Subject | |
---|---|---|---|
Next Message | rob stone | 2017-08-11 14:05:40 | Re: sequence used on null value or get the max value for a column whith concurrency |
Previous Message | David G. Johnston | 2017-08-10 23:18:09 | Re: sequence used on null value or get the max value for a column whith concurrency |