Trigger Procedure Error: NEW used in query that is not in a rule - Mailing list pgsql-sql

From Javier Fonseca V.
Subject Trigger Procedure Error: NEW used in query that is not in a rule
Date
Msg-id 86d227fd0708110045t16e39442xd35746eb59296362@mail.gmail.com
Whole thread Raw
Responses Re: Trigger Procedure Error: NEW used in query that is not in a rule  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Re: Trigger Procedure Error: NEW used in query that is not in a rule  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-sql
<span class="gmail_quote"></span><p>Hello.<p>I'm doing a Trigger Procedure in pl/pgSQL.  It makes some kind of
auditing.<p>Ithink that it's working alright except for the next line:<p>EXECUTE 'INSERT INTO ' ||
quote_ident(somedynamictablename)|| ' SELECT new.*';<p>PostgreSQL keeps telling me: "ERROR: NEW used in query that is
notin a rule".  I think that this NEW problem is because of the scope of the EXECUTE statement (outside the scope of
thetrigger), so it doesn't recognize the NEW record. <p>Maybe I could fix it concatenating column names and the 'new'
valuesbut I want to do my trigger as flexible as possible (I have several tables to audit).<p>Somebody has any
suggestion?<p>Thanksa lot,<span class="sg"><p>Javier</span> 

pgsql-sql by date:

Previous
From: "Rodrigo De León"
Date:
Subject: Re: Best Fit SQL query statement
Next
From: "Pavel Stehule"
Date:
Subject: Re: Trigger Procedure Error: NEW used in query that is not in a rule