Re: Pl/pgsql functions causing crashes in 8.2.2 - Mailing list pgsql-hackers

From jon5pg@streamy.com
Subject Re: Pl/pgsql functions causing crashes in 8.2.2
Date
Msg-id 49232.76.172.130.214.1170753727.squirrel@webmail.streamy.com
Whole thread Raw
In response to Pl/pgsql functions causing crashes in 8.2.2  ("Jonathan Gray" <jon5pg@streamy.com>)
Responses Re: Pl/pgsql functions causing crashes in 8.2.2  (Richard Huxton <dev@archonet.com>)
List pgsql-hackers
Reading the post again I caught a typo in my query.  I had been playing
with variations of this test to try and get it working, but I have had no
success with any combination as long as it returns this kind of type.

I was comparing integers to uniqueidentiers, which actually works, but is
unrelated to the issue.

Should be:

> CREATE OR REPLACE FUNCTION test.break_guid (numlower integer, numupper
> integer) RETURNS SETOF test.guid_plus AS
> $$
> DECLARE
>     x RECORD;
>     gplus_ret test.guid_plus;
> BEGIN
>     FOR x IN SELECT id,num FROM test.guid_table WHERE num > numlower AND
num
> < numupper LOOP
>         gplus_ret :=
> (x.id::uniqueidentifier,x.num::integer)::test.guid_plus;
>         -- I usually do the following: (but tried above with same result)
>         --   gplus_ret := (x.id,x.num);
>         RETURN NEXT gplus_ret;
>     END LOOP;
>     RETURN;
> END;
> $$ LANGUAGE plpgsql;


Jonathan Gray
jon5pg@streamy.com



pgsql-hackers by date:

Previous
From: "Simon Riggs"
Date:
Subject: Re: Referential Integrity and SHARE locks
Next
From: "Zeugswetter Andreas ADI SD"
Date:
Subject: Re: libpq docs about PQfreemem