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

From Tom Lane
Subject Re: [GENERAL] Count(*) throws error
Date
Msg-id 20467.1184255811@sss.pgh.pa.us
Whole thread Raw
In response to Re: [GENERAL] Count(*) throws error  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: [GENERAL] Count(*) throws error  (Richard Huxton <dev@archonet.com>)
List pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> So instead of substituting them as the tokens are lexed, instead suck in the
> tokens, run the parser -- which we currently do anyways just to check the
> syntax -- then walk the tree looking for ColumnRefs where the name matches a
> variable name. Then keep around that parse tree instead of just the series of
> lex tokens to later call analyze on and execute.

Hmm.  That sounds cool but I think it actually has a pretty substantial
disadvantage --- there is then no easily user-readable representation of
the query that shows *which* occurrences got substituted.  With the
textual replacement method you have a string you can look at, though
it's true that we don't always show it to the user if we are not aware
there's a problem.

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).
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: compiler warnings on the buildfarm
Next
From: Stefan Kaltenbrunner
Date:
Subject: Re: compiler warnings on the buildfarm