Return-Path: owner-postman
Received: from localhost (localhost [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id SAA18810 for postgres-dist; Wed, 23 Mar 1994 18:16:47 -0800
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199403240216.SAA18810@nobozo.CS.Berkeley.EDU>
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from faerie.CS.Berkeley.EDU (faerie.CS.Berkeley.EDU [128.32.149.14]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with ESMTP id SAA18801 for <POSTGRES@postgres.Berkeley.EDU>; Wed, 23 Mar 1994 18:16:46 -0800
Received: from localhost (localhost [127.0.0.1]) by faerie.CS.Berkeley.EDU (8.6.4/8.1B) with SMTP id SAA01937; Wed, 23 Mar 1994 18:15:58 -0800
Message-Id: <199403240215.SAA01937@faerie.CS.Berkeley.EDU>
X-Authentication-Warning: faerie.CS.Berkeley.EDU: Host localhost didn't use HELO protocol
From: aoki@postgres.Berkeley.EDU (Paul M. Aoki)
To: martin@pozn1v.tup.edu.pl
Cc: POSTGRES@postgres.Berkeley.EDU
Subject: Re: functions returning TUPLE type 
Reply-To: aoki@postgres.Berkeley.EDU (Paul M. Aoki)
In-reply-to: Your message of Tue, 08 Mar 1994 17:23:49 MET 
	     <0097B230.5E9F94C0.3260@pozn1v.tup.edu.pl> 
Date: Wed, 23 Mar 94 18:15:58 -0800
X-Sender: aoki@postgres.Berkeley.EDU
Resent-To: postgres-dist@postgres.Berkeley.EDU
X-Mts: smtp
Resent-Date: Wed, 23 Mar 94 18:16:46 -0800
Resent-XMts: smtp

martin@pozn1v.tup.edu.pl writes:
> 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.

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  |  aoki@postgres.Berkeley.EDU
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki
