Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
974bdd94
Commit
974bdd94
authored
Jun 21, 1999
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
On second thought, expression_tree_walker should handle bare
SubLink nodes after all ...
parent
db4a6a26
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
32 deletions
+24
-32
src/backend/optimizer/util/clauses.c
src/backend/optimizer/util/clauses.c
+14
-6
src/backend/parser/parse_agg.c
src/backend/parser/parse_agg.c
+10
-26
No files found.
src/backend/optimizer/util/clauses.c
View file @
974bdd94
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.3
6 1999/06/19 03:41:45
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.3
7 1999/06/21 01:18:02
tgl Exp $
*
*
* HISTORY
* HISTORY
* AUTHOR DATE MAJOR EVENT
* AUTHOR DATE MAJOR EVENT
...
@@ -810,7 +810,8 @@ CommuteClause(Node *clause)
...
@@ -810,7 +810,8 @@ CommuteClause(Node *clause)
* The walker routine should return "false" to continue the tree walk, or
* The walker routine should return "false" to continue the tree walk, or
* "true" to abort the walk and immediately return "true" to the top-level
* "true" to abort the walk and immediately return "true" to the top-level
* caller. This can be used to short-circuit the traversal if the walker
* caller. This can be used to short-circuit the traversal if the walker
* has found what it came for.
* has found what it came for. "false" is returned to the top-level caller
* iff no invocation of the walker returned "true".
*
*
* The node types handled by expression_tree_walker include all those
* The node types handled by expression_tree_walker include all those
* normally found in target lists and qualifier clauses during the planning
* normally found in target lists and qualifier clauses during the planning
...
@@ -827,10 +828,11 @@ CommuteClause(Node *clause)
...
@@ -827,10 +828,11 @@ CommuteClause(Node *clause)
* appropriate behavior by recognizing subplan nodes and doing the right
* appropriate behavior by recognizing subplan nodes and doing the right
* thing.
* thing.
*
*
* Bare SubLink nodes (without a SUBPLAN_EXPR) will trigger an error unless
* Bare SubLink nodes (without a SUBPLAN_EXPR) are handled by recursing into
* detected and processed by the walker. We expect that walkers used before
* the "lefthand" argument list only. (A bare SubLink should be seen only if
* sublink processing is done will handle them properly. (XXX Maybe ignoring
* the tree has not yet been processed by subselect.c.) Again, this can be
* them would be better default behavior?)
* overridden by the walker, but it seems to be the most useful default
* behavior.
*--------------------
*--------------------
*/
*/
...
@@ -923,6 +925,12 @@ expression_tree_walker(Node *node, bool (*walker) (), void *context)
...
@@ -923,6 +925,12 @@ expression_tree_walker(Node *node, bool (*walker) (), void *context)
return
true
;
return
true
;
}
}
break
;
break
;
case
T_SubLink
:
/* A "bare" SubLink (note we will not come here if we found
* a SUBPLAN_EXPR node above). Examine the lefthand side,
* but not the oper list nor the subquery.
*/
return
walker
(((
SubLink
*
)
node
)
->
lefthand
,
context
);
case
T_List
:
case
T_List
:
foreach
(
temp
,
(
List
*
)
node
)
foreach
(
temp
,
(
List
*
)
node
)
{
{
...
...
src/backend/parser/parse_agg.c
View file @
974bdd94
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.2
2 1999/06/19 03:48:31
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.2
3 1999/06/21 01:18:02
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -43,9 +43,7 @@ static bool exprIsAggOrGroupCol_walker(Node *node, List *groupClauses);
...
@@ -43,9 +43,7 @@ static bool exprIsAggOrGroupCol_walker(Node *node, List *groupClauses);
* Returns true if any aggregate found.
* Returns true if any aggregate found.
*
*
* NOTE: we assume that the given clause has been transformed suitably for
* NOTE: we assume that the given clause has been transformed suitably for
* parser output. This means we can use the planner's expression_tree_walker,
* parser output. This means we can use the planner's expression_tree_walker.
* except that we have to process SubLink nodes specially, since they haven't
* been turned into SubPlan nodes yet.
*/
*/
static
bool
static
bool
contain_agg_clause
(
Node
*
clause
)
contain_agg_clause
(
Node
*
clause
)
...
@@ -60,12 +58,6 @@ contain_agg_clause_walker(Node *node, void *context)
...
@@ -60,12 +58,6 @@ contain_agg_clause_walker(Node *node, void *context)
return
false
;
return
false
;
if
(
IsA
(
node
,
Aggref
))
if
(
IsA
(
node
,
Aggref
))
return
true
;
/* abort the tree traversal and return true */
return
true
;
/* abort the tree traversal and return true */
if
(
IsA
(
node
,
SubLink
))
{
/* Examine the lefthand side, but not the oper list nor the subquery */
SubLink
*
sublink
=
(
SubLink
*
)
node
;
return
contain_agg_clause_walker
((
Node
*
)
sublink
->
lefthand
,
context
);
}
return
expression_tree_walker
(
node
,
contain_agg_clause_walker
,
context
);
return
expression_tree_walker
(
node
,
contain_agg_clause_walker
,
context
);
}
}
...
@@ -75,16 +67,15 @@ contain_agg_clause_walker(Node *node, void *context)
...
@@ -75,16 +67,15 @@ contain_agg_clause_walker(Node *node, void *context)
* other than within the arguments of aggregate functions.
* other than within the arguments of aggregate functions.
*
*
* NOTE: we assume that the given clause has been transformed suitably for
* NOTE: we assume that the given clause has been transformed suitably for
* parser output. This means we can use the planner's expression_tree_walker,
* parser output. This means we can use the planner's expression_tree_walker.
* except that we have to process SubLink nodes specially, since they haven't
* been turned into SubPlan nodes yet.
*
*
* NOTE: in the case of a SubLink, we do not descend into the subquery. This
* NOTE: in the case of a SubLink, expression_tree_walker does not descend
* means we will fail to detect ungrouped columns that appear as outer-level
* into the subquery. This means we will fail to detect ungrouped columns
* variables within a subquery. That seems unreasonably hard to handle here.
* that appear as outer-level variables within a subquery. That case seems
* Instead, we expect the planner to check for ungrouped columns after it's
* unreasonably hard to handle here. Instead, we expect the planner to check
* found all the outer-level references inside the subquery and converted
* for ungrouped columns after it's found all the outer-level references
* them into a list of parameters for the subquery.
* inside the subquery and converted them into a list of parameters for the
* subquery.
*/
*/
static
bool
static
bool
exprIsAggOrGroupCol
(
Node
*
expr
,
List
*
groupClauses
)
exprIsAggOrGroupCol
(
Node
*
expr
,
List
*
groupClauses
)
...
@@ -128,13 +119,6 @@ exprIsAggOrGroupCol_walker(Node *node, List *groupClauses)
...
@@ -128,13 +119,6 @@ exprIsAggOrGroupCol_walker(Node *node, List *groupClauses)
return
false
;
/* outer-level Var is acceptable */
return
false
;
/* outer-level Var is acceptable */
}
}
/* Otherwise, recurse. */
/* Otherwise, recurse. */
if
(
IsA
(
node
,
SubLink
))
{
/* Examine the lefthand side, but not the oper list nor the subquery */
SubLink
*
sublink
=
(
SubLink
*
)
node
;
return
exprIsAggOrGroupCol_walker
((
Node
*
)
sublink
->
lefthand
,
groupClauses
);
}
return
expression_tree_walker
(
node
,
exprIsAggOrGroupCol_walker
,
return
expression_tree_walker
(
node
,
exprIsAggOrGroupCol_walker
,
(
void
*
)
groupClauses
);
(
void
*
)
groupClauses
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment