From: | Lew <lew(at)lewscanon(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: | 2007-08-12 11:33:42 |
Message-ID: | 4t6dnWfG99WKbSPbnZ2dnUVZ_hadnZ2d@comcast.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
Javier Fonseca V. wrote:
> Hello.
>
> I'm doing a Trigger Procedure in pl/pgSQL. It makes some kind of auditing.
>
> I think that it's working alright except for the next line:
>
> EXECUTE 'INSERT INTO ' || quote_ident(somedynamictablename) || ' SELECT
> new.*';
>
> PostgreSQL keeps telling me: "ERROR: NEW used in query that is not in a
> rule". I think that this NEW problem is because of the scope of the
> EXECUTE statement (outside the scope of the trigger), so it doesn't
> recognize the NEW record.
>
> Maybe I could fix it concatenating column names and the 'new' values but
> I want to do my trigger as flexible as possible (I have several tables
> to audit).
>
> Somebody has any suggestion?
You got some suggestions in response to your multipost of this question in
pgsql.sql.
--
Lew
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2007-08-12 13:39:39 | Re: timestamp skew during 7.4 -> 8.2 upgrade |
Previous Message | hubert depesz lubaczewski | 2007-08-11 19:07:32 | Re: Trigger Procedure Error: NEW used in query that is not in a rule |
From | Date | Subject | |
---|---|---|---|
Next Message | Loredana Curugiu | 2007-08-13 08:19:52 | Re: Install two different versions of postgres which should run in parallel |
Previous Message | Andreas Joseph Krogh | 2007-08-11 20:14:58 | Re: Index usage in order by with multiple columns in order-by-clause |