postgresql/src/include/optimizer
Tom Lane eaccfded98 Centralize the logic for detecting misplaced aggregates, window funcs, etc.
Formerly we relied on checking after-the-fact to see if an expression
contained aggregates, window functions, or sub-selects when it shouldn't.
This is grotty, easily forgotten (indeed, we had forgotten to teach
DefineIndex about rejecting window functions), and none too efficient
since it requires extra traversals of the parse tree.  To improve matters,
define an enum type that classifies all SQL sub-expressions, store it in
ParseState to show what kind of expression we are currently parsing, and
make transformAggregateCall, transformWindowFuncCall, and transformSubLink
check the expression type and throw error if the type indicates the
construct is disallowed.  This allows removal of a large number of ad-hoc
checks scattered around the code base.  The enum type is sufficiently
fine-grained that we can still produce error messages of at least the
same specificity as before.

Bringing these error checks together revealed that we'd been none too
consistent about phrasing of the error messages, so standardize the wording
a bit.

Also, rewrite checking of aggregate arguments so that it requires only one
traversal of the arguments, rather than up to three as before.

In passing, clean up some more comments left over from add_missing_from
support, and annotate some tests that I think are dead code now that that's
gone.  (I didn't risk actually removing said dead code, though.)
2012-08-10 11:36:15 -04:00
..
clauses.h Account for SRFs in targetlists in planner rowcount estimates. 2012-07-21 17:45:07 -04:00
cost.h Implement SQL-standard LATERAL subqueries. 2012-08-07 19:02:54 -04:00
geqo_copy.h
geqo_gene.h
geqo_misc.h
geqo_mutation.h
geqo_pool.h
geqo_random.h
geqo_recombination.h
geqo_selection.h
geqo.h
joininfo.h
pathnode.h Implement SQL-standard LATERAL subqueries. 2012-08-07 19:02:54 -04:00
paths.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
placeholder.h
plancat.h Fix planner to pass correct collation to operator selectivity estimators. 2012-07-08 23:51:08 -04:00
planmain.h Fix planner's handling of RETURNING lists in writable CTEs. 2012-04-25 20:20:33 -04:00
planner.h Account for SRFs in targetlists in planner rowcount estimates. 2012-07-21 17:45:07 -04:00
predtest.h
prep.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
restrictinfo.h Revise parameterized-path mechanism to fix assorted issues. 2012-04-19 15:53:47 -04:00
subselect.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
tlist.h
var.h Centralize the logic for detecting misplaced aggregates, window funcs, etc. 2012-08-10 11:36:15 -04:00