2010/1/9 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>> OK, I admit that I'm totally new that area of code, so I'm not seeing
>> it - what does it break?
>
> The main problem is...
Ah OK. Thanks for the explanation.
> I think that a variant of your idea could be made to work: change
> plpgsql_LookupIdentifiers to a three-state variable (which'd basically
> mean "in DECLARE, in a SQL expression, anywhere else"), do no lookups in
> DECLARE, and in SQL expressions do lookups but never throw any errors.
> I'll have a go at that.
>
Sounds plausible.
Cheers,
Dean