Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
fa608ad2
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,发现更多精彩内容 >>
提交
fa608ad2
编写于
11月 02, 1996
作者:
B
Bryan Henderson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix bug in checking permissions on table being COPY'd.
上级
d27c28fd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
119 addition
and
143 deletion
+119
-143
src/backend/tcop/utility.c
src/backend/tcop/utility.c
+119
-143
未找到文件。
src/backend/tcop/utility.c
浏览文件 @
fa608ad2
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.
3 1996/10/31 09:08:10
bryanh Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.
4 1996/11/02 02:03:13
bryanh Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -52,25 +52,25 @@
/* ----------------
*
CHECK_IF_ABORTED() is used to avoid doing unnecessary
*
processing within an aborted transaction block.
*
CHECK_IF_ABORTED() is used to avoid doing unnecessary
*
processing within an aborted transaction block.
* ----------------
*/
#define CHECK_IF_ABORTED() \
if (IsAbortedTransactionBlockState()) { \
elog(NOTICE, "(transaction aborted): %s", \
"queries ignored until END"); \
commandTag = "*ABORT STATE*"; \
break; \
elog(NOTICE, "(transaction aborted): %s", \
"queries ignored until END"); \
commandTag = "*ABORT STATE*"; \
break; \
} \
/* ----------------
*
general utility function invoker
*
general utility function invoker
* ----------------
*/
void
ProcessUtility
(
Node
*
parsetree
,
CommandDest
dest
)
CommandDest
dest
)
{
char
*
commandTag
=
NULL
;
char
*
relname
;
...
...
@@ -80,163 +80,139 @@ ProcessUtility(Node *parsetree,
userName
=
GetPgUserName
();
switch
(
nodeTag
(
parsetree
))
{
/* ********************************
*
transactions
* ********************************
*/
/* ********************************
*
transactions
* ********************************
*/
case
T_TransactionStmt
:
{
TransactionStmt
*
stmt
=
(
TransactionStmt
*
)
parsetree
;
switch
(
stmt
->
command
)
{
case
BEGIN_TRANS
:
commandTag
=
"BEGIN"
;
CHECK_IF_ABORTED
();
BeginTransactionBlock
();
break
;
case
END_TRANS
:
commandTag
=
"END"
;
EndTransactionBlock
();
break
;
case
ABORT_TRANS
:
commandTag
=
"ABORT"
;
UserAbortTransactionBlock
();
break
;
}
}
break
;
{
TransactionStmt
*
stmt
=
(
TransactionStmt
*
)
parsetree
;
switch
(
stmt
->
command
)
{
case
BEGIN_TRANS
:
commandTag
=
"BEGIN"
;
CHECK_IF_ABORTED
();
BeginTransactionBlock
();
break
;
case
END_TRANS
:
commandTag
=
"END"
;
EndTransactionBlock
();
break
;
case
ABORT_TRANS
:
commandTag
=
"ABORT"
;
UserAbortTransactionBlock
();
break
;
}
}
break
;
/* ********************************
*
portal manipulation
* ********************************
*/
/* ********************************
*
portal manipulation
* ********************************
*/
case
T_ClosePortalStmt
:
{
ClosePortalStmt
*
stmt
=
(
ClosePortalStmt
*
)
parsetree
;
commandTag
=
"CLOSE"
;
CHECK_IF_ABORTED
();
PerformPortalClose
(
stmt
->
portalname
,
dest
);
}
break
;
{
ClosePortalStmt
*
stmt
=
(
ClosePortalStmt
*
)
parsetree
;
commandTag
=
"CLOSE"
;
CHECK_IF_ABORTED
();
PerformPortalClose
(
stmt
->
portalname
,
dest
);
}
break
;
case
T_FetchStmt
:
{
FetchStmt
*
stmt
=
(
FetchStmt
*
)
parsetree
;
char
*
portalName
=
stmt
->
portalname
;
bool
forward
;
int
count
;
commandTag
=
"FETCH"
;
CHECK_IF_ABORTED
();
forward
=
(
bool
)(
stmt
->
direction
==
FORWARD
);
/* parser ensures that count is >= 0 and
'fetch ALL' -> 0 */
count
=
stmt
->
howMany
;
PerformPortalFetch
(
portalName
,
forward
,
count
,
commandTag
,
dest
);
}
break
;
{
FetchStmt
*
stmt
=
(
FetchStmt
*
)
parsetree
;
char
*
portalName
=
stmt
->
portalname
;
bool
forward
;
int
count
;
commandTag
=
"FETCH"
;
CHECK_IF_ABORTED
();
forward
=
(
bool
)(
stmt
->
direction
==
FORWARD
);
/* parser ensures that count is >= 0 and
'fetch ALL' -> 0 */
count
=
stmt
->
howMany
;
PerformPortalFetch
(
portalName
,
forward
,
count
,
commandTag
,
dest
);
}
break
;
/* ********************************
*
relation and attribute manipulation
* ********************************
*/
/* ********************************
*
relation and attribute manipulation
* ********************************
*/
case
T_CreateStmt
:
commandTag
=
"CREATE"
;
CHECK_IF_ABORTED
();
commandTag
=
"CREATE"
;
CHECK_IF_ABORTED
();
DefineRelation
((
CreateStmt
*
)
parsetree
);
break
;
DefineRelation
((
CreateStmt
*
)
parsetree
);
break
;
case
T_DestroyStmt
:
{
DestroyStmt
*
stmt
=
(
DestroyStmt
*
)
parsetree
;
List
*
arg
;
List
*
args
=
stmt
->
relNames
;
commandTag
=
"DROP"
;
CHECK_IF_ABORTED
();
foreach
(
arg
,
args
)
{
relname
=
strVal
(
lfirst
(
arg
));
if
(
IsSystemRelationName
(
relname
))
elog
(
WARN
,
"class
\"
%-.*s
\"
is a system catalog"
,
NAMEDATALEN
,
relname
);
{
DestroyStmt
*
stmt
=
(
DestroyStmt
*
)
parsetree
;
List
*
arg
;
List
*
args
=
stmt
->
relNames
;
commandTag
=
"DROP"
;
CHECK_IF_ABORTED
();
foreach
(
arg
,
args
)
{
relname
=
strVal
(
lfirst
(
arg
));
if
(
IsSystemRelationName
(
relname
))
elog
(
WARN
,
"class
\"
%-.*s
\"
is a system catalog"
,
NAMEDATALEN
,
relname
);
#ifndef NO_SECURITY
if
(
!
pg_ownercheck
(
userName
,
relname
,
RELNAME
))
elog
(
WARN
,
"you do not own class
\"
%-.*s
\"
"
,
NAMEDATALEN
,
relname
);
if
(
!
pg_ownercheck
(
userName
,
relname
,
RELNAME
))
elog
(
WARN
,
"you do not own class
\"
%-.*s
\"
"
,
NAMEDATALEN
,
relname
);
#endif
}
foreach
(
arg
,
args
)
{
relname
=
strVal
(
lfirst
(
arg
));
RemoveRelation
(
relname
);
}
}
break
;
}
foreach
(
arg
,
args
)
{
relname
=
strVal
(
lfirst
(
arg
));
RemoveRelation
(
relname
);
}
}
break
;
case
T_PurgeStmt
:
{
PurgeStmt
*
stmt
=
(
PurgeStmt
*
)
parsetree
;
commandTag
=
"PURGE"
;
CHECK_IF_ABORTED
();
RelationPurge
(
stmt
->
relname
,
stmt
->
beforeDate
,
/* absolute time string */
stmt
->
afterDate
);
/* relative time string */
}
break
;
{
PurgeStmt
*
stmt
=
(
PurgeStmt
*
)
parsetree
;
commandTag
=
"PURGE"
;
CHECK_IF_ABORTED
();
RelationPurge
(
stmt
->
relname
,
stmt
->
beforeDate
,
/* absolute time string */
stmt
->
afterDate
);
/* relative time string */
}
break
;
case
T_CopyStmt
:
{
CopyStmt
*
stmt
=
(
CopyStmt
*
)
parsetree
;
char
*
filename
;
char
*
delim
;
bool
isBinary
;
bool
isOids
;
bool
isFrom
;
bool
pipe
=
false
;
{
CopyStmt
*
stmt
=
(
CopyStmt
*
)
parsetree
;
commandTag
=
"COPY"
;
CHECK_IF_ABORTED
();
relname
=
stmt
->
relname
;
isBinary
=
stmt
->
binary
;
isOids
=
stmt
->
oids
;
isFrom
=
(
bool
)(
stmt
->
direction
==
FROM
);
filename
=
stmt
->
filename
;
delim
=
stmt
->
delimiter
;
#ifndef NO_SECURITY
if
(
isFrom
)
{
if
(
!
pg_aclcheck
(
relname
,
userName
,
ACL_RD
))
elog
(
WARN
,
"%s %s"
,
relname
,
ACL_NO_PRIV_WARNING
);
}
else
{
if
(
!
pg_aclcheck
(
relname
,
userName
,
ACL_WR
))
elog
(
WARN
,
"%s %s"
,
relname
,
ACL_NO_PRIV_WARNING
);
}
#endif
/* Free up file descriptors - going to do a read... */
closeOneVfd
();
/*
* use stdin/stdout if filename is null.
*/
if
(
filename
==
NULL
)
pipe
=
true
;
if
(
pipe
&&
IsUnderPostmaster
)
dest
=
CopyEnd
;
DoCopy
(
relname
,
isBinary
,
isOids
,
isFrom
,
pipe
,
filename
,
delim
);
DoCopy
(
stmt
->
relname
,
stmt
->
binary
,
stmt
->
oids
,
(
bool
)(
stmt
->
direction
==
FROM
),
(
bool
)(
stmt
->
filename
==
NULL
),
/* null filename means copy to/from stdout/stdin,
rather than to/from a file.
*/
stmt
->
filename
,
stmt
->
delimiter
);
}
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录