RECORD.* doesn't work in plpgsql, but NEW.* and OLD.* do in trigger
functions created in plpgsql.
The example function process_emp_audit() on page
http://www.postgresql.org/docs/8.3/interactive/plpgsql-trigger.html , shows
that we can use OLD.* and NEW.* as:
INSERT INTO emp_audit SELECT 'D', now(), user, OLD.*;
but if I try to do the same thing in my own plpgsql function, it throws
a runtime ERROR:
create table t1( a int, b char );
create table t2( a int, b char );
create or replace function log_rotate() returns void as $$
declare
rec record;
begin
for rec in delete from t2 returning * loop
insert into t1 select 1, rec.*; -- throws ERROR: record type has
not been registered
end loop;
end;
$$ language 'plpgsql';
select log_rotate();
Is this intentional, or is this a bug?
Best regards,
--
[EMAIL PROTECTED]
[EMAIL PROTECTED] gmail | hotmail | indiatimes | yahoo }.com
EnterpriseDB http://www.enterprisedb.com
Mail sent from my BlackLaptop device