Re: [GENERAL] setof record "out" syntax and returning records - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: [GENERAL] setof record "out" syntax and returning records
Date
Msg-id 20080121004814.GA25201@alvh.no-ip.org
Whole thread Raw
Responses Re: [GENERAL] setof record "out" syntax and returning records  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
This thread made me try this example.  Note that there's a WARNING in the spot
where I pressed tab.

alvherre=# create or replace function foo (out pg_class) language plpgsql as $$ declare i pg_class%rowtype; begin for i
inselect * from pg_class loop return next; end loop; end; $$;
 
ERROR:  cannot use RETURN NEXT in a non-SETOF function en o cerca de «next»
LINEA 1: ...begin for i in select * from pg_class loop return next; end ...
               ^
 
alvherre=# set lc_messWARNING:  problem in alloc set PL/PgSQL function context: detected write past chunk end in block
0xb541d0,chunk 0xb562c0
 
ages to 'C';
WARNING:  problem in alloc set PL/PgSQL function context: detected write past chunk en
d in block 0xb541d0, chunk 0xb562c0
SET


The reason I tried to change lc_messages is that the spanish message
struck me as a bit odd and wanted to see what the english message looked
like.

The full sequence required to create the message in a clean backend, regardless
of whether the foo(pg_class) function exists previously, is:

create function foo (out pg_class) language plpgsql as $$ declare i pg_class%type; begin for i in select * from
pg_classloop return next; end loop; end; $$;
 
create or replace function foo (out pg_class) language plpgsql as $$ declare i pg_class%type; begin for i in select *
frompg_class loop return next; end loop; end; $$;
 
create or replace function foo (out pg_class) language plpgsql as $$ declare i pg_class%rowtype; begin for i in select
*from pg_class loop return next; end loop ; end; $$;
 
set lc_mess    <tab>

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: message string fixes
Next
From: Tom Lane
Date:
Subject: Re: [GENERAL] setof record "out" syntax and returning records