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