From: | jablonov <jablonov(at)hotmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Trigger Procedure Error: NEW used in query that is not in a rule |
Date: | 2011-09-21 15:32:04 |
Message-ID: | 1316619124366-4826781.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
Here is other option using functionality of ROW and EXECUTE USING.
IF EXISTS(SELECT relname FROM pg_class WHERE relname = tablename)
THEN sql := 'INSERT INTO ' || tablename || ' VALUES (($1).*)';
ELSE sql := 'INSERT INTO ' || tablexception || ' VALUES (($1).*)';
END IF;
tablerow := ROW(NEW.*)::public.measurement;
EXECUTE sql USING tablerow;
RETURN new;
--
View this message in context: http://postgresql.1045698.n5.nabble.com/Trigger-Procedure-Error-NEW-used-in-query-that-is-not-in-a-rule-tp1886197p4826781.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
From | Date | Subject | |
---|---|---|---|
Next Message | hamann.w | 2011-09-21 15:59:49 | looking for a faster way to do that |
Previous Message | Susan Cassidy | 2011-09-21 15:25:05 | Re: SQL function and input variables |
From | Date | Subject | |
---|---|---|---|
Next Message | Brian Sherwood | 2011-09-21 16:27:41 | Re: select xpath ... |
Previous Message | Filip Rembiałkowski | 2011-09-21 15:07:29 | Re: handling duplicate row exception |