Re: [GENERAL] Count(*) throws error - Mailing list pgsql-hackers

From Richard Huxton
Subject Re: [GENERAL] Count(*) throws error
Date
Msg-id 46966ED5.4080204@archonet.com
Whole thread Raw
In response to Re: [GENERAL] Count(*) throws error  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: compiler warnings on the buildfarm
Next
From: Tom Lane
Date:
Subject: Re: Assertion failure with inherited column mappings and dropped columns