Re: function returning a row

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Kjetil Haaland <kjetil(dot)haaland(at)student(dot)uib(dot)no>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-novice(at)postgresql(dot)org
Subject: Re: function returning a row
Date: 2005-02-11 10:09:37
Message-ID: 20050211100937.GA95908@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Thu, Feb 10, 2005 at 01:16:37PM +0100, Kjetil Haaland wrote:

> I have tested my function some more and found out that it is while i am trying
> to return it crashes. If i use a standard type like float it works, but with
> my own type alignres it doesn't. I have used this type as return value in
> other functions before, but not in set returning functions.

I was just looking at the code you posted here:

http://archives.postgresql.org/pgsql-novice/2005-01/msg00371.php

About 20 lines above the call to SRF_RETURN_NEXT(), you allocate
memory and assign it to "result", but then you never do anything
with that variable before trying to return it. It probably contains
garbage, which could be a problem if it's a variable-length type
since the first 4 bytes are supposed to contain the length of
the data.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message John DeSoi 2005-02-11 12:56:39 Re: Book
Previous Message Peter Mount 2005-02-11 10:00:46 Book