RECORD.* doesn't work in Pl/PGSQL - Mailing list pgsql-hackers

From Gurjeet Singh
Subject RECORD.* doesn't work in Pl/PGSQL
Date
Msg-id 65937bea0804221310s13810497rde82a85cc4c2f288@mail.gmail.com
Whole thread Raw
Responses 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>)
List 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 by date:

Previous
From: Decibel!
Date:
Subject: Re: MERGE Specification
Next
From: Martijn van Oosterhout
Date:
Subject: Re: MERGE Specification