Re: [GENERAL] setof record "out" syntax and returning records

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: [GENERAL] setof record "out" syntax and returning records
Дата
Msg-id 20080121004814.GA25201@alvh.no-ip.org
обсуждение исходный текст
Ответы Re: [GENERAL] setof record "out" syntax and returning records  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: message string fixes
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] setof record "out" syntax and returning records