RECORD.* doesn't work in Pl/PGSQL

Поиск
Список
Период
Сортировка
От Gurjeet Singh
Тема RECORD.* doesn't work in Pl/PGSQL
Дата
Msg-id 65937bea0804221310s13810497rde82a85cc4c2f288@mail.gmail.com
обсуждение исходный текст
Ответы Re: RECORD.* doesn't work in Pl/PGSQL  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: RECORD.* doesn't work in Pl/PGSQL  ("Merlin Moncure" <mmoncure@gmail.com>)
Список pgsql-hackers
RECORD.* doesn't work in plpgsql, but NEW.* and OLD.* do in trigger functions created in plpgsql.<br /><br />    The
examplefunction process_emp_audit() on page <a
href="http://www.postgresql.org/docs/8.3/interactive/plpgsql-trigger.html">http://www.postgresql.org/docs/8.3/interactive/plpgsql-trigger.html</a>
,shows that we can use OLD.* and NEW.* as:<br /><br />INSERT INTO emp_audit SELECT 'D', now(), user, OLD.*;<br /><br
/>   but if I try to do the same thing in my own plpgsql function, it throws a runtime ERROR:<br /><br />create table
t1(a int, b char );<br /> create table t2( a int, b char );<br /><br clear="all" />create or replace function
log_rotate()returns void as $$<br />declare<br />  rec record;<br />begin<br /><br />    for rec in delete from t2
returning* loop<br />        insert into t1 select 1, rec.*;  -- throws ERROR:  record type has not been registered<br
/>    end loop;<br /><br />end;<br />$$ language 'plpgsql';<br /><br />select log_rotate();<br /><br />    Is this
intentional,or is this a bug?<br /><br />Best regards,<br />-- <br />gurjeet[.singh]@EnterpriseDB.com<br
/>singh.gurjeet@{gmail | hotmail | indiatimes | yahoo }.com<br /><br />EnterpriseDB <a
href="http://www.enterprisedb.com">http://www.enterprisedb.com</a><br/><br />Mail sent from my BlackLaptop device  

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Decibel!
Дата:
Сообщение: Re: MERGE Specification
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: MERGE Specification