Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
e64bb65a
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,发现更多精彩内容 >>
提交
e64bb65a
编写于
10月 06, 2008
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix GetCTEForRTE() to deal with the possibility that the RTE it's given came
from a query level above the current ParseState.
上级
5f853c65
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
23 addition
and
12 deletion
+23
-12
src/backend/parser/analyze.c
src/backend/parser/analyze.c
+3
-3
src/backend/parser/parse_relation.c
src/backend/parser/parse_relation.c
+11
-3
src/backend/parser/parse_target.c
src/backend/parser/parse_target.c
+6
-4
src/include/parser/parse_relation.h
src/include/parser/parse_relation.h
+3
-2
未找到文件。
src/backend/parser/analyze.c
浏览文件 @
e64bb65a
...
...
@@ -17,7 +17,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.38
0 2008/10/04 21:56:54
tgl Exp $
* $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.38
1 2008/10/06 15:15:22
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1896,7 +1896,7 @@ transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"SELECT FOR UPDATE/SHARE cannot be applied to an outer-level WITH query"
)));
cte
=
GetCTEForRTE
(
pstate
,
rte
);
cte
=
GetCTEForRTE
(
pstate
,
rte
,
-
1
);
/* should be analyzed by now */
Assert
(
IsA
(
cte
->
ctequery
,
Query
));
transformLockingClause
(
pstate
,
...
...
@@ -1989,7 +1989,7 @@ transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc)
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"SELECT FOR UPDATE/SHARE cannot be applied to an outer-level WITH query"
),
parser_errposition
(
pstate
,
thisrel
->
location
)));
cte
=
GetCTEForRTE
(
pstate
,
rte
);
cte
=
GetCTEForRTE
(
pstate
,
rte
,
-
1
);
/* should be analyzed by now */
Assert
(
IsA
(
cte
->
ctequery
,
Query
));
transformLockingClause
(
pstate
,
...
...
src/backend/parser/parse_relation.c
浏览文件 @
e64bb65a
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.13
7 2008/10/06 02:12:56
tgl Exp $
* $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.13
8 2008/10/06 15:15:22
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -371,15 +371,23 @@ GetRTEByRangeTablePosn(ParseState *pstate,
/*
* Fetch the CTE for a CTE-reference RTE.
*
* rtelevelsup is the number of query levels above the given pstate that the
* RTE came from. Callers that don't have this information readily available
* may pass -1 instead.
*/
CommonTableExpr
*
GetCTEForRTE
(
ParseState
*
pstate
,
RangeTblEntry
*
rte
)
GetCTEForRTE
(
ParseState
*
pstate
,
RangeTblEntry
*
rte
,
int
rtelevelsup
)
{
Index
levelsup
;
ListCell
*
lc
;
/* Determine RTE's levelsup if caller didn't know it */
if
(
rtelevelsup
<
0
)
(
void
)
RTERangeTablePosn
(
pstate
,
rte
,
&
rtelevelsup
);
Assert
(
rte
->
rtekind
==
RTE_CTE
);
levelsup
=
rte
->
ctelevelsup
;
levelsup
=
rte
->
ctelevelsup
+
rtelevelsup
;
while
(
levelsup
--
>
0
)
{
pstate
=
pstate
->
parentParseState
;
...
...
src/backend/parser/parse_target.c
浏览文件 @
e64bb65a
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.16
6 2008/10/05 22:20:16
tgl Exp $
* $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.16
7 2008/10/06 15:15:22
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -308,7 +308,7 @@ markTargetListOrigin(ParseState *pstate, TargetEntry *tle,
*/
if
(
attnum
!=
InvalidAttrNumber
&&
!
rte
->
self_reference
)
{
CommonTableExpr
*
cte
=
GetCTEForRTE
(
pstate
,
rte
);
CommonTableExpr
*
cte
=
GetCTEForRTE
(
pstate
,
rte
,
netlevelsup
);
TargetEntry
*
ste
;
/* should be analyzed by now */
...
...
@@ -1206,7 +1206,7 @@ expandRecordVariable(ParseState *pstate, Var *var, int levelsup)
/* CTE reference: examine subquery's output expr */
if
(
!
rte
->
self_reference
)
{
CommonTableExpr
*
cte
=
GetCTEForRTE
(
pstate
,
rte
);
CommonTableExpr
*
cte
=
GetCTEForRTE
(
pstate
,
rte
,
netlevelsup
);
TargetEntry
*
ste
;
/* should be analyzed by now */
...
...
@@ -1230,7 +1230,9 @@ expandRecordVariable(ParseState *pstate, Var *var, int levelsup)
MemSet
(
&
mypstate
,
0
,
sizeof
(
mypstate
));
/* this loop must work, since GetCTEForRTE did */
for
(
levelsup
=
0
;
levelsup
<
rte
->
ctelevelsup
;
levelsup
++
)
for
(
levelsup
=
0
;
levelsup
<
rte
->
ctelevelsup
+
netlevelsup
;
levelsup
++
)
pstate
=
pstate
->
parentParseState
;
mypstate
.
parentParseState
=
pstate
;
mypstate
.
p_rtable
=
((
Query
*
)
cte
->
ctequery
)
->
rtable
;
...
...
src/include/parser/parse_relation.h
浏览文件 @
e64bb65a
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/parser/parse_relation.h,v 1.6
0 2008/10/06 02:12:56
tgl Exp $
* $PostgreSQL: pgsql/src/include/parser/parse_relation.h,v 1.6
1 2008/10/06 15:15:22
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -34,7 +34,8 @@ extern int RTERangeTablePosn(ParseState *pstate,
extern
RangeTblEntry
*
GetRTEByRangeTablePosn
(
ParseState
*
pstate
,
int
varno
,
int
sublevels_up
);
extern
CommonTableExpr
*
GetCTEForRTE
(
ParseState
*
pstate
,
RangeTblEntry
*
rte
);
extern
CommonTableExpr
*
GetCTEForRTE
(
ParseState
*
pstate
,
RangeTblEntry
*
rte
,
int
rtelevelsup
);
extern
Node
*
scanRTEForColumn
(
ParseState
*
pstate
,
RangeTblEntry
*
rte
,
char
*
colname
,
int
location
);
extern
Node
*
colNameToVar
(
ParseState
*
pstate
,
char
*
colname
,
bool
localonly
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录