Re: "OLD used in query that is not in a rule"

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: "OLD used in query that is not in a rule"
Date: 2012-03-26 14:54:11
Message-ID: 0AD01C53605506449BA127FB8B99E5E10C3596DF@FMSMSX105.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

OK, and understood.
And yes, I thought it was a global.

Thanks Tom.

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Monday, March 26, 2012 10:52 AM
To: Gauthier, Dave
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] "OLD used in query that is not in a rule"

"Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com> writes:
> I get... "OLD used in query that is not in a rule" when trying to ref, for example, OLD.tblcol1, from inside a stored procedure. Is this saying you cannot use OLD.* (or NEW.* I suppose) unless it's from within a trigger function (returns type "trigger")?

Certainly. You'd have to pass the field (or whole record) as a
parameter. It's not some kind of magic global variable, it's
a predefined local variable in a trigger function (or rule).

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message david.sahagian 2012-03-26 14:55:21 Re: Change the default [tgenabled] for new "internal" triggers ?
Previous Message Tom Lane 2012-03-26 14:51:56 Re: "OLD used in query that is not in a rule"