Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
9453514b
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,发现更多精彩内容 >>
提交
9453514b
编写于
8月 20, 2016
作者:
H
Heikki Linnakangas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Misc whitespace, formatting and comment changes, to reduce diff vs. upstream.
上级
81eb7d02
变更
18
显示空白变更内容
内联
并排
Showing
18 changed file
with
170 addition
and
176 deletion
+170
-176
src/backend/executor/execQual.c
src/backend/executor/execQual.c
+9
-10
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/allpaths.c
+2
-1
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/createplan.c
+3
-4
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/planner.c
+5
-3
src/backend/optimizer/prep/prepjointree.c
src/backend/optimizer/prep/prepjointree.c
+2
-2
src/backend/optimizer/util/clauses.c
src/backend/optimizer/util/clauses.c
+12
-13
src/backend/parser/analyze.c
src/backend/parser/analyze.c
+6
-2
src/backend/parser/parse_clause.c
src/backend/parser/parse_clause.c
+0
-7
src/backend/parser/parse_coerce.c
src/backend/parser/parse_coerce.c
+1
-0
src/backend/parser/parse_cte.c
src/backend/parser/parse_cte.c
+31
-29
src/backend/parser/parse_expr.c
src/backend/parser/parse_expr.c
+37
-34
src/backend/parser/parse_relation.c
src/backend/parser/parse_relation.c
+33
-44
src/backend/parser/parse_target.c
src/backend/parser/parse_target.c
+1
-1
src/backend/parser/parse_utilcmd.c
src/backend/parser/parse_utilcmd.c
+4
-1
src/backend/storage/buffer/bufmgr.c
src/backend/storage/buffer/bufmgr.c
+4
-7
src/backend/utils/error/elog.c
src/backend/utils/error/elog.c
+7
-5
src/backend/utils/misc/guc.c
src/backend/utils/misc/guc.c
+12
-12
src/include/parser/parse_type.h
src/include/parser/parse_type.h
+1
-1
未找到文件。
src/backend/executor/execQual.c
浏览文件 @
9453514b
...
@@ -89,10 +89,10 @@ static Datum ExecEvalScalarVarFast(ExprState *exprstate, ExprContext *econtext,
...
@@ -89,10 +89,10 @@ static Datum ExecEvalScalarVarFast(ExprState *exprstate, ExprContext *econtext,
static
Datum
ExecEvalWholeRowVar
(
WholeRowVarExprState
*
wrvstate
,
static
Datum
ExecEvalWholeRowVar
(
WholeRowVarExprState
*
wrvstate
,
ExprContext
*
econtext
,
ExprContext
*
econtext
,
bool
*
isNull
,
ExprDoneCond
*
isDone
);
bool
*
isNull
,
ExprDoneCond
*
isDone
);
static
Datum
ExecEvalWholeRow
Slow
(
WholeRowVarExprState
*
wrvstate
,
static
Datum
ExecEvalWholeRow
Fast
(
WholeRowVarExprState
*
wrvstate
,
ExprContext
*
econtext
,
ExprContext
*
econtext
,
bool
*
isNull
,
ExprDoneCond
*
isDone
);
bool
*
isNull
,
ExprDoneCond
*
isDone
);
static
Datum
ExecEvalWholeRow
Fast
(
WholeRowVarExprState
*
wrvstate
,
static
Datum
ExecEvalWholeRow
Slow
(
WholeRowVarExprState
*
wrvstate
,
ExprContext
*
econtext
,
ExprContext
*
econtext
,
bool
*
isNull
,
ExprDoneCond
*
isDone
);
bool
*
isNull
,
ExprDoneCond
*
isDone
);
static
Datum
ExecEvalConst
(
ExprState
*
exprstate
,
ExprContext
*
econtext
,
static
Datum
ExecEvalConst
(
ExprState
*
exprstate
,
ExprContext
*
econtext
,
...
@@ -156,11 +156,11 @@ static Datum ExecEvalCoalesce(CoalesceExprState *coalesceExpr,
...
@@ -156,11 +156,11 @@ static Datum ExecEvalCoalesce(CoalesceExprState *coalesceExpr,
static
Datum
ExecEvalMinMax
(
MinMaxExprState
*
minmaxExpr
,
static
Datum
ExecEvalMinMax
(
MinMaxExprState
*
minmaxExpr
,
ExprContext
*
econtext
,
ExprContext
*
econtext
,
bool
*
isNull
,
ExprDoneCond
*
isDone
);
bool
*
isNull
,
ExprDoneCond
*
isDone
);
static
Datum
ExecEvalXml
(
XmlExprState
*
xmlExpr
,
ExprContext
*
econtext
,
bool
*
isNull
,
ExprDoneCond
*
isDone
);
static
Datum
ExecEvalNullIf
(
FuncExprState
*
nullIfExpr
,
static
Datum
ExecEvalNullIf
(
FuncExprState
*
nullIfExpr
,
ExprContext
*
econtext
,
ExprContext
*
econtext
,
bool
*
isNull
,
ExprDoneCond
*
isDone
);
bool
*
isNull
,
ExprDoneCond
*
isDone
);
static
Datum
ExecEvalXml
(
XmlExprState
*
xmlExpr
,
ExprContext
*
econtext
,
bool
*
isNull
,
ExprDoneCond
*
isDone
);
static
Datum
ExecEvalNullTest
(
NullTestState
*
nstate
,
static
Datum
ExecEvalNullTest
(
NullTestState
*
nstate
,
ExprContext
*
econtext
,
ExprContext
*
econtext
,
bool
*
isNull
,
ExprDoneCond
*
isDone
);
bool
*
isNull
,
ExprDoneCond
*
isDone
);
...
@@ -689,7 +689,6 @@ ExecEvalScalarVar(ExprState *exprstate, ExprContext *econtext,
...
@@ -689,7 +689,6 @@ ExecEvalScalarVar(ExprState *exprstate, ExprContext *econtext,
if
(
isDone
)
if
(
isDone
)
*
isDone
=
ExprSingleResult
;
*
isDone
=
ExprSingleResult
;
Assert
(
econtext
->
ecxt_scantuple
!=
NULL
||
econtext
->
ecxt_innertuple
!=
NULL
||
econtext
->
ecxt_outertuple
!=
NULL
);
/*
/*
* Get the input slot and attribute number we want
* Get the input slot and attribute number we want
*
*
...
@@ -746,6 +745,7 @@ ExecEvalScalarVar(ExprState *exprstate, ExprContext *econtext,
...
@@ -746,6 +745,7 @@ ExecEvalScalarVar(ExprState *exprstate, ExprContext *econtext,
if
(
attnum
>
slot_tupdesc
->
natts
)
/* should never happen */
if
(
attnum
>
slot_tupdesc
->
natts
)
/* should never happen */
elog
(
ERROR
,
"attribute number %d exceeds number of columns %d"
,
elog
(
ERROR
,
"attribute number %d exceeds number of columns %d"
,
attnum
,
slot_tupdesc
->
natts
);
attnum
,
slot_tupdesc
->
natts
);
attr
=
slot_tupdesc
->
attrs
[
attnum
-
1
];
attr
=
slot_tupdesc
->
attrs
[
attnum
-
1
];
/* can't check type if dropped, since atttypid is probably 0 */
/* can't check type if dropped, since atttypid is probably 0 */
...
@@ -1159,7 +1159,6 @@ ExecEvalParam(ExprState *exprstate, ExprContext *econtext,
...
@@ -1159,7 +1159,6 @@ ExecEvalParam(ExprState *exprstate, ExprContext *econtext,
ParamExecData
*
prm
;
ParamExecData
*
prm
;
prm
=
&
(
econtext
->
ecxt_param_exec_vals
[
thisParamId
]);
prm
=
&
(
econtext
->
ecxt_param_exec_vals
[
thisParamId
]);
if
(
prm
->
execPlan
!=
NULL
)
if
(
prm
->
execPlan
!=
NULL
)
{
{
/* Parameter not evaluated yet, so go do it */
/* Parameter not evaluated yet, so go do it */
...
@@ -2848,7 +2847,7 @@ static void FastPathScalarArrayOp(ScalarArrayOpExpr *opexpr, ScalarArrayOpExprSt
...
@@ -2848,7 +2847,7 @@ static void FastPathScalarArrayOp(ScalarArrayOpExpr *opexpr, ScalarArrayOpExprSt
* (for ANY and ALL respectively). Of course we short-circuit as soon as
* (for ANY and ALL respectively). Of course we short-circuit as soon as
* the result is known.
* the result is known.
*/
*/
static
Datum
static
Datum
ExecEvalScalarArrayOp
(
ScalarArrayOpExprState
*
sstate
,
ExecEvalScalarArrayOp
(
ScalarArrayOpExprState
*
sstate
,
ExprContext
*
econtext
,
ExprContext
*
econtext
,
bool
*
isNull
,
ExprDoneCond
*
isDone
)
bool
*
isNull
,
ExprDoneCond
*
isDone
)
...
...
src/backend/optimizer/path/allpaths.c
浏览文件 @
9453514b
...
@@ -72,7 +72,8 @@ static void set_tablefunction_pathlist(PlannerInfo *root, RelOptInfo *rel,
...
@@ -72,7 +72,8 @@ static void set_tablefunction_pathlist(PlannerInfo *root, RelOptInfo *rel,
RangeTblEntry
*
rte
);
RangeTblEntry
*
rte
);
static
void
set_values_pathlist
(
PlannerInfo
*
root
,
RelOptInfo
*
rel
,
static
void
set_values_pathlist
(
PlannerInfo
*
root
,
RelOptInfo
*
rel
,
RangeTblEntry
*
rte
);
RangeTblEntry
*
rte
);
static
void
set_cte_pathlist
(
PlannerInfo
*
root
,
RelOptInfo
*
rel
,
RangeTblEntry
*
rte
);
static
void
set_cte_pathlist
(
PlannerInfo
*
root
,
RelOptInfo
*
rel
,
RangeTblEntry
*
rte
);
static
RelOptInfo
*
make_rel_from_joinlist
(
PlannerInfo
*
root
,
List
*
joinlist
);
static
RelOptInfo
*
make_rel_from_joinlist
(
PlannerInfo
*
root
,
List
*
joinlist
);
static
Query
*
push_down_restrict
(
PlannerInfo
*
root
,
RelOptInfo
*
rel
,
static
Query
*
push_down_restrict
(
PlannerInfo
*
root
,
RelOptInfo
*
rel
,
RangeTblEntry
*
rte
,
Index
rti
,
Query
*
subquery
);
RangeTblEntry
*
rte
,
Index
rti
,
Query
*
subquery
);
...
...
src/backend/optimizer/plan/createplan.c
浏览文件 @
9453514b
...
@@ -255,7 +255,6 @@ create_subplan(PlannerInfo *root, Path *best_path)
...
@@ -255,7 +255,6 @@ create_subplan(PlannerInfo *root, Path *best_path)
plan
=
create_motion_plan
(
root
,
(
CdbMotionPath
*
)
best_path
);
plan
=
create_motion_plan
(
root
,
(
CdbMotionPath
*
)
best_path
);
break
;
break
;
default:
default:
Assert
(
false
);
elog
(
ERROR
,
"unrecognized node type: %d"
,
elog
(
ERROR
,
"unrecognized node type: %d"
,
(
int
)
best_path
->
pathtype
);
(
int
)
best_path
->
pathtype
);
plan
=
NULL
;
/* keep compiler quiet */
plan
=
NULL
;
/* keep compiler quiet */
...
@@ -267,8 +266,7 @@ create_subplan(PlannerInfo *root, Path *best_path)
...
@@ -267,8 +266,7 @@ create_subplan(PlannerInfo *root, Path *best_path)
plan
->
dispatch
=
DISPATCH_PARALLEL
;
plan
->
dispatch
=
DISPATCH_PARALLEL
;
return
plan
;
return
plan
;
}
/* create_subplan */
}
/*
/*
* create_scan_plan
* create_scan_plan
...
@@ -726,6 +724,7 @@ create_append_plan(PlannerInfo *root, AppendPath *best_path)
...
@@ -726,6 +724,7 @@ create_append_plan(PlannerInfo *root, AppendPath *best_path)
}
}
plan
=
make_append
(
subplans
,
false
,
tlist
);
plan
=
make_append
(
subplans
,
false
,
tlist
);
return
(
Plan
*
)
plan
;
return
(
Plan
*
)
plan
;
}
}
...
...
src/backend/optimizer/plan/planner.c
浏览文件 @
9453514b
...
@@ -621,6 +621,7 @@ standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
...
@@ -621,6 +621,7 @@ standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
return
result
;
return
result
;
}
}
/*--------------------
/*--------------------
* subquery_planner
* subquery_planner
* Invokes the planner on a subquery. We recurse to here for each
* Invokes the planner on a subquery. We recurse to here for each
...
@@ -2162,7 +2163,8 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
...
@@ -2162,7 +2163,8 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
{
{
result_plan
=
(
Plan
*
)
make_sort_from_pathkeys
(
root
,
result_plan
=
(
Plan
*
)
make_sort_from_pathkeys
(
root
,
result_plan
,
result_plan
,
sort_pathkeys
,
limit_tuples
,
false
);
sort_pathkeys
,
limit_tuples
,
false
);
if
(
result_plan
==
NULL
)
if
(
result_plan
==
NULL
)
elog
(
ERROR
,
"could not find sort pathkeys in result target list"
);
elog
(
ERROR
,
"could not find sort pathkeys in result target list"
);
current_pathkeys
=
sort_pathkeys
;
current_pathkeys
=
sort_pathkeys
;
...
...
src/backend/optimizer/prep/prepjointree.c
浏览文件 @
9453514b
...
@@ -66,7 +66,7 @@ static void reduce_outer_joins_pass2(Node *jtnode,
...
@@ -66,7 +66,7 @@ static void reduce_outer_joins_pass2(Node *jtnode,
Relids
nonnullable_rels
);
Relids
nonnullable_rels
);
static
void
fix_in_clause_relids
(
List
*
in_info_list
,
int
varno
,
static
void
fix_in_clause_relids
(
List
*
in_info_list
,
int
varno
,
Relids
subrelids
);
Relids
subrelids
);
static
void
fix_append_rel_relids
(
List
*
append_rel_list
,
Index
varno
,
static
void
fix_append_rel_relids
(
List
*
append_rel_list
,
int
varno
,
Relids
subrelids
);
Relids
subrelids
);
static
Node
*
find_jointree_node_for_rel
(
Node
*
jtnode
,
int
relid
);
static
Node
*
find_jointree_node_for_rel
(
Node
*
jtnode
,
int
relid
);
...
@@ -1215,7 +1215,7 @@ fix_in_clause_relids(List *in_info_list, int varno, Relids subrelids)
...
@@ -1215,7 +1215,7 @@ fix_in_clause_relids(List *in_info_list, int varno, Relids subrelids)
* We assume we may modify the AppendRelInfo nodes in-place.
* We assume we may modify the AppendRelInfo nodes in-place.
*/
*/
static
void
static
void
fix_append_rel_relids
(
List
*
append_rel_list
,
Index
varno
,
Relids
subrelids
)
fix_append_rel_relids
(
List
*
append_rel_list
,
int
varno
,
Relids
subrelids
)
{
{
ListCell
*
l
;
ListCell
*
l
;
int
subvarno
=
-
1
;
int
subvarno
=
-
1
;
...
...
src/backend/optimizer/util/clauses.c
浏览文件 @
9453514b
...
@@ -1997,16 +1997,15 @@ eval_const_expressions_mutator(Node *node,
...
@@ -1997,16 +1997,15 @@ eval_const_expressions_mutator(Node *node,
if
(
IsA
(
node
,
FuncExpr
))
if
(
IsA
(
node
,
FuncExpr
))
{
{
FuncExpr
*
expr
=
(
FuncExpr
*
)
node
;
FuncExpr
*
expr
=
(
FuncExpr
*
)
node
;
List
*
args
;
Expr
*
simple
;
FuncExpr
*
newexpr
;
if
(
!
context
->
transform_functions_returning_composite_values
&&
type_is_rowtype
(
expr
->
funcresulttype
))
if
(
!
context
->
transform_functions_returning_composite_values
&&
type_is_rowtype
(
expr
->
funcresulttype
))
{
{
return
copyObject
(
expr
);
return
copyObject
(
expr
);
}
}
List
*
args
=
NIL
;
Expr
*
simple
=
NULL
;
FuncExpr
*
newexpr
=
NULL
;
/*
/*
* Reduce constants in the FuncExpr's arguments. We know args is
* Reduce constants in the FuncExpr's arguments. We know args is
* either NIL or a List node, so we can call expression_tree_mutator
* either NIL or a List node, so we can call expression_tree_mutator
...
...
src/backend/parser/analyze.c
浏览文件 @
9453514b
...
@@ -367,12 +367,15 @@ analyze_requires_snapshot(Node *parseTree)
...
@@ -367,12 +367,15 @@ analyze_requires_snapshot(Node *parseTree)
break
;
break
;
case
T_ExplainStmt
:
case
T_ExplainStmt
:
/* yes, because it's analyzed just like SELECT */
/*
* We only need a snapshot in varparams case, but it doesn't seem
* worth complicating this function's API to distinguish that.
*/
result
=
true
;
result
=
true
;
break
;
break
;
default:
default:
/*
other
utility statements don't have any active parse analysis */
/* utility statements don't have any active parse analysis */
result
=
false
;
result
=
false
;
break
;
break
;
}
}
...
@@ -2843,6 +2846,7 @@ transformReturningList(ParseState *pstate, List *returningList)
...
@@ -2843,6 +2846,7 @@ transformReturningList(ParseState *pstate, List *returningList)
}
}
#endif
#endif
/*
/*
* transformDeclareCursorStmt -
* transformDeclareCursorStmt -
* transform a DECLARE CURSOR Statement
* transform a DECLARE CURSOR Statement
...
...
src/backend/parser/parse_clause.c
浏览文件 @
9453514b
...
@@ -19,19 +19,13 @@
...
@@ -19,19 +19,13 @@
#include "catalog/catquery.h"
#include "catalog/catquery.h"
#include "access/heapam.h"
#include "access/heapam.h"
#include "catalog/heap.h"
#include "catalog/heap.h"
#include "catalog/pg_am.h"
#include "catalog/pg_amop.h"
#include "catalog/pg_exttable.h"
#include "catalog/pg_exttable.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_opclass.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "catalog/pg_type.h"
#include "catalog/pg_window.h"
#include "catalog/pg_window.h"
#include "commands/defrem.h"
#include "commands/defrem.h"
#include "nodes/makefuncs.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "nodes/nodeFuncs.h"
#include "nodes/print.h"
/* XXX: remove after debugging !! */
#include "optimizer/clauses.h"
#include "optimizer/clauses.h"
#include "optimizer/tlist.h"
#include "optimizer/tlist.h"
#include "optimizer/var.h"
#include "optimizer/var.h"
...
@@ -48,7 +42,6 @@
...
@@ -48,7 +42,6 @@
#include "rewrite/rewriteManip.h"
#include "rewrite/rewriteManip.h"
#include "utils/guc.h"
#include "utils/guc.h"
#include "utils/lsyscache.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
#include "cdb/cdbvars.h"
#include "cdb/cdbvars.h"
#include "cdb/cdbpartition.h"
#include "cdb/cdbpartition.h"
...
...
src/backend/parser/parse_coerce.c
浏览文件 @
9453514b
...
@@ -1372,6 +1372,7 @@ coerce_to_specific_type(ParseState *pstate, Node *node,
...
@@ -1372,6 +1372,7 @@ coerce_to_specific_type(ParseState *pstate, Node *node,
return
node
;
return
node
;
}
}
/* select_common_type()
/* select_common_type()
* Determine the common supertype of a list of input expression types.
* Determine the common supertype of a list of input expression types.
* This is used for determining the output type of CASE and UNION
* This is used for determining the output type of CASE and UNION
...
...
src/backend/parser/parse_cte.c
浏览文件 @
9453514b
...
@@ -6,11 +6,11 @@
...
@@ -6,11 +6,11 @@
*/
*/
#include "postgres.h"
#include "postgres.h"
#include "parser/analyze.h"
#include "parser/parse_node.h"
#include "parser/parse_node.h"
#include "parser/parse_cte.h"
#include "parser/parse_cte.h"
#include "parser/parse_expr.h"
#include "parser/parse_expr.h"
#include "parser/parse_relation.h"
#include "parser/parse_relation.h"
#include "parser/analyze.h"
#include "nodes/parsenodes.h"
#include "nodes/parsenodes.h"
#include "nodes/nodeFuncs.h"
#include "nodes/nodeFuncs.h"
...
@@ -29,6 +29,8 @@ static void analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, List
...
@@ -29,6 +29,8 @@ static void analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, List
List
*
List
*
transformWithClause
(
ParseState
*
pstate
,
WithClause
*
withClause
)
transformWithClause
(
ParseState
*
pstate
,
WithClause
*
withClause
)
{
{
ListCell
*
lc
;
if
(
withClause
==
NULL
)
if
(
withClause
==
NULL
)
return
NULL
;
return
NULL
;
...
@@ -44,22 +46,19 @@ transformWithClause(ParseState *pstate, WithClause *withClause)
...
@@ -44,22 +46,19 @@ transformWithClause(ParseState *pstate, WithClause *withClause)
Assert
(
pstate
->
p_future_ctes
==
NIL
);
Assert
(
pstate
->
p_future_ctes
==
NIL
);
/*
/*
*
Check if CTE list in the WITH clause contains duplicate query names.
*
For either type of WITH, there must not be duplicate CTE names in the
*
If so, error out
.
*
list. Check this right away so we needn't worry later
.
*
*
* Also, initialize other variables in CommonTableExpr.
* Also, initialize other variables in CommonTableExpr.
*/
*/
ListCell
*
lc
;
foreach
(
lc
,
withClause
->
ctes
)
foreach
(
lc
,
withClause
->
ctes
)
{
{
CommonTableExpr
*
cte
=
(
CommonTableExpr
*
)
lfirst
(
lc
);
CommonTableExpr
*
cte
=
(
CommonTableExpr
*
)
lfirst
(
lc
);
ListCell
*
rest
;
ListCell
*
lc2
;
for_each_cell
(
rest
,
lnext
(
lc
))
for_each_cell
(
lc2
,
lnext
(
lc
))
{
{
CommonTableExpr
*
cte2
=
(
CommonTableExpr
*
)
lfirst
(
lc2
);
CommonTableExpr
*
cte2
=
(
CommonTableExpr
*
)
lfirst
(
rest
);
Assert
(
cte
!=
NULL
&&
cte2
!=
NULL
&&
cte
->
ctename
!=
NULL
&&
cte2
->
ctename
!=
NULL
);
if
(
strcmp
(
cte
->
ctename
,
cte2
->
ctename
)
==
0
)
if
(
strcmp
(
cte
->
ctename
,
cte2
->
ctename
)
==
0
)
{
{
...
@@ -69,7 +68,6 @@ transformWithClause(ParseState *pstate, WithClause *withClause)
...
@@ -69,7 +68,6 @@ transformWithClause(ParseState *pstate, WithClause *withClause)
cte2
->
ctename
),
cte2
->
ctename
),
parser_errposition
(
pstate
,
cte2
->
location
)));
parser_errposition
(
pstate
,
cte2
->
location
)));
}
}
}
}
cte
->
cterecursive
=
false
;
cte
->
cterecursive
=
false
;
...
@@ -154,14 +152,16 @@ GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte, int rtelevelsup)
...
@@ -154,14 +152,16 @@ GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte, int rtelevelsup)
static
void
static
void
analyzeCTE
(
ParseState
*
pstate
,
CommonTableExpr
*
cte
)
analyzeCTE
(
ParseState
*
pstate
,
CommonTableExpr
*
cte
)
{
{
Query
*
query
;
Assert
(
cte
!=
NULL
);
Assert
(
cte
!=
NULL
);
Assert
(
cte
->
ctequery
!=
NULL
);
Assert
(
cte
->
ctequery
!=
NULL
);
Assert
(
!
IsA
(
cte
->
ctequery
,
Query
));
Assert
(
!
IsA
(
cte
->
ctequery
,
Query
));
Query
*
query
=
parse_sub_analyze
(
cte
->
ctequery
,
pstate
);
query
=
parse_sub_analyze
(
cte
->
ctequery
,
pstate
);
Assert
(
IsA
(
query
,
Query
))
;
cte
->
ctequery
=
(
Node
*
)
query
;
cte
->
ctequery
=
(
Node
*
)
query
;
Assert
(
IsA
(
query
,
Query
))
;
/* Check if the query is what we expected. */
/* Check if the query is what we expected. */
if
(
!
IsA
(
query
,
Query
))
if
(
!
IsA
(
query
,
Query
))
...
@@ -226,22 +226,24 @@ reportDuplicateNames(const char *queryName, List *names)
...
@@ -226,22 +226,24 @@ reportDuplicateNames(const char *queryName, List *names)
static
void
static
void
analyzeCTETargetList
(
ParseState
*
pstate
,
CommonTableExpr
*
cte
,
List
*
tlist
)
analyzeCTETargetList
(
ParseState
*
pstate
,
CommonTableExpr
*
cte
,
List
*
tlist
)
{
{
int
numaliases
;
int
varattno
;
ListCell
*
tlistitem
;
/* Not done already ... */
Assert
(
cte
->
ctecolnames
==
NIL
);
Assert
(
cte
->
ctecolnames
==
NIL
);
/*
/*
* We need to determine column names, types, and typmods. The alias
* We need to determine column names and types. The alias column names
* column names override anything coming from the query itself. (Note:
* override anything coming from the query itself. (Note: the SQL spec
* the SQL spec says that the alias list must be empty or exactly as long
* says that the alias list must be empty or exactly as long as the output
* as the output column set. Also, the alias can not have the same name.
* column set. Also, the alias can not have the same name. We report
* We report errors if this is not the case.)
* errors if this is not the case.)
*
*/
*/
cte
->
ctecolnames
=
copyObject
(
cte
->
aliascolnames
);
cte
->
ctecolnames
=
copyObject
(
cte
->
aliascolnames
);
cte
->
ctecoltypes
=
cte
->
ctecoltypmods
=
NIL
;
cte
->
ctecoltypes
=
cte
->
ctecoltypmods
=
NIL
;
int
numaliases
=
list_length
(
cte
->
aliascolnames
);
numaliases
=
list_length
(
cte
->
aliascolnames
);
varattno
=
0
;
int
varattno
=
0
;
ListCell
*
tlistitem
;
foreach
(
tlistitem
,
tlist
)
foreach
(
tlistitem
,
tlist
)
{
{
TargetEntry
*
te
=
(
TargetEntry
*
)
lfirst
(
tlistitem
);
TargetEntry
*
te
=
(
TargetEntry
*
)
lfirst
(
tlistitem
);
...
@@ -254,6 +256,8 @@ analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, List *tlist)
...
@@ -254,6 +256,8 @@ analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, List *tlist)
Assert
(
varattno
==
te
->
resno
);
Assert
(
varattno
==
te
->
resno
);
if
(
varattno
>
numaliases
)
if
(
varattno
>
numaliases
)
{
{
char
*
attrname
;
if
(
numaliases
>
0
)
if
(
numaliases
>
0
)
{
{
ereport
(
ERROR
,
ereport
(
ERROR
,
...
@@ -262,8 +266,6 @@ analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, List *tlist)
...
@@ -262,8 +266,6 @@ analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, List *tlist)
parser_errposition
(
pstate
,
cte
->
location
)));
parser_errposition
(
pstate
,
cte
->
location
)));
}
}
char
*
attrname
;
attrname
=
pstrdup
(
te
->
resname
);
attrname
=
pstrdup
(
te
->
resname
);
cte
->
ctecolnames
=
lappend
(
cte
->
ctecolnames
,
makeString
(
attrname
));
cte
->
ctecolnames
=
lappend
(
cte
->
ctecolnames
,
makeString
(
attrname
));
}
}
...
...
src/backend/parser/parse_expr.c
浏览文件 @
9453514b
...
@@ -112,11 +112,6 @@ static char *percentileFuncString(PercentileExpr *p, Oid *argtypes, int arglen,
...
@@ -112,11 +112,6 @@ static char *percentileFuncString(PercentileExpr *p, Oid *argtypes, int arglen,
* another, such as A_Const => Const; we just do nothing when handed
* another, such as A_Const => Const; we just do nothing when handed
* a Const. More care is needed for node types that are used as both
* a Const. More care is needed for node types that are used as both
* input and output of transformExpr; see SubLink for example.
* input and output of transformExpr; see SubLink for example.
*
* CDB: On return, pstate->breadcrumb.node points to the original 'expr' node.
* This is intended to provide a default cursor location in case an error is
* reported during further processing of the result, such as conversion to a
* target type.
*/
*/
Node
*
Node
*
transformExpr
(
ParseState
*
pstate
,
Node
*
expr
)
transformExpr
(
ParseState
*
pstate
,
Node
*
expr
)
...
@@ -174,11 +169,11 @@ transformExpr(ParseState *pstate, Node *expr)
...
@@ -174,11 +169,11 @@ transformExpr(ParseState *pstate, Node *expr)
Node
*
arg
=
NULL
;
Node
*
arg
=
NULL
;
/*
/*
* If the subject of the typecast is an ARRAY[] construct
* If the subject of the typecast is an ARRAY[] construct and
* and
the target type is an array type, we invoke
*
the target type is an array type, we invoke
* transformArrayExpr() directly so that we can pass down
* transformArrayExpr() directly so that we can pass down the
* the type information.
This avoids some cases where
* type information.
This avoids some cases where
* transformArrayExpr() might not infer the correct type
* transformArrayExpr() might not infer the correct type.
*/
*/
if
(
IsA
(
tc
->
arg
,
A_ArrayExpr
))
if
(
IsA
(
tc
->
arg
,
A_ArrayExpr
))
{
{
...
@@ -186,7 +181,8 @@ transformExpr(ParseState *pstate, Node *expr)
...
@@ -186,7 +181,8 @@ transformExpr(ParseState *pstate, Node *expr)
Oid
elementType
;
Oid
elementType
;
int32
targetTypmod
;
int32
targetTypmod
;
targetType
=
typenameTypeId
(
pstate
,
tc
->
typname
,
&
targetTypmod
);
targetType
=
typenameTypeId
(
pstate
,
tc
->
typname
,
&
targetTypmod
);
elementType
=
get_element_type
(
targetType
);
elementType
=
get_element_type
(
targetType
);
if
(
OidIsValid
(
elementType
))
if
(
OidIsValid
(
elementType
))
...
@@ -260,7 +256,6 @@ transformExpr(ParseState *pstate, Node *expr)
...
@@ -260,7 +256,6 @@ transformExpr(ParseState *pstate, Node *expr)
result
=
transformFuncCall
(
pstate
,
(
FuncCall
*
)
expr
);
result
=
transformFuncCall
(
pstate
,
(
FuncCall
*
)
expr
);
break
;
break
;
case
T_SubLink
:
case
T_SubLink
:
result
=
transformSubLink
(
pstate
,
(
SubLink
*
)
expr
);
result
=
transformSubLink
(
pstate
,
(
SubLink
*
)
expr
);
break
;
break
;
...
@@ -1527,7 +1522,6 @@ transformSubLink(ParseState *pstate, SubLink *sublink)
...
@@ -1527,7 +1522,6 @@ transformSubLink(ParseState *pstate, SubLink *sublink)
return
result
;
return
result
;
pstate
->
p_hasSubLinks
=
true
;
pstate
->
p_hasSubLinks
=
true
;
qtree
=
parse_sub_analyze
(
sublink
->
subselect
,
pstate
);
qtree
=
parse_sub_analyze
(
sublink
->
subselect
,
pstate
);
/*
/*
...
@@ -1651,6 +1645,13 @@ transformSubLink(ParseState *pstate, SubLink *sublink)
...
@@ -1651,6 +1645,13 @@ transformSubLink(ParseState *pstate, SubLink *sublink)
return
result
;
return
result
;
}
}
/*
* transformArrayExpr
*
* If the caller specifies the target type, the resulting array will
* be of exactly that type. Otherwise we try to infer a common type
* for the elements using select_common_type().
*/
static
Node
*
static
Node
*
transformArrayExpr
(
ParseState
*
pstate
,
A_ArrayExpr
*
a
,
transformArrayExpr
(
ParseState
*
pstate
,
A_ArrayExpr
*
a
,
Oid
array_type
,
Oid
element_type
,
int32
typmod
)
Oid
array_type
,
Oid
element_type
,
int32
typmod
)
...
@@ -1768,7 +1769,6 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
...
@@ -1768,7 +1769,6 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
* elements, then the elements are implicitly coerced to the common type.
* elements, then the elements are implicitly coerced to the common type.
* This is consistent with other uses of select_common_type().
* This is consistent with other uses of select_common_type().
*/
*/
foreach
(
element
,
newelems
)
foreach
(
element
,
newelems
)
{
{
Node
*
e
=
(
Node
*
)
lfirst
(
element
);
Node
*
e
=
(
Node
*
)
lfirst
(
element
);
...
@@ -1781,8 +1781,8 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
...
@@ -1781,8 +1781,8 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
coerce_type
,
coerce_type
,
typmod
,
typmod
,
COERCION_EXPLICIT
,
COERCION_EXPLICIT
,
COERCE_EXPLICIT_CAST
,
-
1
);
COERCE_EXPLICIT_CAST
,
-
1
);
if
(
newe
==
NULL
)
if
(
newe
==
NULL
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_CANNOT_COERCE
),
(
errcode
(
ERRCODE_CANNOT_COERCE
),
...
@@ -2119,7 +2119,8 @@ transformXmlSerialize(ParseState *pstate, XmlSerialize *xs)
...
@@ -2119,7 +2119,8 @@ transformXmlSerialize(ParseState *pstate, XmlSerialize *xs)
*/
*/
result
=
coerce_to_target_type
(
pstate
,
(
Node
*
)
xexpr
,
result
=
coerce_to_target_type
(
pstate
,
(
Node
*
)
xexpr
,
TEXTOID
,
targetType
,
targetTypmod
,
TEXTOID
,
targetType
,
targetTypmod
,
COERCION_IMPLICIT
,
COERCE_IMPLICIT_CAST
,
COERCION_IMPLICIT
,
COERCE_IMPLICIT_CAST
,
xexpr
->
location
);
xexpr
->
location
);
if
(
result
==
NULL
)
if
(
result
==
NULL
)
ereport
(
ERROR
,
ereport
(
ERROR
,
...
@@ -2242,7 +2243,8 @@ transformWholeRowRef(ParseState *pstate, char *schemaname, char *relname,
...
@@ -2242,7 +2243,8 @@ transformWholeRowRef(ParseState *pstate, char *schemaname, char *relname,
&
sublevels_up
);
&
sublevels_up
);
if
(
rte
==
NULL
)
if
(
rte
==
NULL
)
rte
=
addImplicitRTE
(
pstate
,
makeRangeVar
(
schemaname
,
relname
,
location
));
rte
=
addImplicitRTE
(
pstate
,
makeRangeVar
(
schemaname
,
relname
,
location
));
vnum
=
RTERangeTablePosn
(
pstate
,
rte
,
&
sublevels_up
);
vnum
=
RTERangeTablePosn
(
pstate
,
rte
,
&
sublevels_up
);
...
@@ -3449,7 +3451,8 @@ make_row_distinct_op(ParseState *pstate, List *opname,
...
@@ -3449,7 +3451,8 @@ make_row_distinct_op(ParseState *pstate, List *opname,
result
=
cmp
;
result
=
cmp
;
else
else
result
=
(
Node
*
)
makeBoolExpr
(
OR_EXPR
,
result
=
(
Node
*
)
makeBoolExpr
(
OR_EXPR
,
list_make2
(
result
,
cmp
),
location
);
list_make2
(
result
,
cmp
),
location
);
}
}
if
(
result
==
NULL
)
if
(
result
==
NULL
)
...
...
src/backend/parser/parse_relation.c
浏览文件 @
9453514b
...
@@ -17,16 +17,12 @@
...
@@ -17,16 +17,12 @@
#include <ctype.h>
#include <ctype.h>
#include "access/genam.h"
#include "access/heapam.h"
#include "access/heapam.h"
#include "catalog/heap.h"
#include "catalog/heap.h"
#include "catalog/namespace.h"
#include "catalog/namespace.h"
#include "catalog/pg_exttable.h"
#include "catalog/pg_proc_callback.h"
#include "catalog/pg_proc_callback.h"
#include "catalog/pg_type.h"
#include "catalog/pg_type.h"
#include "catalog/indexing.h"
#include "funcapi.h"
#include "funcapi.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "nodes/nodeFuncs.h"
#include "nodes/relation.h"
/* CdbRelColumnInfo */
#include "nodes/relation.h"
/* CdbRelColumnInfo */
...
@@ -36,12 +32,9 @@
...
@@ -36,12 +32,9 @@
#include "parser/parse_relation.h"
#include "parser/parse_relation.h"
#include "parser/parse_type.h"
#include "parser/parse_type.h"
#include "parser/parse_coerce.h"
#include "parser/parse_coerce.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
#include "utils/syscache.h"
#include "utils/array.h"
#include "utils/fmgroids.h"
/* GUC parameter */
/* GUC parameter */
...
@@ -201,12 +194,9 @@ scanNameSpaceForRelid(ParseState *pstate, Oid relid, int location)
...
@@ -201,12 +194,9 @@ scanNameSpaceForRelid(ParseState *pstate, Oid relid, int location)
* rejects WITH lists containing duplicate CTE names.
* rejects WITH lists containing duplicate CTE names.
*/
*/
CommonTableExpr
*
CommonTableExpr
*
scanNameSpaceForCTE
(
ParseState
*
pstate
,
scanNameSpaceForCTE
(
ParseState
*
pstate
,
const
char
*
refname
,
const
char
*
refname
,
Index
*
ctelevelsup
)
Index
*
ctelevelsup
)
{
{
Assert
(
refname
!=
NULL
);
Index
levelsup
;
Index
levelsup
;
for
(
levelsup
=
0
;
for
(
levelsup
=
0
;
...
@@ -218,7 +208,6 @@ scanNameSpaceForCTE(ParseState *pstate,
...
@@ -218,7 +208,6 @@ scanNameSpaceForCTE(ParseState *pstate,
foreach
(
lc
,
pstate
->
p_ctenamespace
)
foreach
(
lc
,
pstate
->
p_ctenamespace
)
{
{
CommonTableExpr
*
cte
=
(
CommonTableExpr
*
)
lfirst
(
lc
);
CommonTableExpr
*
cte
=
(
CommonTableExpr
*
)
lfirst
(
lc
);
Assert
(
cte
!=
NULL
&&
cte
->
ctename
!=
NULL
);
if
(
strcmp
(
cte
->
ctename
,
refname
)
==
0
)
if
(
strcmp
(
cte
->
ctename
,
refname
)
==
0
)
{
{
...
@@ -227,7 +216,6 @@ scanNameSpaceForCTE(ParseState *pstate,
...
@@ -227,7 +216,6 @@ scanNameSpaceForCTE(ParseState *pstate,
}
}
}
}
}
}
return
NULL
;
return
NULL
;
}
}
...
@@ -266,16 +254,17 @@ isFutureCTE(ParseState *pstate, const char *refname)
...
@@ -266,16 +254,17 @@ isFutureCTE(ParseState *pstate, const char *refname)
* valid matches, but only one will be returned). This must be used ONLY
* valid matches, but only one will be returned). This must be used ONLY
* as a heuristic in giving suitable error messages. See warnAutoRange.
* as a heuristic in giving suitable error messages. See warnAutoRange.
*
*
* Notice that we consider both matches on actual relation
name (or CTE) and matches
* Notice that we consider both matches on actual relation
(or CTE) name
* on alias.
*
and matches
on alias.
*/
*/
static
RangeTblEntry
*
static
RangeTblEntry
*
searchRangeTable
(
ParseState
*
pstate
,
RangeVar
*
relation
)
searchRangeTable
(
ParseState
*
pstate
,
RangeVar
*
relation
)
{
{
Oid
relId
=
InvalidOid
;
const
char
*
refname
=
relation
->
relname
;
const
char
*
refname
=
relation
->
relname
;
Oid
relId
=
InvalidOid
;
CommonTableExpr
*
cte
=
NULL
;
CommonTableExpr
*
cte
=
NULL
;
Index
ctelevelsup
=
0
;
Index
ctelevelsup
=
0
;
Index
levelsup
;
/*
/*
* If it's an unqualified name, check for possible CTE matches. A CTE
* If it's an unqualified name, check for possible CTE matches. A CTE
...
@@ -287,8 +276,10 @@ searchRangeTable(ParseState *pstate, RangeVar *relation)
...
@@ -287,8 +276,10 @@ searchRangeTable(ParseState *pstate, RangeVar *relation)
if
(
!
cte
)
if
(
!
cte
)
relId
=
RangeVarGetRelid
(
relation
,
true
);
relId
=
RangeVarGetRelid
(
relation
,
true
);
Index
levelsup
=
0
;
/* Now look for RTEs matching either the relation/CTE or the alias */
while
(
pstate
!=
NULL
)
for
(
levelsup
=
0
;
pstate
!=
NULL
;
pstate
=
pstate
->
parentParseState
,
levelsup
++
)
{
{
ListCell
*
l
;
ListCell
*
l
;
...
@@ -296,11 +287,10 @@ searchRangeTable(ParseState *pstate, RangeVar *relation)
...
@@ -296,11 +287,10 @@ searchRangeTable(ParseState *pstate, RangeVar *relation)
{
{
RangeTblEntry
*
rte
=
(
RangeTblEntry
*
)
lfirst
(
l
);
RangeTblEntry
*
rte
=
(
RangeTblEntry
*
)
lfirst
(
l
);
if
(
OidIsValid
(
relId
)
&&
if
(
rte
->
rtekind
==
RTE_RELATION
&&
rte
->
rtekind
==
RTE_RELATION
&&
OidIsValid
(
relId
)
&&
rte
->
relid
==
relId
)
rte
->
relid
==
relId
)
return
rte
;
return
rte
;
if
(
rte
->
rtekind
==
RTE_CTE
&&
if
(
rte
->
rtekind
==
RTE_CTE
&&
cte
!=
NULL
&&
cte
!=
NULL
&&
rte
->
ctelevelsup
+
levelsup
==
ctelevelsup
&&
rte
->
ctelevelsup
+
levelsup
==
ctelevelsup
&&
...
@@ -312,9 +302,6 @@ searchRangeTable(ParseState *pstate, RangeVar *relation)
...
@@ -312,9 +302,6 @@ searchRangeTable(ParseState *pstate, RangeVar *relation)
strcmp
(
rte
->
eref
->
aliasname
,
refname
)
==
0
)
strcmp
(
rte
->
eref
->
aliasname
,
refname
)
==
0
)
return
rte
;
return
rte
;
}
}
pstate
=
pstate
->
parentParseState
;
levelsup
++
;
}
}
return
NULL
;
return
NULL
;
}
}
...
@@ -1373,6 +1360,11 @@ addRangeTableEntryForCTE(ParseState *pstate,
...
@@ -1373,6 +1360,11 @@ addRangeTableEntryForCTE(ParseState *pstate,
bool
inFromCl
)
bool
inFromCl
)
{
{
RangeTblEntry
*
rte
=
makeNode
(
RangeTblEntry
);
RangeTblEntry
*
rte
=
makeNode
(
RangeTblEntry
);
char
*
refname
;
Alias
*
eref
;
int
numaliases
;
int
varattno
;
ListCell
*
lc
;
rte
->
rtekind
=
RTE_CTE
;
rte
->
rtekind
=
RTE_CTE
;
rte
->
ctename
=
cte
->
ctename
;
rte
->
ctename
=
cte
->
ctename
;
...
@@ -1393,18 +1385,15 @@ addRangeTableEntryForCTE(ParseState *pstate,
...
@@ -1393,18 +1385,15 @@ addRangeTableEntryForCTE(ParseState *pstate,
rte
->
ctecoltypmods
=
cte
->
ctecoltypmods
;
rte
->
ctecoltypmods
=
cte
->
ctecoltypmods
;
rte
->
alias
=
rangeVar
->
alias
;
rte
->
alias
=
rangeVar
->
alias
;
char
*
refname
=
rte
->
alias
?
rte
->
alias
->
aliasname
:
cte
->
ctename
;
refname
=
rte
->
alias
?
rte
->
alias
->
aliasname
:
cte
->
ctename
;
Alias
*
eref
;
if
(
rte
->
alias
)
if
(
rte
->
alias
)
eref
=
copyObject
(
rte
->
alias
);
eref
=
copyObject
(
rte
->
alias
);
else
else
eref
=
makeAlias
(
refname
,
NIL
);
eref
=
makeAlias
(
refname
,
NIL
);
int
numaliases
=
list_length
(
eref
->
colnames
);
numaliases
=
list_length
(
eref
->
colnames
);
/* fill in any unspecified alias columns */
/* fill in any unspecified alias columns */
int
varattno
=
0
;
varattno
=
0
;
ListCell
*
lc
;
foreach
(
lc
,
cte
->
ctecolnames
)
foreach
(
lc
,
cte
->
ctecolnames
)
{
{
varattno
++
;
varattno
++
;
...
@@ -2299,7 +2288,7 @@ get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum)
...
@@ -2299,7 +2288,7 @@ get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum)
case
RTE_SUBQUERY
:
case
RTE_SUBQUERY
:
case
RTE_VALUES
:
case
RTE_VALUES
:
case
RTE_CTE
:
case
RTE_CTE
:
/* Subselect
and Values
RTEs never have dropped columns */
/* Subselect
, Values, CTE
RTEs never have dropped columns */
result
=
false
;
result
=
false
;
break
;
break
;
case
RTE_JOIN
:
case
RTE_JOIN
:
...
...
src/backend/parser/parse_target.c
浏览文件 @
9453514b
...
@@ -1127,7 +1127,7 @@ expandRecordVariable(ParseState *pstate, Var *var, int levelsup)
...
@@ -1127,7 +1127,7 @@ expandRecordVariable(ParseState *pstate, Var *var, int levelsup)
char
*
label
=
strVal
(
lfirst
(
lname
));
char
*
label
=
strVal
(
lfirst
(
lname
));
Node
*
varnode
=
(
Node
*
)
lfirst
(
lvar
);
Node
*
varnode
=
(
Node
*
)
lfirst
(
lvar
);
TupleDescInitEntry
(
tupleDesc
,
(
AttrNumber
)
i
,
TupleDescInitEntry
(
tupleDesc
,
i
,
label
,
label
,
exprType
(
varnode
),
exprType
(
varnode
),
exprTypmod
(
varnode
),
exprTypmod
(
varnode
),
...
...
src/backend/parser/parse_utilcmd.c
浏览文件 @
9453514b
...
@@ -2461,7 +2461,6 @@ transformFKConstraints(ParseState *pstate, CreateStmtContext *cxt,
...
@@ -2461,7 +2461,6 @@ transformFKConstraints(ParseState *pstate, CreateStmtContext *cxt,
}
}
}
}
/*
/*
* transformIndexStmt - parse analysis for CREATE INDEX
* transformIndexStmt - parse analysis for CREATE INDEX
*
*
...
@@ -3521,6 +3520,10 @@ transformCreateSchemaStmt(CreateSchemaStmt *stmt)
...
@@ -3521,6 +3520,10 @@ transformCreateSchemaStmt(CreateSchemaStmt *stmt)
return
result
;
return
result
;
}
}
/*
* setSchemaName
* Set or check schema name in an element of a CREATE SCHEMA command
*/
static
void
static
void
setSchemaName
(
char
*
context_schema
,
char
**
stmt_schema_name
)
setSchemaName
(
char
*
context_schema
,
char
**
stmt_schema_name
)
{
{
...
...
src/backend/storage/buffer/bufmgr.c
浏览文件 @
9453514b
...
@@ -87,6 +87,7 @@ static bool IsForInput;
...
@@ -87,6 +87,7 @@ static bool IsForInput;
/* local state for LockBufferForCleanup */
/* local state for LockBufferForCleanup */
static
volatile
BufferDesc
*
PinCountWaitBuf
=
NULL
;
static
volatile
BufferDesc
*
PinCountWaitBuf
=
NULL
;
static
Buffer
ReadBuffer_common
(
SMgrRelation
reln
,
bool
isLocalBuf
,
static
Buffer
ReadBuffer_common
(
SMgrRelation
reln
,
bool
isLocalBuf
,
bool
isTemp
,
BlockNumber
blockNum
,
bool
zeroPage
,
bool
isTemp
,
BlockNumber
blockNum
,
bool
zeroPage
,
BufferAccessStrategy
strategy
,
BufferAccessStrategy
strategy
,
...
@@ -101,11 +102,9 @@ static bool StartBufferIO(volatile BufferDesc *buf, bool forInput);
...
@@ -101,11 +102,9 @@ static bool StartBufferIO(volatile BufferDesc *buf, bool forInput);
static
void
TerminateBufferIO
(
volatile
BufferDesc
*
buf
,
bool
clear_dirty
,
static
void
TerminateBufferIO
(
volatile
BufferDesc
*
buf
,
bool
clear_dirty
,
int
set_flag_bits
);
int
set_flag_bits
);
static
void
buffer_write_error_callback
(
void
*
arg
);
static
void
buffer_write_error_callback
(
void
*
arg
);
static
volatile
BufferDesc
*
BufferAlloc
(
SMgrRelation
reln
,
BlockNumber
blockNum
,
static
volatile
BufferDesc
*
BufferAlloc
(
SMgrRelation
reln
,
BlockNumber
blockNum
,
BufferAccessStrategy
strategy
,
BufferAccessStrategy
strategy
,
bool
*
foundPtr
);
bool
*
foundPtr
);
static
void
FlushBuffer
(
volatile
BufferDesc
*
buf
,
SMgrRelation
reln
);
static
void
FlushBuffer
(
volatile
BufferDesc
*
buf
,
SMgrRelation
reln
);
static
void
AtProcExit_Buffers
(
int
code
,
Datum
arg
);
static
void
AtProcExit_Buffers
(
int
code
,
Datum
arg
);
...
@@ -1215,7 +1214,6 @@ BufferSync(int flags)
...
@@ -1215,7 +1214,6 @@ BufferSync(int flags)
/* Make sure we can handle the pin inside SyncOneBuffer */
/* Make sure we can handle the pin inside SyncOneBuffer */
ResourceOwnerEnlargeBuffers
(
CurrentResourceOwner
);
ResourceOwnerEnlargeBuffers
(
CurrentResourceOwner
);
/*
/*
* Loop over all buffers, and mark the ones that need to be written with
* Loop over all buffers, and mark the ones that need to be written with
* BM_CHECKPOINT_NEEDED. Count them as we go (num_to_write), so that we
* BM_CHECKPOINT_NEEDED. Count them as we go (num_to_write), so that we
...
@@ -2116,12 +2114,12 @@ RelationTruncate(Relation rel, BlockNumber nblocks, bool markPersistentAsPhysica
...
@@ -2116,12 +2114,12 @@ RelationTruncate(Relation rel, BlockNumber nblocks, bool markPersistentAsPhysica
* --------------------------------------------------------------------
* --------------------------------------------------------------------
*/
*/
void
void
DropRelFileNodeBuffers
(
RelFileNode
rnode
,
bool
is
LocalBuf
,
DropRelFileNodeBuffers
(
RelFileNode
rnode
,
bool
is
temp
,
BlockNumber
firstDelBlock
)
BlockNumber
firstDelBlock
)
{
{
int
i
;
int
i
;
if
(
is
LocalBuf
)
/*CDB*/
if
(
is
temp
)
{
{
DropRelFileNodeLocalBuffers
(
rnode
,
firstDelBlock
);
DropRelFileNodeLocalBuffers
(
rnode
,
firstDelBlock
);
return
;
return
;
...
@@ -2401,7 +2399,6 @@ ReleaseBuffer(Buffer buffer)
...
@@ -2401,7 +2399,6 @@ ReleaseBuffer(Buffer buffer)
UnpinBuffer
(
bufHdr
,
false
);
UnpinBuffer
(
bufHdr
,
false
);
}
}
/*
/*
* UnlockReleaseBuffer -- release the content lock and pin on a buffer
* UnlockReleaseBuffer -- release the content lock and pin on a buffer
*
*
...
...
src/backend/utils/error/elog.c
浏览文件 @
9453514b
...
@@ -187,6 +187,7 @@ static int recursion_depth = 0; /* to detect actual recursion */
...
@@ -187,6 +187,7 @@ static int recursion_depth = 0; /* to detect actual recursion */
static
char
formatted_start_time
[
FORMATTED_TS_LEN
];
static
char
formatted_start_time
[
FORMATTED_TS_LEN
];
static
char
formatted_log_time
[
FORMATTED_TS_LEN
];
static
char
formatted_log_time
[
FORMATTED_TS_LEN
];
/* Macro for checking errordata_stack_depth is reasonable */
/* Macro for checking errordata_stack_depth is reasonable */
#define CHECK_STACK_DEPTH() \
#define CHECK_STACK_DEPTH() \
do { \
do { \
...
@@ -197,6 +198,7 @@ static char formatted_log_time[FORMATTED_TS_LEN];
...
@@ -197,6 +198,7 @@ static char formatted_log_time[FORMATTED_TS_LEN];
} \
} \
} while (0)
} while (0)
static
void
cdb_tidy_message
(
ErrorData
*
edata
);
static
void
cdb_tidy_message
(
ErrorData
*
edata
);
static
void
log_line_prefix
(
StringInfo
buf
);
static
void
log_line_prefix
(
StringInfo
buf
);
static
void
send_message_to_server_log
(
ErrorData
*
edata
);
static
void
send_message_to_server_log
(
ErrorData
*
edata
);
...
...
src/backend/utils/misc/guc.c
浏览文件 @
9453514b
...
@@ -1780,7 +1780,7 @@ static struct config_int ConfigureNamesInt[] =
...
@@ -1780,7 +1780,7 @@ static struct config_int ConfigureNamesInt[] =
GUC_NOT_IN_SAMPLE
|
GUC_NO_SHOW_ALL
GUC_NOT_IN_SAMPLE
|
GUC_NO_SHOW_ALL
},
},
&
autovacuum_freeze_max_age
,
&
autovacuum_freeze_max_age
,
200000000
,
1000
,
2000000000
,
NULL
,
NULL
200000000
,
1000
00000
,
2000000000
,
NULL
,
NULL
},
},
{
{
/* see max_connections */
/* see max_connections */
...
@@ -2203,7 +2203,7 @@ static struct config_string ConfigureNamesString[] =
...
@@ -2203,7 +2203,7 @@ static struct config_string ConfigureNamesString[] =
{
"default_transaction_isolation"
,
PGC_USERSET
,
CLIENT_CONN_STATEMENT
,
{
"default_transaction_isolation"
,
PGC_USERSET
,
CLIENT_CONN_STATEMENT
,
gettext_noop
(
"Sets the transaction isolation level of each new transaction."
),
gettext_noop
(
"Sets the transaction isolation level of each new transaction."
),
gettext_noop
(
"Each SQL transaction has an isolation level, which "
gettext_noop
(
"Each SQL transaction has an isolation level, which "
"can be either
\"
read uncommitted
\"
,
\"
read committed
\"
,
\"
repeatable read
\"
, or
\"
serializable
\"
."
)
,
"can be either
\"
read uncommitted
\"
,
\"
read committed
\"
,
\"
repeatable read
\"
, or
\"
serializable
\"
."
)
},
},
&
default_iso_level_string
,
&
default_iso_level_string
,
"read committed"
,
assign_defaultxactisolevel
,
NULL
"read committed"
,
assign_defaultxactisolevel
,
NULL
...
@@ -3504,7 +3504,7 @@ InitializeGUCOptions(void)
...
@@ -3504,7 +3504,7 @@ InitializeGUCOptions(void)
bool
bool
SelectConfigFiles
(
const
char
*
userDoption
,
const
char
*
progname
)
SelectConfigFiles
(
const
char
*
userDoption
,
const
char
*
progname
)
{
{
char
*
configdir
=
NULL
;
char
*
configdir
;
char
*
fname
;
char
*
fname
;
struct
stat
stat_buf
;
struct
stat
stat_buf
;
...
@@ -4384,9 +4384,9 @@ parse_int(const char *value, int *result, int flags, const char **hintmsg)
...
@@ -4384,9 +4384,9 @@ parse_int(const char *value, int *result, int flags, const char **hintmsg)
/*
/*
* Try to parse value as a floating point
constant in the usual
* Try to parse value as a floating point
number in the usual format.
*
format. If the value parsed okay return true, else false. If
*
If the string parses okay, return true, else false.
*
result is not NULL, return the semantic value there
.
*
If okay and result is not NULL, return the value in *result
.
*/
*/
static
bool
static
bool
parse_real
(
const
char
*
value
,
double
*
result
)
parse_real
(
const
char
*
value
,
double
*
result
)
...
@@ -5502,8 +5502,6 @@ ExtractSetVariableArgs(VariableSetStmt *stmt)
...
@@ -5502,8 +5502,6 @@ ExtractSetVariableArgs(VariableSetStmt *stmt)
}
}
}
}
/*
/*
* SetPGVariable - SET command exported as an easily-C-callable function.
* SetPGVariable - SET command exported as an easily-C-callable function.
*
*
...
@@ -6798,6 +6796,7 @@ ParseLongOption(const char *string, char **name, char **value)
...
@@ -6798,6 +6796,7 @@ ParseLongOption(const char *string, char **name, char **value)
*
cp
=
'_'
;
*
cp
=
'_'
;
}
}
/*
/*
* Handle options fetched from pg_database.datconfig, pg_authid.rolconfig,
* Handle options fetched from pg_database.datconfig, pg_authid.rolconfig,
* pg_proc.proconfig, etc. Caller must specify proper context/source/action.
* pg_proc.proconfig, etc. Caller must specify proper context/source/action.
...
@@ -7088,6 +7087,7 @@ GUCArrayReset(ArrayType *array)
...
@@ -7088,6 +7087,7 @@ GUCArrayReset(ArrayType *array)
return
newarray
;
return
newarray
;
}
}
/*
/*
* assign_hook and show_hook subroutines
* assign_hook and show_hook subroutines
*/
*/
...
...
src/include/parser/parse_type.h
浏览文件 @
9453514b
...
@@ -44,6 +44,6 @@ extern Oid typeidTypeRelid(Oid type_id);
...
@@ -44,6 +44,6 @@ extern Oid typeidTypeRelid(Oid type_id);
extern
void
parseTypeString
(
const
char
*
str
,
Oid
*
type_id
,
int32
*
typmod_p
);
extern
void
parseTypeString
(
const
char
*
str
,
Oid
*
type_id
,
int32
*
typmod_p
);
#define ISCOMPLEX(typ
id) (typeidTypeRelid(typ
id) != InvalidOid)
#define ISCOMPLEX(typ
eid) (typeidTypeRelid(type
id) != InvalidOid)
#endif
/* PARSE_TYPE_H */
#endif
/* PARSE_TYPE_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录