Re: The tuple structure of a not-yet-assigned record is indeterminate.

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: M L <novemberox(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: The tuple structure of a not-yet-assigned record is indeterminate.
Date: 2009-03-23 08:40:42
Message-ID: 49C74B0A.8010404@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2009-03-23 09:30:09 Re: text column constraint, newbie question
Previous Message Ivan Sergio Borgonovo 2009-03-23 08:33:36 Re: text column constraint, newbie question