Re: Set-returning function syntax - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Set-returning function syntax
Date
Msg-id 3CE6EFF9.3000407@joeconway.com
Whole thread Raw
In response to Set-returning function syntax  ("Joel Burton" <joel@joelburton.com>)
List pgsql-hackers
Tatsuo Ishii wrote:
> Does your SRF function allow to return a setof composite data type
> using C function? If so, how can I write such that C function? I
> couldn't find any example or explanation so far. You referred dblink,
> but in my understanding it does not have any function that returns a
> setof composite data type.
>

I haven't written a C function yet that returns a composite type. You 
are correct that dblink does not have an example which returns composite 
type, because that wasn't even possible when I wrote the dblink code ;-)

At least initially, a C function returning a composite type will have to 
do alot of dirty work -- i.e. something like:
- manually form a tuple based on the return type relation attributes
- save the tuple in a tuple table slot
- return a pointer to the slot as a datum

I don't know what other complications may be lurking, but I will try to 
get a working example sometime this coming week and post it to HACKERS.

Joe





pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Set-returning function syntax
Next
From: Joe Conway
Date:
Subject: Re: Set-returning function syntax