Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
ee88006c
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ee88006c
编写于
9月 25, 1998
作者:
T
Thomas G. Lockhart
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up code in analyze.c for SERIAL data type.
Remove _all_ PARSEDEBUG print statements.
上级
2df14657
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
18 addition
and
236 deletion
+18
-236
src/backend/parser/analyze.c
src/backend/parser/analyze.c
+7
-11
src/backend/parser/gram.y
src/backend/parser/gram.y
+1
-14
src/backend/parser/parse_clause.c
src/backend/parser/parse_clause.c
+1
-24
src/backend/parser/parse_func.c
src/backend/parser/parse_func.c
+1
-36
src/backend/parser/parse_node.c
src/backend/parser/parse_node.c
+1
-15
src/backend/parser/parse_oper.c
src/backend/parser/parse_oper.c
+1
-83
src/backend/parser/parse_target.c
src/backend/parser/parse_target.c
+6
-53
未找到文件。
src/backend/parser/analyze.c
浏览文件 @
ee88006c
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.8
7 1998/09/16 14:25:37
thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.8
8 1998/09/25 13:36:00
thomas Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -30,9 +30,6 @@
#include "parser/parse_target.h"
#include "utils/builtins.h"
#include "utils/mcxt.h"
#ifdef PARSEDEBUG
#include "nodes/print.h"
#endif
static
Query
*
transformStmt
(
ParseState
*
pstate
,
Node
*
stmt
);
static
Query
*
transformDeleteStmt
(
ParseState
*
pstate
,
DeleteStmt
*
stmt
);
...
...
@@ -68,10 +65,6 @@ parse_analyze(List *pl, ParseState *parentParseState)
while
(
pl
!=
NIL
)
{
#ifdef PARSEDEBUG
elog
(
DEBUG
,
"parse tree from yacc:
\n
---
\n
%s
\n
---
\n
"
,
nodeToString
(
lfirst
(
pl
)));
#endif
pstate
=
make_parsestate
(
parentParseState
);
result
->
qtrees
[
i
++
]
=
transformStmt
(
pstate
,
lfirst
(
pl
));
if
(
pstate
->
p_target_relation
!=
NULL
)
...
...
@@ -517,12 +510,15 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
if
(
column
->
is_sequence
)
{
char
*
cstring
;
char
*
sname
;
char
*
cstring
;
CreateSeqStmt
*
sequence
;
sname
=
makeTableName
(
stmt
->
relname
,
column
->
colname
,
"seq"
,
NULL
);
constraint
=
makeNode
(
Constraint
);
constraint
->
contype
=
CONSTR_DEFAULT
;
constraint
->
name
=
makeTableName
(
stmt
->
relname
,
column
->
colname
,
"seq"
,
NULL
)
;
constraint
->
name
=
sname
;
cstring
=
palloc
(
9
+
strlen
(
constraint
->
name
)
+
2
+
1
);
strcpy
(
cstring
,
"nextval('"
);
strcat
(
cstring
,
constraint
->
name
);
...
...
@@ -551,7 +547,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
}
sequence
=
makeNode
(
CreateSeqStmt
);
sequence
->
seqname
=
pstrdup
(
constraint
->
name
);
sequence
->
seqname
=
pstrdup
(
s
name
);
sequence
->
options
=
NIL
;
elog
(
NOTICE
,
"CREATE TABLE will create implicit sequence %s for SERIAL column %s.%s"
,
...
...
src/backend/parser/gram.y
浏览文件 @
ee88006c
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.3
1 1998/09/16 14:29:35
thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.3
2 1998/09/25 13:36:01
thomas Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -5024,10 +5024,6 @@ FlattenStringList(List *list)
};
*(s+len) = '\0';
#ifdef PARSEDEBUG
elog(DEBUG, "flattened string is \"%s\"\n", s);
#endif
return s;
} /* FlattenStringList() */
...
...
@@ -5075,10 +5071,6 @@ makeConstantList( A_Const *n)
elog(ERROR,"Internal error in makeConstantList(): cannot encode node");
};
#ifdef PARSEDEBUG
elog(DEBUG, "AexprConst argument is \"%s\"\n", defval);
#endif
return result;
} /* makeConstantList() */
...
...
@@ -5104,11 +5096,6 @@ fmtId(char *rawid)
cp = rawid;
};
#ifdef PARSEDEBUG
elog(DEBUG, "fmtId- %sconvert %s to %s\n",
((cp == rawid)? "do not ": ""), rawid, cp);
#endif
return cp;
}
...
...
src/backend/parser/parse_clause.c
浏览文件 @
ee88006c
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.2
5 1998/09/01 04:30:27 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.2
6 1998/09/25 13:36:03 thomas
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -389,10 +389,6 @@ transformSortClause(ParseState *pstate,
{
List
*
s
=
NIL
;
#ifdef PARSEDEBUG
printf
(
"transformSortClause: entering
\n
"
);
#endif
while
(
orderlist
!=
NIL
)
{
SortGroupBy
*
sortby
=
lfirst
(
orderlist
);
...
...
@@ -402,11 +398,6 @@ transformSortClause(ParseState *pstate,
restarget
=
findTargetlistEntry
(
pstate
,
sortby
->
node
,
targetlist
,
ORDER_CLAUSE
);
#ifdef PARSEDEBUG
printf
(
"transformSortClause: find sorting operator for type %d
\n
"
,
restarget
->
resdom
->
restype
);
#endif
sortcl
->
resdom
=
resdom
=
restarget
->
resdom
;
/*
...
...
@@ -478,11 +469,6 @@ transformSortClause(ParseState *pstate,
/* not a member of the sortclauses yet */
SortClause
*
sortcl
=
makeNode
(
SortClause
);
#ifdef PARSEDEBUG
printf
(
"transformSortClause: (2) find sorting operator for type %d
\n
"
,
tlelt
->
resdom
->
restype
);
#endif
if
(
tlelt
->
resdom
->
restype
==
InvalidOid
)
tlelt
->
resdom
->
restype
=
INT4OID
;
...
...
@@ -520,11 +506,6 @@ transformSortClause(ParseState *pstate,
/* not a member of the sortclauses yet */
SortClause
*
sortcl
=
makeNode
(
SortClause
);
#ifdef PARSEDEBUG
printf
(
"transformSortClause: try sorting type %d
\n
"
,
tlelt
->
resdom
->
restype
);
#endif
sortcl
->
resdom
=
tlelt
->
resdom
;
sortcl
->
opoid
=
any_ordering_op
(
tlelt
->
resdom
->
restype
);
...
...
@@ -576,10 +557,6 @@ transformUnionClause(List *unionClause, List *targetlist)
otype
=
((
TargetEntry
*
)
lfirst
(
prev_target
))
->
resdom
->
restype
;
itype
=
((
TargetEntry
*
)
lfirst
(
next_target
))
->
resdom
->
restype
;
#ifdef PARSEDEBUG
printf
(
"transformUnionClause: types are %d -> %d
\n
"
,
itype
,
otype
);
#endif
/* one or both is a NULL column? then don't convert... */
if
(
otype
==
InvalidOid
)
{
...
...
src/backend/parser/parse_func.c
浏览文件 @
ee88006c
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.2
8 1998/09/01 04:30:31 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.2
9 1998/09/25 13:36:04 thomas
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -672,34 +672,22 @@ func_select_candidate(int nargs,
if
((
nmatch
+
nident
)
==
nargs
)
return
current_candidate
->
args
;
#ifdef PARSEDEBUG
printf
(
"func_select_candidate- candidate has %d matches
\n
"
,
nmatch
);
#endif
if
((
nmatch
>
nbestMatch
)
||
(
last_candidate
==
NULL
))
{
nbestMatch
=
nmatch
;
candidates
=
current_candidate
;
last_candidate
=
current_candidate
;
ncandidates
=
1
;
#ifdef PARSEDEBUG
printf
(
"func_select_candidate- choose candidate as best match
\n
"
);
#endif
}
else
if
(
nmatch
==
nbestMatch
)
{
last_candidate
->
next
=
current_candidate
;
last_candidate
=
current_candidate
;
ncandidates
++
;
#ifdef PARSEDEBUG
printf
(
"func_select_candidate- choose candidate as possible match
\n
"
);
#endif
}
else
{
last_candidate
->
next
=
NULL
;
#ifdef PARSEDEBUG
printf
(
"func_select_candidate- reject candidate as possible match
\n
"
);
#endif
}
}
...
...
@@ -727,17 +715,10 @@ func_select_candidate(int nargs,
{
slot_category
=
current_category
;
slot_type
=
current_type
;
#ifdef PARSEDEBUG
printf
(
"func_select_candidate- assign column #%d first candidate slot type %s
\n
"
,
i
,
typeidTypeName
(
current_type
));
#endif
}
else
if
((
current_category
!=
slot_category
)
&&
IS_BUILTIN_TYPE
(
current_type
))
{
#ifdef PARSEDEBUG
printf
(
"func_select_candidate- multiple possible types for column #%d; unable to choose candidate
\n
"
,
i
);
#endif
return
NULL
;
}
else
if
(
current_type
!=
slot_type
)
...
...
@@ -746,17 +727,9 @@ func_select_candidate(int nargs,
{
slot_type
=
current_type
;
candidates
=
current_candidate
;
#ifdef PARSEDEBUG
printf
(
"func_select_candidate- column #%d found preferred candidate type %s
\n
"
,
i
,
typeidTypeName
(
slot_type
));
#endif
}
else
{
#ifdef PARSEDEBUG
printf
(
"func_select_candidate- column #%d found possible candidate type %s
\n
"
,
i
,
typeidTypeName
(
current_type
));
#endif
}
}
}
...
...
@@ -764,18 +737,10 @@ func_select_candidate(int nargs,
if
(
slot_type
!=
InvalidOid
)
{
input_typeids
[
i
]
=
slot_type
;
#ifdef PARSEDEBUG
printf
(
"func_select_candidate- assign column #%d slot type %s
\n
"
,
i
,
typeidTypeName
(
input_typeids
[
i
]));
#endif
}
}
else
{
#ifdef PARSEDEBUG
printf
(
"func_select_candidate- column #%d input type is %s
\n
"
,
i
,
typeidTypeName
(
input_typeids
[
i
]));
#endif
}
}
...
...
src/backend/parser/parse_node.c
浏览文件 @
ee88006c
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.2
1 1998/09/01 04:30:33 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.2
2 1998/09/25 13:36:05 thomas
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -67,10 +67,6 @@ make_operand(char *opname,
Node
*
result
;
Type
true_type
;
#ifdef PARSEDEBUG
printf
(
"make_operand: constructing operand for '%s' %s->%s
\n
"
,
opname
,
typeidTypeName
(
orig_typeId
),
typeidTypeName
(
true_typeId
));
#endif
if
(
tree
!=
NULL
)
{
result
=
tree
;
...
...
@@ -80,10 +76,6 @@ make_operand(char *opname,
/* must coerce? */
if
(
true_typeId
!=
orig_typeId
)
{
#ifdef PARSEDEBUG
printf
(
"make_operand: try to convert node from %s to %s
\n
"
,
typeidTypeName
(
orig_typeId
),
typeidTypeName
(
true_typeId
));
#endif
result
=
coerce_type
(
NULL
,
tree
,
orig_typeId
,
true_typeId
);
}
}
...
...
@@ -155,13 +147,7 @@ make_op(char *opname, Node *ltree, Node *rtree)
{
rtypeId
=
(
rtree
==
NULL
)
?
UNKNOWNOID
:
exprType
(
rtree
);
tup
=
left_oper
(
opname
,
rtypeId
);
#ifdef PARSEDEBUG
printf
(
"make_op: returned from left_oper() with structure at %p
\n
"
,
(
void
*
)
tup
);
#endif
opform
=
(
Form_pg_operator
)
GETSTRUCT
(
tup
);
#ifdef PARSEDEBUG
printf
(
"make_op: calling make_operand()
\n
"
);
#endif
right
=
make_operand
(
opname
,
rtree
,
rtypeId
,
opform
->
oprright
);
left
=
NULL
;
...
...
src/backend/parser/parse_oper.c
浏览文件 @
ee88006c
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.1
8 1998/09/16 14:22:22
thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.1
9 1998/09/25 13:36:07
thomas Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -209,34 +209,22 @@ oper_select_candidate(int nargs,
nmatch
++
;
}
#ifdef PARSEDEBUG
printf
(
"oper_select_candidate- candidate has %d matches
\n
"
,
nmatch
);
#endif
if
((
nmatch
>
nbestMatch
)
||
(
last_candidate
==
NULL
))
{
nbestMatch
=
nmatch
;
candidates
=
current_candidate
;
last_candidate
=
current_candidate
;
ncandidates
=
1
;
#ifdef PARSEDEBUG
printf
(
"oper_select_candidate- choose candidate as best match
\n
"
);
#endif
}
else
if
(
nmatch
==
nbestMatch
)
{
last_candidate
->
next
=
current_candidate
;
last_candidate
=
current_candidate
;
ncandidates
++
;
#ifdef PARSEDEBUG
printf
(
"oper_select_candidate- choose candidate as possible match
\n
"
);
#endif
}
else
{
last_candidate
->
next
=
NULL
;
#ifdef PARSEDEBUG
printf
(
"oper_select_candidate- reject candidate as possible match
\n
"
);
#endif
}
}
...
...
@@ -275,34 +263,22 @@ oper_select_candidate(int nargs,
}
}
#ifdef PARSEDEBUG
printf
(
"oper_select_candidate- candidate has %d matches
\n
"
,
nmatch
);
#endif
if
((
nmatch
>
nbestMatch
)
||
(
last_candidate
==
NULL
))
{
nbestMatch
=
nmatch
;
candidates
=
current_candidate
;
last_candidate
=
current_candidate
;
ncandidates
=
1
;
#ifdef PARSEDEBUG
printf
(
"oper_select_candidate- choose candidate as best match
\n
"
);
#endif
}
else
if
(
nmatch
==
nbestMatch
)
{
last_candidate
->
next
=
current_candidate
;
last_candidate
=
current_candidate
;
ncandidates
++
;
#ifdef PARSEDEBUG
printf
(
"oper_select_candidate- choose candidate as possible match
\n
"
);
#endif
}
else
{
last_candidate
->
next
=
NULL
;
#ifdef PARSEDEBUG
printf
(
"oper_select_candidate- reject candidate as possible match
\n
"
);
#endif
}
}
...
...
@@ -312,9 +288,6 @@ oper_select_candidate(int nargs,
||
((
nargs
>
1
)
&&
!
can_coerce_type
(
1
,
&
input_typeids
[
1
],
&
candidates
->
args
[
1
])))
{
ncandidates
=
0
;
#ifdef PARSEDEBUG
printf
(
"oper_select_candidate- unable to coerce preferred candidate
\n
"
);
#endif
}
return
(
ncandidates
==
1
)
?
candidates
->
args
:
NULL
;
}
...
...
@@ -370,16 +343,9 @@ oper_select_candidate(int nargs,
{
slot_category
=
current_category
;
slot_type
=
current_type
;
#ifdef PARSEDEBUG
printf
(
"oper_select_candidate- assign column #%d first candidate slot type %s
\n
"
,
i
,
typeidTypeName
(
current_type
));
#endif
}
else
if
(
current_category
!=
slot_category
)
{
#ifdef PARSEDEBUG
printf
(
"oper_select_candidate- multiple possible types for column #%d; unable to choose candidate
\n
"
,
i
);
#endif
return
NULL
;
}
else
if
(
current_type
!=
slot_type
)
...
...
@@ -388,17 +354,9 @@ oper_select_candidate(int nargs,
{
slot_type
=
current_type
;
candidates
=
current_candidate
;
#ifdef PARSEDEBUG
printf
(
"oper_select_candidate- column #%d found preferred candidate type %s
\n
"
,
i
,
typeidTypeName
(
slot_type
));
#endif
}
else
{
#ifdef PARSEDEBUG
printf
(
"oper_select_candidate- column #%d found possible candidate type %s
\n
"
,
i
,
typeidTypeName
(
current_type
));
#endif
}
}
}
...
...
@@ -406,18 +364,10 @@ oper_select_candidate(int nargs,
if
(
slot_type
!=
InvalidOid
)
{
input_typeids
[
i
]
=
slot_type
;
#ifdef PARSEDEBUG
printf
(
"oper_select_candidate- assign column #%d slot type %s
\n
"
,
i
,
typeidTypeName
(
input_typeids
[
i
]));
#endif
}
}
else
{
#ifdef PARSEDEBUG
printf
(
"oper_select_candidate- column #%d input type is %s
\n
"
,
i
,
typeidTypeName
(
input_typeids
[
i
]));
#endif
}
}
...
...
@@ -474,15 +424,9 @@ oper_exact(char *op, Oid arg1, Oid arg2, Node **ltree, Node **rtree, bool noWarn
{
Form_pg_operator
opform
;
#if PARSEDEBUG
printf
(
"oper_exact: found possible commutative operator candidate
\n
"
);
#endif
opform
=
(
Form_pg_operator
)
GETSTRUCT
(
tup
);
if
(
opform
->
oprcom
==
tup
->
t_oid
)
{
#if PARSEDEBUG
printf
(
"oper_exact: commutative operator found
\n
"
);
#endif
if
((
ltree
!=
NULL
)
&&
(
rtree
!=
NULL
))
{
tree
=
*
ltree
;
...
...
@@ -541,11 +485,6 @@ oper_inexact(char *op, Oid arg1, Oid arg2, Node **ltree, Node **rtree, bool noWa
ObjectIdGetDatum
(
candidates
->
args
[
1
]),
CharGetDatum
(
'b'
));
Assert
(
HeapTupleIsValid
(
tup
));
#if PARSEDEBUG
printf
(
"oper_inexact: found single candidate
\n
"
);
#endif
}
/* Otherwise, multiple operators of the desired types found... */
...
...
@@ -556,9 +495,6 @@ oper_inexact(char *op, Oid arg1, Oid arg2, Node **ltree, Node **rtree, bool noWa
targetOids
=
oper_select_candidate
(
2
,
inputOids
,
candidates
);
if
(
targetOids
!=
NULL
)
{
#if PARSEDEBUG
printf
(
"oper_inexact: found candidate
\n
"
);
#endif
tup
=
SearchSysCacheTuple
(
OPRNAME
,
PointerGetDatum
(
op
),
ObjectIdGetDatum
(
targetOids
[
0
]),
...
...
@@ -641,9 +577,6 @@ unary_oper_get_candidates(char *op,
fmgr_info
(
F_CHAREQ
,
(
FmgrInfo
*
)
&
opKey
[
1
].
sk_func
);
opKey
[
1
].
sk_argument
=
CharGetDatum
(
rightleft
);
#ifdef PARSEDEBUG
printf
(
"unary_oper_get_candidates: start scan for '%s'
\n
"
,
op
);
#endif
pg_operator_desc
=
heap_openr
(
OperatorRelationName
);
pg_operator_scan
=
heap_beginscan
(
pg_operator_desc
,
0
,
...
...
@@ -663,19 +596,12 @@ unary_oper_get_candidates(char *op,
current_candidate
->
args
[
0
]
=
oper
->
oprright
;
current_candidate
->
next
=
*
candidates
;
*
candidates
=
current_candidate
;
#ifdef PARSEDEBUG
printf
(
"unary_oper_get_candidates: found candidate '%s' for type %s
\n
"
,
op
,
typeidTypeName
(
current_candidate
->
args
[
0
]));
#endif
ncandidates
++
;
}
heap_endscan
(
pg_operator_scan
);
heap_close
(
pg_operator_desc
);
#ifdef PARSEDEBUG
printf
(
"unary_oper_get_candidates: found %d candidates
\n
"
,
ncandidates
);
#endif
return
ncandidates
;
}
/* unary_oper_get_candidates() */
...
...
@@ -774,10 +700,6 @@ left_oper(char *op, Oid arg)
ObjectIdGetDatum
(
candidates
->
args
[
0
]),
CharGetDatum
(
'l'
));
Assert
(
HeapTupleIsValid
(
tup
));
#ifdef PARSEDEBUG
printf
(
"left_oper: searched cache for single left oper candidate '%s %s'
\n
"
,
op
,
typeidTypeName
((
Oid
)
candidates
->
args
[
0
]));
#endif
}
else
{
...
...
@@ -801,10 +723,6 @@ left_oper(char *op, Oid arg)
op
,
typeidTypeName
(
arg
));
return
NULL
;
}
#ifdef PARSEDEBUG
printf
(
"left_oper: searched cache for best left oper candidate '%s %s'
\n
"
,
op
,
typeidTypeName
(
*
targetOid
));
#endif
}
}
return
(
Operator
)
tup
;
...
...
src/backend/parser/parse_target.c
浏览文件 @
ee88006c
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.2
8 1998/09/02 23:05:27 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.2
9 1998/09/25 13:36:08 thomas
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -19,6 +19,7 @@
#include "catalog/pg_type.h"
#include "nodes/makefuncs.h"
#include "nodes/primnodes.h"
#include "nodes/print.h"
#include "parser/parse_expr.h"
#include "parser/parse_func.h"
#include "parser/parse_node.h"
...
...
@@ -116,10 +117,6 @@ MakeTargetEntryIdent(ParseState *pstate,
attrtype_target
=
attnumTypeId
(
pstate
->
p_target_relation
,
resdomno_target
);
attrtypmod_target
=
get_atttypmod
(
pstate
->
p_target_relation
->
rd_id
,
resdomno_target
);
#ifdef PARSEDEBUG
printf
(
"MakeTargetEntryIdent- transform type %d to %d
\n
"
,
attrtype_id
,
attrtype_target
);
#endif
if
((
attrtype_id
!=
attrtype_target
)
||
((
attrtypmod_target
>=
0
)
&&
(
attrtypmod_target
!=
attrtypmod
)))
{
...
...
@@ -155,9 +152,6 @@ MakeTargetEntryIdent(ParseState *pstate,
name
=
((
*
resname
!=
NULL
)
?
*
resname
:
colname
);
#ifdef PARSEDEBUG
printf
(
"MakeTargetEntryIdent- call transformIdent()
\n
"
);
#endif
#if FALSE
expr
=
transformIdent
(
pstate
,
(
Node
*
)
ident
,
EXPR_COLUMN_FIRST
);
#else
...
...
@@ -170,10 +164,6 @@ MakeTargetEntryIdent(ParseState *pstate,
else
type_mod
=
-
1
;
#ifdef PARSEDEBUG
printf
(
"MakeTargetEntryIdent- attrtype_target = %d; type_mod = %d
\n
"
,
attrtype_target
,
type_mod
);
#endif
tent
->
resdom
=
makeResdom
((
AttrNumber
)
pstate
->
p_last_resno
++
,
(
Oid
)
attrtype_target
,
type_mod
,
...
...
@@ -269,10 +259,6 @@ MakeTargetEntryExpr(ParseState *pstate,
typeidTypeName
(
type_id
));
}
#ifdef PARSEDEBUG
printf
(
"MakeTargetEntryExpr: attrtypmod is %d
\n
"
,
(
int4
)
attrtypmod
);
#endif
/*
* Apparently going to a fixed-length string? Then explicitly
* size for storage...
...
...
@@ -338,8 +324,8 @@ MakeTargetEntryExpr(ParseState *pstate,
}
/* MakeTargetEntryExpr() */
/*
* MakeTarget
list
Complex()
*
pMake a TargetEntry from an
complex node.
* MakeTarget
Entry
Complex()
*
Make a TargetEntry from a
complex node.
*/
static
TargetEntry
*
MakeTargetEntryComplex
(
ParseState
*
pstate
,
...
...
@@ -347,10 +333,6 @@ MakeTargetEntryComplex(ParseState *pstate,
{
Node
*
expr
=
transformExpr
(
pstate
,
(
Node
*
)
res
->
val
,
EXPR_COLUMN_FIRST
);
#ifdef PARSEDEBUG
printf
(
"transformTargetList: decode T_Expr
\n
"
);
#endif
handleTargetColname
(
pstate
,
&
res
->
name
,
NULL
,
NULL
);
/* note indirection has not been transformed */
if
(
pstate
->
p_is_insert
&&
res
->
indirection
!=
NIL
)
...
...
@@ -450,8 +432,8 @@ MakeTargetEntryComplex(ParseState *pstate,
}
/*
* MakeTarget
listComplex
()
*
pMake a TargetEntry from an
complex node.
* MakeTarget
EntryAttr
()
*
Make a TargetEntry from a
complex node.
*/
static
TargetEntry
*
MakeTargetEntryAttr
(
ParseState
*
pstate
,
...
...
@@ -473,9 +455,6 @@ MakeTargetEntryAttr(ParseState *pstate,
/*
* Target item is fully specified: ie. relation.attribute
*/
#ifdef PARSEDEBUG
printf
(
"transformTargetList: decode T_Attr
\n
"
);
#endif
result
=
ParseNestedFuncOrColumn
(
pstate
,
att
,
&
pstate
->
p_last_resno
,
EXPR_COLUMN_FIRST
);
handleTargetColname
(
pstate
,
&
res
->
name
,
att
->
relname
,
attrname
);
if
(
att
->
indirection
!=
NIL
)
...
...
@@ -549,9 +528,6 @@ transformTargetList(ParseState *pstate, List *targetlist)
{
char
*
identname
;
#ifdef PARSEDEBUG
printf
(
"transformTargetList: decode T_Ident
\n
"
);
#endif
identname
=
((
Ident
*
)
res
->
val
)
->
name
;
tent
=
MakeTargetEntryIdent
(
pstate
,
(
Node
*
)
res
->
val
,
&
res
->
name
,
NULL
,
identname
,
FALSE
);
break
;
...
...
@@ -654,10 +630,6 @@ CoerceTargetExpr(ParseState *pstate,
{
if
(
can_coerce_type
(
1
,
&
type_id
,
&
attrtype
))
{
#ifdef PARSEDEBUG
printf
(
"CoerceTargetExpr: coerce type from %s to %s
\n
"
,
typeidTypeName
(
type_id
),
typeidTypeName
(
attrtype
));
#endif
expr
=
coerce_type
(
pstate
,
expr
,
type_id
,
attrtype
);
}
...
...
@@ -671,10 +643,6 @@ CoerceTargetExpr(ParseState *pstate,
{
Oid
text_id
=
TEXTOID
;
#ifdef PARSEDEBUG
printf
(
"CoerceTargetExpr: try coercing from %s to %s via text
\n
"
,
typeidTypeName
(
type_id
),
typeidTypeName
(
attrtype
));
#endif
if
(
type_id
==
TEXTOID
)
{
}
...
...
@@ -710,20 +678,12 @@ SizeTargetExpr(ParseState *pstate,
FuncCall
*
func
;
A_Const
*
cons
;
#ifdef PARSEDEBUG
printf
(
"SizeTargetExpr: ensure target fits storage
\n
"
);
#endif
funcname
=
typeidTypeName
(
attrtype
);
oid_array
[
0
]
=
attrtype
;
oid_array
[
1
]
=
INT4OID
;
for
(
i
=
2
;
i
<
8
;
i
++
)
oid_array
[
i
]
=
InvalidOid
;
#ifdef PARSEDEBUG
printf
(
"SizeTargetExpr: look for conversion function %s(%s,%s)
\n
"
,
funcname
,
typeidTypeName
(
attrtype
),
typeidTypeName
(
INT4OID
));
#endif
/* attempt to find with arguments exactly as specified... */
ftup
=
SearchSysCacheTuple
(
PRONAME
,
PointerGetDatum
(
funcname
),
...
...
@@ -733,9 +693,6 @@ SizeTargetExpr(ParseState *pstate,
if
(
HeapTupleIsValid
(
ftup
))
{
#ifdef PARSEDEBUG
printf
(
"SizeTargetExpr: found conversion function for sizing
\n
"
);
#endif
func
=
makeNode
(
FuncCall
);
func
->
funcname
=
funcname
;
...
...
@@ -746,10 +703,6 @@ SizeTargetExpr(ParseState *pstate,
expr
=
transformExpr
(
pstate
,
(
Node
*
)
func
,
EXPR_COLUMN_FIRST
);
}
#ifdef PARSEDEBUG
else
printf
(
"SizeTargetExpr: no conversion function for sizing
\n
"
);
#endif
return
expr
;
}
/* SizeTargetExpr() */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录