Re: Set-returning function syntax

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: mail(at)joeconway(dot)com, joel(at)joelburton(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Set-returning function syntax
Date: 2002-05-19 00:17:48
Message-ID: 25161.1021767468@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> writes:
> 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?

The "setof" part is documented in src/backend/utils/fmgr/README.
There's no good documentation for returning tuples at the moment,
but basically you return a pointer to a TupleTableSlot. (Re-use
the same slot on each call to avoid memory leakage.) There's an
example in src/backend/executor/functions.c --- look at the uses
of funcSlot.

One reason this isn't documented is that it's really ugly. It might
be a good idea to change it before we start having lots of user-written
code that depends on it ...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2002-05-19 00:21:13 Re: Set-returning function syntax
Previous Message Tatsuo Ishii 2002-05-19 00:03:11 Re: Set-returning function syntax