Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
e81ad79d
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,发现更多精彩内容 >>
提交
e81ad79d
编写于
11月 01, 1999
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't call ExecOpenIndices if pg_class relhasindex shows there are no
indexes to open. Avoid unnecessary work in ExecCheckPerm, too.
上级
d40dbb73
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
38 deletion
+28
-38
src/backend/executor/execMain.c
src/backend/executor/execMain.c
+20
-32
src/backend/executor/nodeAppend.c
src/backend/executor/nodeAppend.c
+8
-6
未找到文件。
src/backend/executor/execMain.c
浏览文件 @
e81ad79d
...
...
@@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.9
8 1999/10/30 23:13:30
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.9
9 1999/11/01 05:09:17
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -383,19 +383,17 @@ ExecCheckPerms(CmdType operation,
List
*
rangeTable
,
Query
*
parseTree
)
{
int
i
=
1
;
Oid
relid
;
HeapTuple
htup
;
int
rtindex
=
0
;
List
*
lp
;
List
*
qvars
,
*
tvars
;
int32
ok
=
1
,
aclcheck_result
=
-
1
;
char
*
opstr
;
NameData
rname
;
char
*
relName
=
NULL
;
char
*
userName
;
#define CHECK(MODE) pg_aclcheck(r
name.data
, userName, MODE)
#define CHECK(MODE) pg_aclcheck(r
elName
, userName, MODE)
userName
=
GetPgUserName
();
...
...
@@ -403,6 +401,8 @@ ExecCheckPerms(CmdType operation,
{
RangeTblEntry
*
rte
=
lfirst
(
lp
);
++
rtindex
;
if
(
rte
->
skipAcl
)
{
...
...
@@ -415,16 +415,8 @@ ExecCheckPerms(CmdType operation,
continue
;
}
relid
=
rte
->
relid
;
htup
=
SearchSysCacheTuple
(
RELOID
,
ObjectIdGetDatum
(
relid
),
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
htup
))
elog
(
ERROR
,
"ExecCheckPerms: bogus RT relid: %u"
,
relid
);
StrNCpy
(
rname
.
data
,
((
Form_pg_class
)
GETSTRUCT
(
htup
))
->
relname
.
data
,
NAMEDATALEN
);
if
(
i
==
resultRelation
)
relName
=
rte
->
relname
;
if
(
rtindex
==
resultRelation
)
{
/* this is the result relation */
qvars
=
pull_varnos
(
parseTree
->
qual
);
tvars
=
pull_varnos
((
Node
*
)
parseTree
->
targetList
);
...
...
@@ -461,10 +453,9 @@ ExecCheckPerms(CmdType operation,
}
if
(
!
ok
)
break
;
++
i
;
}
if
(
!
ok
)
elog
(
ERROR
,
"%s: %s"
,
r
name
.
data
,
aclcheck_error_strings
[
aclcheck_result
]);
elog
(
ERROR
,
"%s: %s"
,
r
elName
,
aclcheck_error_strings
[
aclcheck_result
]);
if
(
parseTree
!=
NULL
&&
parseTree
->
rowMark
!=
NULL
)
{
...
...
@@ -475,19 +466,11 @@ ExecCheckPerms(CmdType operation,
if
(
!
(
rm
->
info
&
ROW_ACL_FOR_UPDATE
))
continue
;
relid
=
((
RangeTblEntry
*
)
nth
(
rm
->
rti
-
1
,
rangeTable
))
->
relid
;
htup
=
SearchSysCacheTuple
(
RELOID
,
ObjectIdGetDatum
(
relid
),
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
htup
))
elog
(
ERROR
,
"ExecCheckPerms: bogus RT relid: %u"
,
relid
);
StrNCpy
(
rname
.
data
,
((
Form_pg_class
)
GETSTRUCT
(
htup
))
->
relname
.
data
,
NAMEDATALEN
);
relName
=
rt_fetch
(
rm
->
rti
,
rangeTable
)
->
relname
;
ok
=
((
aclcheck_result
=
CHECK
(
ACL_WR
))
==
ACLCHECK_OK
);
opstr
=
"write"
;
if
(
!
ok
)
elog
(
ERROR
,
"%s: %s"
,
r
name
.
data
,
aclcheck_error_strings
[
aclcheck_result
]);
elog
(
ERROR
,
"%s: %s"
,
r
elName
,
aclcheck_error_strings
[
aclcheck_result
]);
}
}
}
...
...
@@ -586,10 +569,13 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
resultRelationInfo
->
ri_IndexRelationInfo
=
NULL
;
/*
* open indices on result relation and save descriptors in the
* result relation information..
* If there are indices on the result relation, open them and save
* descriptors in the result relation info, so that we can add new
* index entries for the tuples we add/update. We need not do this
* for a DELETE, however, since deletion doesn't affect indexes.
*/
if
(
operation
!=
CMD_DELETE
)
if
(
resultRelationDesc
->
rd_rel
->
relhasindex
&&
operation
!=
CMD_DELETE
)
ExecOpenIndices
(
resultRelationOid
,
resultRelationInfo
);
estate
->
es_result_relation_info
=
resultRelationInfo
;
...
...
@@ -618,7 +604,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
foreach
(
l
,
parseTree
->
rowMark
)
{
rm
=
lfirst
(
l
);
relid
=
((
RangeTblEntry
*
)
nth
(
rm
->
rti
-
1
,
rangeTable
)
)
->
relid
;
relid
=
rt_fetch
(
rm
->
rti
,
rangeTable
)
->
relid
;
relation
=
heap_open
(
relid
,
RowShareLock
);
if
(
!
(
rm
->
info
&
ROW_MARK_FOR_UPDATE
))
continue
;
...
...
@@ -740,6 +726,8 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
* XXX rather than having to call setheapoverride(true)
* and then back to false, we should change the arguments
* to heap_open() instead..
*
* XXX no, we should use commandCounterIncrement...
*/
setheapoverride
(
true
);
...
...
src/backend/executor/nodeAppend.c
浏览文件 @
e81ad79d
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.2
7 1999/10/30 23:13:30
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.2
8 1999/11/01 05:09:18
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -181,7 +181,6 @@ ExecInitAppend(Append *node, EState *estate, Plan *parent)
{
AppendState
*
appendstate
;
int
nplans
;
List
*
resultList
=
NULL
;
List
*
rtable
;
List
*
appendplans
;
bool
*
initialized
;
...
...
@@ -246,13 +245,14 @@ ExecInitAppend(Append *node, EState *estate, Plan *parent)
if
((
es_rri
!=
(
RelationInfo
*
)
NULL
)
&&
(
node
->
inheritrelid
==
es_rri
->
ri_RangeTableIndex
))
{
RelationInfo
*
rri
;
List
*
resultList
=
NIL
;
List
*
rtentryP
;
foreach
(
rtentryP
,
rtable
)
{
Oid
reloid
;
RangeTblEntry
*
rtentry
=
lfirst
(
rtentryP
);
RangeTblEntry
*
rtentry
=
lfirst
(
rtentryP
);
Oid
reloid
;
RelationInfo
*
rri
;
reloid
=
rtentry
->
relid
;
rri
=
makeNode
(
RelationInfo
);
...
...
@@ -262,8 +262,10 @@ ExecInitAppend(Append *node, EState *estate, Plan *parent)
rri
->
ri_IndexRelationDescs
=
NULL
;
/* index descs */
rri
->
ri_IndexRelationInfo
=
NULL
;
/* index key info */
if
(
rri
->
ri_RelationDesc
->
rd_rel
->
relhasindex
)
ExecOpenIndices
(
reloid
,
rri
);
resultList
=
lcons
(
rri
,
resultList
);
ExecOpenIndices
(
reloid
,
rri
);
}
appendstate
->
as_result_relation_info_list
=
resultList
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录