Skip site navigation (1) Skip section navigation (2)

Re: Returning tuple(s) from C-Functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Philip Poten <philip(dot)poten(at)linuxteam(dot)at>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Returning tuple(s) from C-Functions
Date: 2001-04-30 05:31:59
Message-ID: 10831.988608719@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-general
Philip Poten <philip(dot)poten(at)linuxteam(dot)at> writes:
> This is what the FAQ says about it:

> 5.3) How do I write a C function to return a tuple?

> This requires wizardry so extreme that the authors have never tried it,
> though in principle it can be done?

> Is this answer still correct? Is there a way to do it with 7.1?

It's not so much that the wizardry is extreme as that once you've done
it, the resulting function is not all that useful, because there's not
very much you can *do* with a function returning tuples.  You might
care to experiment with SQL functions that return tuples to see whether
the system will support what you need to do, before you spend a lot of
effort on replicating their behavior.

In case that wasn't a clear enough hint: to do it, lift appropriate
code from SQL function execution (backend/executor/functions.c).

Be aware that this interface will likely be redesigned whenever we
get around to allowing functions as table sources, which is exactly
the step needed to make such things more conveniently usable.  Might
happen for 7.2 ...

			regards, tom lane

In response to

pgsql-general by date

Next:From: Tom LaneDate: 2001-04-30 05:39:45
Subject: Re: PostgreSQL and mySQL database size question
Previous:From: Alfred PerlsteinDate: 2001-04-30 05:29:08
Subject: Postgresql CVSup server down?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group