Tom Lane wrote:
> Again, I'm trying to look at the big picture of both syntactic and
> semantic errors. If we solve only the syntactic end of it I think we'd
> actually be worse off, because then users would be even more lost when
> they hit a semantic error (unwanted substitution).
The only real solution is to have some clear syntactic sugar denoting
where variables are to be interpolated: SELECT * FROM foo WHERE (bar + 1) = bar -- Which is the var? SELECT * FROM
fooWHERE (bar + 1) = $bar -- OK SELECT * FROM foo WHERE (bar + 1) = {bar} -- OK
It's not clear to plpgsql because it's *not clear*.
In any other namespace-conflict situation I can think of it's always
inner-definition-is-visible. This would of course solve the problem, but only by preventing you from substituting in
variablesthat conflict
with columns. Unless you generate a warning at function compile-time
that doesn't seem much better.
-- Richard Huxton Archonet Ltd