Re: NEW and OLD in EXECUTE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Rod Taylor" <rod(dot)taylor(at)inquent(dot)com>
Cc: "Hackers List" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NEW and OLD in EXECUTE
Date: 2001-02-14 00:10:46
Message-ID: 12061.982109446@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Rod Taylor" <rod(dot)taylor(at)inquent(dot)com> writes:
> Are we not allowed to use NEW and OLD in an EXECUTEd statement?

Not for 7.1, I'm afraid. EXECUTE doesn't provide *any* connection
to the plpgsql function's local namespace; it just hands off the
constructed string to the main SQL parser.

In most cases you can work around this by interpolating the variable's
value into the constructed string, eg,

execute ''update foo set bar = '' || new.bar;

Use quote_literal() when interpolating a nonnumeric value this way.

I do have some ideas about improving the situation in 7.2 or later ...

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2001-02-14 01:09:15 Re: Recovery of PGSQL after system crash failing!!!
Previous Message Peter Eisentraut 2001-02-13 19:39:11 Re: locale support