The tuple structure of a not-yet-assigned record is indeterminate. - Mailing list pgsql-general

From M L
Subject The tuple structure of a not-yet-assigned record is indeterminate.
Date
Msg-id c11212cc0903221547h50a5adfan6c59e1895bb195b6@mail.gmail.com
Whole thread Raw
Responses Re: The tuple structure of a not-yet-assigned record is indeterminate.  (Craig Ringer <craig@postnewspapers.com.au>)
List pgsql-general
Hi there, i'm new to postgres. I want to create view when adding new row. So what i've got:

CREATE OR REPLACE FUNCTION add_view() RETURNS trigger AS $$
DECLARE
  someint integer;
BEGIN
  RAISE NOTICE 'dodajesz nowa lige %', NEW.id;
  someint := NEW.id;
  RAISE NOTICE 'dodajesz nowa lige %', someint;
  CREATE VIEW tabelka AS SELECT * FROM t_matches.someint;
RETURN NULL;
END;
$$ language plpgsql;

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


Whats wrong, I supposed that id is not reserverd at the moment, so what can I do?

And here is some infos about table

league=# \d t_leagues
                                  Table "public.t_leagues"
   Column   |         Type          |                       Modifiers                       
------------+-----------------------+--------------------------------------------------------
 id         | integer               | not null default nextval('t_leagues_id_seq'::regclass)
 name       | character varying(20) | not null
 data_start | date                  |
 data_end   | date                  |
 awans      | smallint              | not null default 0
 baraz      | smallint              | not null default 0
 spadek     | smallint              | not null default 0
Indexes:
    "t_leagues_pkey" PRIMARY KEY, btree (id)
Triggers:
    league AFTER INSERT ON t_leagues FOR EACH STATEMENT EXECUTE PROCEDURE add_view()



pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: text column constraint, newbie question
Next
From: Craig Ringer
Date:
Subject: Re: The tuple structure of a not-yet-assigned record is indeterminate.