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
2355b69b
Commit
2355b69b
authored
Aug 27, 2010
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small refactoring of makeVar() from a TargetEntry
parent
c10575ff
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
56 deletions
+37
-56
src/backend/nodes/makefuncs.c
src/backend/nodes/makefuncs.c
+18
-1
src/backend/optimizer/path/pathkeys.c
src/backend/optimizer/path/pathkeys.c
+4
-19
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/plan/setrefs.c
+3
-11
src/backend/optimizer/plan/subselect.c
src/backend/optimizer/plan/subselect.c
+2
-6
src/backend/optimizer/prep/prepjointree.c
src/backend/optimizer/prep/prepjointree.c
+2
-6
src/backend/optimizer/util/plancat.c
src/backend/optimizer/util/plancat.c
+2
-6
src/backend/parser/analyze.c
src/backend/parser/analyze.c
+2
-6
src/include/nodes/makefuncs.h
src/include/nodes/makefuncs.h
+4
-1
No files found.
src/backend/nodes/makefuncs.c
View file @
2355b69b
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.6
6 2010/01/02 16:57:46 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.6
7 2010/08/27 20:30:07 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -17,6 +17,7 @@
#include "catalog/pg_type.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "utils/lsyscache.h"
...
...
@@ -90,6 +91,22 @@ makeVar(Index varno,
return
var
;
}
/*
* makeVarFromTargetEntry -
* convenience function to create a same-level Var node from a
* TargetEntry
*/
Var
*
makeVarFromTargetEntry
(
Index
varno
,
TargetEntry
*
tle
)
{
return
makeVar
(
varno
,
tle
->
resno
,
exprType
((
Node
*
)
tle
->
expr
),
exprTypmod
((
Node
*
)
tle
->
expr
),
0
);
}
/*
* makeTargetEntry -
* creates a TargetEntry node
...
...
src/backend/optimizer/path/pathkeys.c
View file @
2355b69b
...
...
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/path/pathkeys.c,v 1.10
1 2010/02/26 02:00:45 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/path/pathkeys.c,v 1.10
2 2010/08/27 20:30:08 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -629,12 +629,7 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel,
Assert
(
list_length
(
sub_eclass
->
ec_members
)
==
1
);
sub_member
=
(
EquivalenceMember
*
)
linitial
(
sub_eclass
->
ec_members
);
outer_expr
=
(
Expr
*
)
makeVar
(
rel
->
relid
,
tle
->
resno
,
exprType
((
Node
*
)
tle
->
expr
),
exprTypmod
((
Node
*
)
tle
->
expr
),
0
);
outer_expr
=
(
Expr
*
)
makeVarFromTargetEntry
(
rel
->
relid
,
tle
);
/*
* Note: it might look funny to be setting sortref = 0 for a
...
...
@@ -712,12 +707,7 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel,
if
(
equal
(
tle
->
expr
,
sub_expr
))
{
/* Exact match */
outer_expr
=
(
Expr
*
)
makeVar
(
rel
->
relid
,
tle
->
resno
,
exprType
((
Node
*
)
tle
->
expr
),
exprTypmod
((
Node
*
)
tle
->
expr
),
0
);
outer_expr
=
(
Expr
*
)
makeVarFromTargetEntry
(
rel
->
relid
,
tle
);
}
else
{
...
...
@@ -730,12 +720,7 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel,
if
(
equal
(
tle_stripped
,
sub_stripped
))
{
/* Match after discarding RelabelType */
outer_expr
=
(
Expr
*
)
makeVar
(
rel
->
relid
,
tle
->
resno
,
exprType
((
Node
*
)
tle
->
expr
),
exprTypmod
((
Node
*
)
tle
->
expr
),
0
);
outer_expr
=
(
Expr
*
)
makeVarFromTargetEntry
(
rel
->
relid
,
tle
);
if
(
exprType
((
Node
*
)
outer_expr
)
!=
exprType
((
Node
*
)
sub_expr
))
outer_expr
=
(
Expr
*
)
...
...
src/backend/optimizer/plan/setrefs.c
View file @
2355b69b
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.16
1 2010/07/12 17:01:06 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.16
2 2010/08/27 20:30:08 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1283,11 +1283,7 @@ search_indexed_tlist_for_non_var(Node *node,
/* Found a matching subplan output expression */
Var
*
newvar
;
newvar
=
makeVar
(
newvarno
,
tle
->
resno
,
exprType
((
Node
*
)
tle
->
expr
),
exprTypmod
((
Node
*
)
tle
->
expr
),
0
);
newvar
=
makeVarFromTargetEntry
(
newvarno
,
tle
);
newvar
->
varnoold
=
0
;
/* wasn't ever a plain Var */
newvar
->
varoattno
=
0
;
return
newvar
;
...
...
@@ -1325,11 +1321,7 @@ search_indexed_tlist_for_sortgroupref(Node *node,
/* Found a matching subplan output expression */
Var
*
newvar
;
newvar
=
makeVar
(
newvarno
,
tle
->
resno
,
exprType
((
Node
*
)
tle
->
expr
),
exprTypmod
((
Node
*
)
tle
->
expr
),
0
);
newvar
=
makeVarFromTargetEntry
(
newvarno
,
tle
);
newvar
->
varnoold
=
0
;
/* wasn't ever a plain Var */
newvar
->
varoattno
=
0
;
return
newvar
;
...
...
src/backend/optimizer/plan/subselect.c
View file @
2355b69b
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.16
3 2010/07/12 17:01:06 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.16
4 2010/08/27 20:30:08 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -737,11 +737,7 @@ generate_subquery_vars(PlannerInfo *root, List *tlist, Index varno)
if
(
tent
->
resjunk
)
continue
;
var
=
makeVar
(
varno
,
tent
->
resno
,
exprType
((
Node
*
)
tent
->
expr
),
exprTypmod
((
Node
*
)
tent
->
expr
),
0
);
var
=
makeVarFromTargetEntry
(
varno
,
tent
);
result
=
lappend
(
result
,
var
);
}
...
...
src/backend/optimizer/prep/prepjointree.c
View file @
2355b69b
...
...
@@ -16,7 +16,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.7
3 2010/07/06 19:18:56 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.7
4 2010/08/27 20:30:08 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -991,11 +991,7 @@ make_setop_translation_list(Query *query, Index newvarno,
if
(
tle
->
resjunk
)
continue
;
vars
=
lappend
(
vars
,
makeVar
(
newvarno
,
tle
->
resno
,
exprType
((
Node
*
)
tle
->
expr
),
exprTypmod
((
Node
*
)
tle
->
expr
),
0
));
vars
=
lappend
(
vars
,
makeVarFromTargetEntry
(
newvarno
,
tle
));
}
*
translated_vars
=
vars
;
...
...
src/backend/optimizer/util/plancat.c
View file @
2355b69b
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.16
3 2010/03/30 21:58:10 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.16
4 2010/08/27 20:30:08 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -727,11 +727,7 @@ build_physical_tlist(PlannerInfo *root, RelOptInfo *rel)
* A resjunk column of the subquery can be reflected as
* resjunk in the physical tlist; we need not punt.
*/
var
=
makeVar
(
varno
,
tle
->
resno
,
exprType
((
Node
*
)
tle
->
expr
),
exprTypmod
((
Node
*
)
tle
->
expr
),
0
);
var
=
makeVarFromTargetEntry
(
varno
,
tle
);
tlist
=
lappend
(
tlist
,
makeTargetEntry
((
Expr
*
)
var
,
...
...
src/backend/parser/analyze.c
View file @
2355b69b
...
...
@@ -17,7 +17,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.40
2 2010/02/26 02:00:49 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.40
3 2010/08/27 20:30:08 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -484,11 +484,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
expr
=
tle
->
expr
;
else
{
Var
*
var
=
makeVar
(
rtr
->
rtindex
,
tle
->
resno
,
exprType
((
Node
*
)
tle
->
expr
),
exprTypmod
((
Node
*
)
tle
->
expr
),
0
);
Var
*
var
=
makeVarFromTargetEntry
(
rtr
->
rtindex
,
tle
);
var
->
location
=
exprLocation
((
Node
*
)
tle
->
expr
);
expr
=
(
Expr
*
)
var
;
...
...
src/include/nodes/makefuncs.h
View file @
2355b69b
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/nodes/makefuncs.h,v 1.7
0 2010/01/02 16:58:04 momjian
Exp $
* $PostgreSQL: pgsql/src/include/nodes/makefuncs.h,v 1.7
1 2010/08/27 20:30:08 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -29,6 +29,9 @@ extern Var *makeVar(Index varno,
int32
vartypmod
,
Index
varlevelsup
);
extern
Var
*
makeVarFromTargetEntry
(
Index
varno
,
TargetEntry
*
tle
);
extern
TargetEntry
*
makeTargetEntry
(
Expr
*
expr
,
AttrNumber
resno
,
char
*
resname
,
...
...
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