Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
9bccdf17
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,发现更多精彩内容 >>
提交
9bccdf17
编写于
8月 11, 2002
作者:
P
Peter Eisentraut
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Create/drop cast now requires ownership of at least one of the types.
上级
014a86ac
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
47 deletion
+19
-47
doc/src/sgml/ref/create_cast.sgml
doc/src/sgml/ref/create_cast.sgml
+3
-9
doc/src/sgml/ref/drop_cast.sgml
doc/src/sgml/ref/drop_cast.sgml
+4
-10
src/backend/commands/functioncmds.c
src/backend/commands/functioncmds.c
+12
-28
未找到文件。
doc/src/sgml/ref/create_cast.sgml
浏览文件 @
9bccdf17
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_cast.sgml,v 1.
1 2002/07/18 23:11:27
petere Exp $ -->
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_cast.sgml,v 1.
2 2002/08/11 17:44:12
petere Exp $ -->
<refentry id="SQL-CREATECAST">
<refmeta>
...
...
@@ -81,9 +81,8 @@ INSERT INTO foo(f1) VALUES(42);
</para>
<para>
To be able to create a cast, you must own the underlying function.
To be able to create a binary compatible cast, you must own both
the source and the target data type.
To be able to create a cast, you must own the source or the target
data type.
</para>
<variablelist>
...
...
@@ -154,11 +153,6 @@ INSERT INTO foo(f1) VALUES(42);
Use <command>DROP CAST</command> to remove user-defined casts.
</para>
<para>
The privileges required to create a cast may be changed in a future
release.
</para>
<para>
Remember that if you want to be able to convert types both ways you
need to declare casts both ways explicitly.
...
...
doc/src/sgml/ref/drop_cast.sgml
浏览文件 @
9bccdf17
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_cast.sgml,v 1.
1 2002/07/18 23:11:27
petere Exp $ -->
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_cast.sgml,v 1.
2 2002/08/11 17:44:12
petere Exp $ -->
<refentry id="SQL-DROPCAST">
<refmeta>
...
...
@@ -26,10 +26,9 @@ DROP CAST (<replaceable>sourcetype</replaceable> AS <replaceable>targettype</rep
</para>
<para>
To be able to drop a cast, you must own the underlying function.
To be able to drop a binary compatible cast, you must own both the
source and the target data type. These are the same privileges
that are required to create a cast.
To be able to drop a cast, you must own the source or the target
data type. These are the same privileges that are required to
create a cast.
</para>
<variablelist>
...
...
@@ -76,11 +75,6 @@ DROP CAST (<replaceable>sourcetype</replaceable> AS <replaceable>targettype</rep
<para>
Use <command>CREATE CAST</command> to create user-defined casts.
</para>
<para>
The privileges required to drop a cast may be changed in a future
release.
</para>
</refsect1>
...
...
src/backend/commands/functioncmds.c
浏览文件 @
9bccdf17
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.1
6 2002/08/05 03:29:16 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.1
7 2002/08/11 17:44:12 petere
Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
...
...
@@ -621,6 +621,12 @@ CreateCast(CreateCastStmt *stmt)
if
(
sourcetypeid
==
targettypeid
)
elog
(
ERROR
,
"source data type and target data type are the same"
);
if
(
!
pg_type_ownercheck
(
sourcetypeid
,
GetUserId
())
&&
!
pg_type_ownercheck
(
targettypeid
,
GetUserId
()))
elog
(
ERROR
,
"must be owner of type %s or type %s"
,
TypeNameToString
(
stmt
->
sourcetype
),
TypeNameToString
(
stmt
->
targettype
));
relation
=
heap_openr
(
CastRelationName
,
RowExclusiveLock
);
tuple
=
SearchSysCache
(
CASTSOURCETARGET
,
...
...
@@ -639,10 +645,6 @@ CreateCast(CreateCastStmt *stmt)
false
,
"CreateCast"
);
if
(
!
pg_proc_ownercheck
(
funcid
,
GetUserId
()))
aclcheck_error
(
ACLCHECK_NOT_OWNER
,
NameListToString
(
stmt
->
func
->
funcname
));
tuple
=
SearchSysCache
(
PROCOID
,
ObjectIdGetDatum
(
funcid
),
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
tuple
))
elog
(
ERROR
,
"cache lookup of function %u failed"
,
funcid
);
...
...
@@ -666,12 +668,6 @@ CreateCast(CreateCastStmt *stmt)
else
{
/* indicates binary compatibility */
if
(
!
pg_type_ownercheck
(
sourcetypeid
,
GetUserId
()))
aclcheck_error
(
ACLCHECK_NOT_OWNER
,
TypeNameToString
(
stmt
->
sourcetype
));
if
(
!
pg_type_ownercheck
(
targettypeid
,
GetUserId
()))
aclcheck_error
(
ACLCHECK_NOT_OWNER
,
TypeNameToString
(
stmt
->
targettype
));
funcid
=
InvalidOid
;
}
...
...
@@ -730,7 +726,6 @@ DropCast(DropCastStmt *stmt)
Oid
sourcetypeid
;
Oid
targettypeid
;
HeapTuple
tuple
;
Form_pg_cast
caststruct
;
ObjectAddress
object
;
sourcetypeid
=
LookupTypeName
(
stmt
->
sourcetype
);
...
...
@@ -753,22 +748,11 @@ DropCast(DropCastStmt *stmt)
TypeNameToString
(
stmt
->
targettype
));
/* Permission check */
caststruct
=
(
Form_pg_cast
)
GETSTRUCT
(
tuple
);
if
(
caststruct
->
castfunc
!=
InvalidOid
)
{
if
(
!
pg_proc_ownercheck
(
caststruct
->
castfunc
,
GetUserId
()))
aclcheck_error
(
ACLCHECK_NOT_OWNER
,
get_func_name
(
caststruct
->
castfunc
));
}
else
{
if
(
!
pg_type_ownercheck
(
sourcetypeid
,
GetUserId
()))
aclcheck_error
(
ACLCHECK_NOT_OWNER
,
format_type_be
(
sourcetypeid
));
if
(
!
pg_type_ownercheck
(
targettypeid
,
GetUserId
()))
aclcheck_error
(
ACLCHECK_NOT_OWNER
,
format_type_be
(
targettypeid
));
}
if
(
!
pg_type_ownercheck
(
sourcetypeid
,
GetUserId
())
&&
!
pg_type_ownercheck
(
targettypeid
,
GetUserId
()))
elog
(
ERROR
,
"must be owner of type %s or type %s"
,
TypeNameToString
(
stmt
->
sourcetype
),
TypeNameToString
(
stmt
->
targettype
));
/*
* Do the deletion
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录