M L wrote: > CREATE TRIGGER league AFTER insert ON t_leagues FOR STATEMENT EXECUTE > PROCEDURE add_view(); > > Then in psql I made an query and got error: > > league=# INSERT INTO t_leagues (name) VALUES('3liga'); > ERROR: record "new" is not assigned yet > DETAIL: The tuple structure of a not-yet-assigned record is indeterminate. > CONTEXT: PL/pgSQL function "add_view" line 4 at RAISE `NEW' and `OLD' refer to the tuple operated on by this call of the trigger. They're not valid for FOR EACH STATEMENT triggers, since the statement might've added/modified/deleted zero or more than one tuple. If you want to see the values of the tuples modified, use a FOR EACH ROW trigger. > Whats wrong, I supposed that id is not reserverd at the moment That's not the case. Your trigger is being called *AFTER* the row is inserted, so the ID must've been assigned. In any case, default expressions (including those used to assign values from sequences) are actually evaluated even before the BEFORE triggers are invoked. -- Craig Ringer -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general