Re: C function to return tuple

From: Marios Vodas <mvodas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: C function to return tuple
Date: 2010-09-26 17:29:23
Message-ID: AANLkTimNF=-CBbyeNSyqRXrSQEZ3xbSbSqNqsb_RFv61@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Suppose I had the data that form the returning tuple in 5 variables like
this:
float8 xi = 1;
float8 yi = 2;
float8 xe = 3;
float8 ye = 4;
int32 id = 1;

In addition the function wouldn't have any input parameters. It just returns
a tuple of type d_type.
Can you tell me how it is possible to form the tuple? My problem here is
that I DON'T have HeapTupleHeaders i and e already formed (those two are of
p_type) so I have to form them somehow.

On Sun, Sep 26, 2010 at 7:52 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Marios Vodas <mvodas(at)gmail(dot)com> writes:
> > //I need to get this working
> > *values[0] = e;*
> > * values[1] = i;*
>
> Maybe you're missing HeapTupleGetDatum() there? Just from a data type
> cleanliness standpoint, you shouldn't ever assign something to Datum or
> vice versa without applying the correct conversion macro.
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dennis Björklund 2010-09-26 17:54:02 Re: Documentation, window functions
Previous Message Robert Haas 2010-09-26 17:28:57 Re: [COMMITTERS] pgsql: Still more tweaking of git_changelog.