I want to create a function that 'on update' and 'on insert' in table A column nome_tabella create another table named as the record just added in A:
on pgAdminIII i have an error on $1 (NEW.nome_tabel la) and i can't understand what's the problem, so I humbly ask help.
Thanks to all
Sentenza
Code:
CREATE FUNCTION trig_creazione_tabella() RETURNS trigger AS $$ BEGIN IF (TG_OP = 'UPDATE') THEN CREATE TABLE NEW.nome_tabella (id serial NOT NULL, sigla_comune character varying(4)); ELSIF (TG_OP = 'INSERT') THEN CREATE TABLE NEW.nome_tabella (id serial NOT NULL, sigla_comune character varying(4)); END IF; RETURN NEW; END; $$ LANGUAGE plpgsql;
Thanks to all
Sentenza
Comment