Keith Wong <[EMAIL PROTECTED]> writes:
> create function tp_info () returns opaque as '
>       begin
>               -- insert into audit table
>               insert into AudInfo (info_id, some_data, aud_operation_type) values 
> (new.info_id, new.some_data, ''i'');
>               return new;
>       end;
> ' language 'plpgsql';

> create trigger tp_info before insert on Info
>       for each row execute procedure tp_info();

> This doesn't work however. A parse error occurs in the first line.
> I suspect that I cannot insert a record into another table in a trigger. 

You certainly can --- I have apps that do it all the time.  I suspect
maybe the plpgsql parser gets confused by SQL-style comments?  Your
example seems to work fine if I leave out the comment.

                        regards, tom lane

Reply via email to