Subject: functions returning TUPLE type

From: [email-masked]
Date: Tue, 08 Mar 1994 17:23:49 MET

Hello everybody,

I am trying to define a C function returning tuples to Postgres.
It's easy to define a function like that:

TUPLE f(t)
TUPLE t;
{
   return(t);
}

and reference it :

retrieve (emp.all) where emp.f.salary>300

However, the tuples returned by the f function (that should be identical)
are apparently changed-- the values are different. Could somebody
advise me what's the problem?
Thanks in advance,
Martin

M.Januchta   ICS, Poznan Tech.University
[email-masked]      Poznan,Poland

---

From: [email-masked] (Paul M. Aoki)
Date: Wed, 23 Mar 94 18:15:58 -0800

[email-masked] writes:
> are apparently changed-- the values are different.

what postgres hands you as a TUPLE is a magic cookie for a tuple.
you would have to return a "copy" of the magic cookie, but the 
copying is not straightforward and there's no user API for doing it.
--
  Paul M. Aoki  |  CS Div., Dept. of EECS, UCB  |  [email-masked]
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki