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

From Craig Ringer
Subject Re: The tuple structure of a not-yet-assigned record is indeterminate.
Date
Msg-id 49C74B0A.8010404@postnewspapers.com.au
Whole thread Raw
In response to Re: The tuple structure of a not-yet-assigned record is indeterminate.  (M L <novemberox@gmail.com>)
Responses Re: The tuple structure of a not-yet-assigned record is indeterminate.  (M L <novemberox@gmail.com>)
List pgsql-general
M L wrote:

>   CREATE VIEW tabelka AS SELECT someint FROM t_matches;

What exactly are you trying to do here? If it worked how you've written
it,  you'd get the value of `someint' repeated once for each row that
appears in t_matches.

I don't know exactly why you're seeing the behaviour you are. However,
the it works if you build the statement you want as a string and invoke
it using EXECUTE:

CREATE OR REPLACE FUNCTION add_view() RETURNS trigger AS $$
DECLARE
  someint integer;
BEGIN
  EXECUTE 'CREATE VIEW tabelka AS SELECT '||NEW.id||' FROM t_matches;';
RETURN NULL;
END;
$$ language plpgsql;

... though the view produced isn't very useful.

--
Craig Ringer

pgsql-general by date:

Previous
From: Ivan Sergio Borgonovo
Date:
Subject: Re: text column constraint, newbie question
Next
From: Scott Marlowe
Date:
Subject: Re: text column constraint, newbie question