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
3dd2eabc
Commit
3dd2eabc
authored
Jul 20, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup makeTargetEntry and remove internal.c.
parent
97ac8f7f
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
53 additions
and
125 deletions
+53
-125
src/backend/executor/execJunk.c
src/backend/executor/execJunk.c
+5
-7
src/backend/nodes/makefuncs.c
src/backend/nodes/makefuncs.c
+15
-1
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/plan/setrefs.c
+3
-3
src/backend/optimizer/prep/preptlist.c
src/backend/optimizer/prep/preptlist.c
+5
-7
src/backend/optimizer/util/internal.c
src/backend/optimizer/util/internal.c
+0
-60
src/backend/optimizer/util/tlist.c
src/backend/optimizer/util/tlist.c
+14
-28
src/backend/parser/analyze.c
src/backend/parser/analyze.c
+4
-6
src/backend/parser/parse_func.c
src/backend/parser/parse_func.c
+3
-7
src/backend/parser/parse_target.c
src/backend/parser/parse_target.c
+2
-4
src/include/optimizer/tlist.h
src/include/optimizer/tlist.h
+2
-2
No files found.
src/backend/executor/execJunk.c
View file @
3dd2eabc
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.1
1 1998/06/15 19:28:18
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.1
2 1998/07/20 19:53:44
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -20,7 +20,7 @@
#include "access/heapam.h"
#include "executor/executor.h"
#include "nodes/relation.h"
#include "optimizer/tlist.h"
/* for
MakeTLE
*/
#include "optimizer/tlist.h"
/* for
makeTargetEntry
*/
/*-------------------------------------------------------------------------
* XXX this stuff should be rewritten to take advantage
...
...
@@ -111,9 +111,7 @@ ExecInitJunkFilter(List *targetList)
/*
* create a new target list entry
*/
tle
=
makeNode
(
TargetEntry
);
tle
->
resdom
=
cleanResdom
;
tle
->
expr
=
expr
;
tle
=
makeTargetEntry
(
cleanResdom
,
expr
);
cleanTargetList
=
lappend
(
cleanTargetList
,
tle
);
}
}
...
...
@@ -134,7 +132,7 @@ ExecInitJunkFilter(List *targetList)
cleanResdom
=
(
Resdom
)
copyObject
((
Node
)
resdom
);
set_resno
(
cleanResdom
,
cleanResno
);
cleanResno
++
;
tle
=
(
List
)
MakeTLE
(
cleanResdom
,
(
Expr
)
expr
);
tle
=
(
List
)
makeTargetEntry
(
cleanResdom
,
(
Node
*
)
expr
);
set_fj_innerNode
(
cleanFjoin
,
tle
);
foreach
(
fjListP
,
lnext
(
fjList
))
...
...
@@ -150,7 +148,7 @@ ExecInitJunkFilter(List *targetList)
/*
* create a new target list entry
*/
tle
=
(
List
)
MakeTLE
(
cleanResdom
,
(
Expr
)
expr
);
tle
=
(
List
)
makeTargetEntry
(
cleanResdom
,
(
Node
*
)
expr
);
cleanFjList
=
lappend
(
cleanFjList
,
tle
);
}
lappend
(
cleanTargetList
,
cleanFjList
);
...
...
src/backend/nodes/makefuncs.c
View file @
3dd2eabc
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.1
0 1998/07/12 21:29:16
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.1
1 1998/07/20 19:53:45
momjian Exp $
*
* NOTES
* Creator functions in POSTGRES 4.2 are generated automatically. Most of
...
...
@@ -71,6 +71,20 @@ makeVar(Index varno,
return
var
;
}
/*
* makeTargetEntry -
* creates a TargetEntry node(contains a Resdom)
*/
TargetEntry
*
makeTargetEntry
(
Resdom
*
resdom
,
Node
*
expr
)
{
TargetEntry
*
rt
=
makeNode
(
TargetEntry
);
rt
->
resdom
=
resdom
;
rt
->
expr
=
expr
;
return
rt
;
}
/*
* makeResdom -
* creates a Resdom (Result Domain) node
...
...
src/backend/optimizer/plan/setrefs.c
View file @
3dd2eabc
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.2
3 1998/07/19 05:49:15
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.2
4 1998/07/20 19:53:46
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -132,7 +132,7 @@ set_join_tlist_references(Join *join)
outer_tlist
,
inner_tlist
);
temp
=
MakeTLE
(
xtl
->
resdom
,
(
Node
*
)
joinvar
);
temp
=
makeTargetEntry
(
xtl
->
resdom
,
(
Node
*
)
joinvar
);
new_join_targetlist
=
lappend
(
new_join_targetlist
,
temp
);
}
...
...
@@ -497,7 +497,7 @@ tlist_temp_references(Oid tempid,
else
oattno
=
0
;
temp
=
MakeTLE
(
xtl
->
resdom
,
temp
=
makeTargetEntry
(
xtl
->
resdom
,
(
Node
*
)
makeVar
(
tempid
,
xtl
->
resdom
->
resno
,
xtl
->
resdom
->
restype
,
...
...
src/backend/optimizer/prep/preptlist.c
View file @
3dd2eabc
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.1
3 1998/07/20 19:21:44
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.1
4 1998/07/20 19:53:47
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -114,9 +114,7 @@ preprocess_targetlist(List *tlist,
var
=
makeVar
(
result_relation
,
-
1
,
TIDOID
,
-
1
,
0
,
result_relation
,
-
1
);
ctid
=
makeNode
(
TargetEntry
);
ctid
->
resdom
=
resdom
;
ctid
->
expr
=
(
Node
*
)
var
;
ctid
=
makeTargetEntry
(
resdom
,
(
Node
*
)
var
);
t_list
=
lappend
(
t_list
,
ctid
);
}
...
...
@@ -233,7 +231,7 @@ replace_matching_resname(List *new_tlist, List *old_tlist)
newresno
=
(
Resdom
*
)
copyObject
((
Node
*
)
old_tle
->
resdom
);
newresno
->
resno
=
length
(
t_list
)
+
1
;
newresno
->
resjunk
=
1
;
new_tl
=
MakeTLE
(
newresno
,
old_tle
->
expr
);
new_tl
=
makeTargetEntry
(
newresno
,
old_tle
->
expr
);
t_list
=
lappend
(
t_list
,
new_tl
);
}
}
...
...
@@ -296,7 +294,7 @@ new_relation_targetlist(Oid relid, Index rt_index, NodeTag node_type)
false
,
/* not a set */
false
);
temp3
=
MakeTLE
(
makeResdom
(
attno
,
temp3
=
makeTargetEntry
(
makeResdom
(
attno
,
atttype
,
-
1
,
attname
,
...
...
@@ -317,7 +315,7 @@ new_relation_targetlist(Oid relid, Index rt_index, NodeTag node_type)
get_atttypmod
(
relid
,
attno
),
0
,
rt_index
,
attno
);
temp_list
=
MakeTLE
(
makeResdom
(
attno
,
temp_list
=
makeTargetEntry
(
makeResdom
(
attno
,
atttype
,
get_atttypmod
(
relid
,
attno
),
attname
,
...
...
src/backend/optimizer/util/internal.c
deleted
100644 → 0
View file @
97ac8f7f
/*-------------------------------------------------------------------------
*
* internal.c--
* Definitions required throughout the query optimizer.
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/internal.c,v 1.7 1998/02/26 04:33:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* ---------- SHARED MACROS
*
* Macros common to modules for creating, accessing, and modifying
* query tree and query plan components.
* Shared with the executor.
*
*/
#include <sys/types.h>
#include "postgres.h"
#include "optimizer/internal.h"
#include "nodes/relation.h"
#include "nodes/plannodes.h"
#include "nodes/primnodes.h"
#include "utils/palloc.h"
#ifdef NOT_USED
/*****************************************************************************
*
*****************************************************************************/
/* the following should probably be moved elsewhere -ay */
TargetEntry
*
MakeTLE
(
Resdom
*
resdom
,
Node
*
expr
)
{
TargetEntry
*
rt
=
makeNode
(
TargetEntry
);
rt
->
resdom
=
resdom
;
rt
->
expr
=
expr
;
return
rt
;
}
Var
*
get_expr
(
TargetEntry
*
tle
)
{
Assert
(
tle
!=
NULL
);
Assert
(
tle
->
expr
!=
NULL
);
return
((
Var
*
)
tle
->
expr
);
}
#endif
/* 0 */
src/backend/optimizer/util/tlist.c
View file @
3dd2eabc
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.1
4 1998/07/18 04:22:41
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.1
5 1998/07/20 19:53:48
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -133,19 +133,15 @@ add_tl_element(RelOptInfo *rel, Var *var)
TargetEntry
*
create_tl_element
(
Var
*
var
,
int
resdomno
)
{
TargetEntry
*
tlelement
=
makeNode
(
TargetEntry
);
tlelement
->
resdom
=
makeResdom
(
resdomno
,
var
->
vartype
,
var
->
vartypmod
,
NULL
,
(
Index
)
0
,
(
Oid
)
0
,
0
);
tlelement
->
expr
=
(
Node
*
)
var
;
return
(
tlelement
);
return
makeTargetEntry
(
makeResdom
(
resdomno
,
var
->
vartype
,
var
->
vartypmod
,
NULL
,
(
Index
)
0
,
(
Oid
)
0
,
0
),
(
Node
*
)
var
);
}
/*
...
...
@@ -351,7 +347,7 @@ copy_vars(List *target, List *source)
for
(
src
=
source
,
dest
=
target
;
src
!=
NIL
&&
dest
!=
NIL
;
src
=
lnext
(
src
),
dest
=
lnext
(
dest
))
{
TargetEntry
*
temp
=
MakeTLE
(((
TargetEntry
*
)
lfirst
(
dest
))
->
resdom
,
TargetEntry
*
temp
=
makeTargetEntry
(((
TargetEntry
*
)
lfirst
(
dest
))
->
resdom
,
(
Node
*
)
get_expr
(
lfirst
(
src
)));
result
=
lappend
(
result
,
temp
);
...
...
@@ -404,7 +400,7 @@ flatten_tlist(List *tlist)
(
Oid
)
0
,
0
);
last_resdomno
++
;
new_tlist
=
lappend
(
new_tlist
,
MakeTLE
(
r
,
(
Node
*
)
var
));
new_tlist
=
lappend
(
new_tlist
,
makeTargetEntry
(
r
,
(
Node
*
)
var
));
}
}
...
...
@@ -435,7 +431,7 @@ flatten_tlist_vars(List *full_tlist, List *flat_tlist)
result
=
lappend
(
result
,
MakeTLE
(
tle
->
resdom
,
makeTargetEntry
(
tle
->
resdom
,
flatten_tlistentry
((
Node
*
)
get_expr
(
tle
),
flat_tlist
)));
}
...
...
@@ -544,16 +540,6 @@ flatten_tlistentry(Node *tlistentry, List *flat_tlist)
}
TargetEntry
*
MakeTLE
(
Resdom
*
resdom
,
Node
*
expr
)
{
TargetEntry
*
rt
=
makeNode
(
TargetEntry
);
rt
->
resdom
=
resdom
;
rt
->
expr
=
expr
;
return
rt
;
}
Var
*
get_expr
(
TargetEntry
*
tle
)
{
...
...
@@ -597,7 +583,7 @@ AddGroupAttrToTlist(List *tlist, List *grpCl)
(
Oid
)
0
,
0
);
last_resdomno
++
;
tlist
=
lappend
(
tlist
,
MakeTLE
(
r
,
(
Node
*
)
var
));
tlist
=
lappend
(
tlist
,
makeTargetEntry
(
r
,
(
Node
*
)
var
));
}
}
}
...
...
src/backend/parser/analyze.c
View file @
3dd2eabc
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.7
7 1998/07/19 05:49:17
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.7
8 1998/07/20 19:53:49
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -312,14 +312,12 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
* preptlist.c), but may break RULEs in some way. It seems
* better to create proper target list here...
*/
te
=
makeNode
(
TargetEntry
);
te
->
resdom
=
makeResdom
(
defval
[
ndef
].
adnum
,
te
=
makeTargetEntry
(
makeResdom
(
defval
[
ndef
].
adnum
,
att
[
defval
[
ndef
].
adnum
-
1
]
->
atttypid
,
att
[
defval
[
ndef
].
adnum
-
1
]
->
atttypmod
,
pstrdup
(
nameout
(
&
(
att
[
defval
[
ndef
].
adnum
-
1
]
->
attname
))),
0
,
0
,
0
);
te
->
fjoin
=
NULL
;
te
->
expr
=
(
Node
*
)
stringToNode
(
defval
[
ndef
].
adbin
);
0
,
0
,
0
),
(
Node
*
)
stringToNode
(
defval
[
ndef
].
adbin
);
qry
->
targetList
=
lappend
(
qry
->
targetList
,
te
);
}
}
...
...
src/backend/parser/parse_func.c
View file @
3dd2eabc
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.2
2 1998/07/20 11:17:1
1 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.2
3 1998/07/20 19:53:5
1 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1240,9 +1240,7 @@ setup_tlist(char *attname, Oid relid)
0
);
varnode
=
makeVar
(
-
1
,
attno
,
typeid
,
type_mod
,
0
,
-
1
,
attno
);
tle
=
makeNode
(
TargetEntry
);
tle
->
resdom
=
resnode
;
tle
->
expr
=
(
Node
*
)
varnode
;
tle
=
makeTargetEntry
(
resnode
,
(
Node
*
)
varnode
);
return
(
lcons
(
tle
,
NIL
));
}
...
...
@@ -1266,9 +1264,7 @@ setup_base_tlist(Oid typeid)
(
Oid
)
0
,
0
);
varnode
=
makeVar
(
-
1
,
1
,
typeid
,
-
1
,
0
,
-
1
,
1
);
tle
=
makeNode
(
TargetEntry
);
tle
->
resdom
=
resnode
;
tle
->
expr
=
(
Node
*
)
varnode
;
tle
=
makeTargetEntry
(
resnode
,
(
Node
*
)
varnode
);
return
(
lcons
(
tle
,
NIL
));
}
...
...
src/backend/parser/parse_target.c
View file @
3dd2eabc
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.1
8 1998/07/12 21:29:20
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.1
9 1998/07/20 19:53:52
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -692,7 +692,6 @@ printf("MakeTargetlistExpr: attrtypmod is %d\n", (int4) attrtypmod);
attrtypmod
=
type_mod
;
}
tent
=
makeNode
(
TargetEntry
);
resnode
=
makeResdom
((
AttrNumber
)
resdomno
,
(
Oid
)
attrtype
,
attrtypmod
,
...
...
@@ -701,8 +700,7 @@ printf("MakeTargetlistExpr: attrtypmod is %d\n", (int4) attrtypmod);
(
Oid
)
0
,
0
);
tent
->
resdom
=
resnode
;
tent
->
expr
=
expr
;
tent
=
makeTargetEntry
(
resnode
,
expr
);
return
tent
;
}
/* MakeTargetlistExpr() */
...
...
src/include/optimizer/tlist.h
View file @
3dd2eabc
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: tlist.h,v 1.
9 1998/07/18 04:22:52
momjian Exp $
* $Id: tlist.h,v 1.
10 1998/07/20 19:53:53
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -26,7 +26,7 @@ extern List *get_actual_tlist(List *tlist);
extern
Resdom
*
tlist_member
(
Var
*
var
,
List
*
tlist
);
extern
Resdom
*
tlist_resdom
(
List
*
tlist
,
Resdom
*
resnode
);
extern
TargetEntry
*
MakeTLE
(
Resdom
*
resdom
,
Node
*
expr
);
extern
TargetEntry
*
makeTargetEntry
(
Resdom
*
resdom
,
Node
*
expr
);
extern
Var
*
get_expr
(
TargetEntry
*
tle
);
extern
TargetEntry
*
match_varid
(
Var
*
test_var
,
List
*
tlist
);
...
...
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