Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
87d00363
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,发现更多精彩内容 >>
提交
87d00363
编写于
4月 18, 2002
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make PUBLIC an unreserved word (in fact, not a keyword at all),
per previous discussion.
上级
b3120804
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
23 deletion
+30
-23
src/backend/commands/user.c
src/backend/commands/user.c
+15
-7
src/backend/parser/gram.y
src/backend/parser/gram.y
+14
-14
src/backend/parser/keywords.c
src/backend/parser/keywords.c
+1
-2
未找到文件。
src/backend/commands/user.c
浏览文件 @
87d00363
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.9
5 2002/04/04 04:25:45 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.9
6 2002/04/18 21:16:16 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -153,7 +153,7 @@ write_group_file(Relation urel, Relation grel)
...
@@ -153,7 +153,7 @@ write_group_file(Relation urel, Relation grel)
datum
=
heap_getattr
(
tuple
,
Anum_pg_group_groname
,
dsc
,
&
isnull
);
datum
=
heap_getattr
(
tuple
,
Anum_pg_group_groname
,
dsc
,
&
isnull
);
if
(
isnull
)
if
(
isnull
)
continue
;
/* ignore NULL groupnames */
continue
;
/* ignore NULL groupnames */
groname
=
(
char
*
)
DatumGetName
(
datum
);
groname
=
NameStr
(
*
DatumGetName
(
datum
)
);
grolist_datum
=
heap_getattr
(
tuple
,
Anum_pg_group_grolist
,
dsc
,
&
isnull
);
grolist_datum
=
heap_getattr
(
tuple
,
Anum_pg_group_grolist
,
dsc
,
&
isnull
);
/* Ignore NULL group lists */
/* Ignore NULL group lists */
...
@@ -293,7 +293,7 @@ write_user_file(Relation urel)
...
@@ -293,7 +293,7 @@ write_user_file(Relation urel)
datum
=
heap_getattr
(
tuple
,
Anum_pg_shadow_usename
,
dsc
,
&
isnull
);
datum
=
heap_getattr
(
tuple
,
Anum_pg_shadow_usename
,
dsc
,
&
isnull
);
if
(
isnull
)
if
(
isnull
)
continue
;
/* ignore NULL usernames */
continue
;
/* ignore NULL usernames */
usename
=
(
char
*
)
DatumGetName
(
datum
);
usename
=
NameStr
(
*
DatumGetName
(
datum
)
);
datum
=
heap_getattr
(
tuple
,
Anum_pg_shadow_passwd
,
dsc
,
&
isnull
);
datum
=
heap_getattr
(
tuple
,
Anum_pg_shadow_passwd
,
dsc
,
&
isnull
);
...
@@ -498,6 +498,10 @@ CreateUser(CreateUserStmt *stmt)
...
@@ -498,6 +498,10 @@ CreateUser(CreateUserStmt *stmt)
if
(
!
superuser
())
if
(
!
superuser
())
elog
(
ERROR
,
"CREATE USER: permission denied"
);
elog
(
ERROR
,
"CREATE USER: permission denied"
);
if
(
strcmp
(
stmt
->
user
,
"public"
)
==
0
)
elog
(
ERROR
,
"CREATE USER: user name
\"
%s
\"
is reserved"
,
stmt
->
user
);
/*
/*
* Scan the pg_shadow relation to be certain the user or id doesn't
* Scan the pg_shadow relation to be certain the user or id doesn't
* already exist. Note we secure exclusive lock, because we also need
* already exist. Note we secure exclusive lock, because we also need
...
@@ -518,7 +522,7 @@ CreateUser(CreateUserStmt *stmt)
...
@@ -518,7 +522,7 @@ CreateUser(CreateUserStmt *stmt)
datum
=
heap_getattr
(
tuple
,
Anum_pg_shadow_usename
,
datum
=
heap_getattr
(
tuple
,
Anum_pg_shadow_usename
,
pg_shadow_dsc
,
&
null
);
pg_shadow_dsc
,
&
null
);
Assert
(
!
null
);
Assert
(
!
null
);
user_exists
=
(
strcmp
(
(
char
*
)
DatumGetName
(
datum
),
stmt
->
user
)
==
0
);
user_exists
=
(
strcmp
(
NameStr
(
*
DatumGetName
(
datum
)
),
stmt
->
user
)
==
0
);
datum
=
heap_getattr
(
tuple
,
Anum_pg_shadow_usesysid
,
datum
=
heap_getattr
(
tuple
,
Anum_pg_shadow_usesysid
,
pg_shadow_dsc
,
&
null
);
pg_shadow_dsc
,
&
null
);
...
@@ -1027,7 +1031,7 @@ DropUser(DropUserStmt *stmt)
...
@@ -1027,7 +1031,7 @@ DropUser(DropUserStmt *stmt)
datum
=
heap_getattr
(
tmp_tuple
,
Anum_pg_database_datname
,
datum
=
heap_getattr
(
tmp_tuple
,
Anum_pg_database_datname
,
pg_dsc
,
&
null
);
pg_dsc
,
&
null
);
Assert
(
!
null
);
Assert
(
!
null
);
dbname
=
(
char
*
)
DatumGetName
(
datum
);
dbname
=
NameStr
(
*
DatumGetName
(
datum
)
);
elog
(
ERROR
,
"DROP USER: user
\"
%s
\"
owns database
\"
%s
\"
, cannot be removed%s"
,
elog
(
ERROR
,
"DROP USER: user
\"
%s
\"
owns database
\"
%s
\"
, cannot be removed%s"
,
user
,
dbname
,
user
,
dbname
,
(
length
(
stmt
->
users
)
>
1
)
?
" (no users removed)"
:
""
);
(
length
(
stmt
->
users
)
>
1
)
?
" (no users removed)"
:
""
);
...
@@ -1186,6 +1190,10 @@ CreateGroup(CreateGroupStmt *stmt)
...
@@ -1186,6 +1190,10 @@ CreateGroup(CreateGroupStmt *stmt)
if
(
!
superuser
())
if
(
!
superuser
())
elog
(
ERROR
,
"CREATE GROUP: permission denied"
);
elog
(
ERROR
,
"CREATE GROUP: permission denied"
);
if
(
strcmp
(
stmt
->
name
,
"public"
)
==
0
)
elog
(
ERROR
,
"CREATE GROUP: group name
\"
%s
\"
is reserved"
,
stmt
->
name
);
pg_group_rel
=
heap_openr
(
GroupRelationName
,
ExclusiveLock
);
pg_group_rel
=
heap_openr
(
GroupRelationName
,
ExclusiveLock
);
pg_group_dsc
=
RelationGetDescr
(
pg_group_rel
);
pg_group_dsc
=
RelationGetDescr
(
pg_group_rel
);
...
@@ -1200,7 +1208,7 @@ CreateGroup(CreateGroupStmt *stmt)
...
@@ -1200,7 +1208,7 @@ CreateGroup(CreateGroupStmt *stmt)
datum
=
heap_getattr
(
tuple
,
Anum_pg_group_groname
,
datum
=
heap_getattr
(
tuple
,
Anum_pg_group_groname
,
pg_group_dsc
,
&
null
);
pg_group_dsc
,
&
null
);
Assert
(
!
null
);
Assert
(
!
null
);
group_exists
=
(
strcmp
(
(
char
*
)
DatumGetName
(
datum
),
stmt
->
name
)
==
0
);
group_exists
=
(
strcmp
(
NameStr
(
*
DatumGetName
(
datum
)
),
stmt
->
name
)
==
0
);
datum
=
heap_getattr
(
tuple
,
Anum_pg_group_grosysid
,
datum
=
heap_getattr
(
tuple
,
Anum_pg_group_grosysid
,
pg_group_dsc
,
&
null
);
pg_group_dsc
,
&
null
);
...
@@ -1597,7 +1605,7 @@ DropGroup(DropGroupStmt *stmt)
...
@@ -1597,7 +1605,7 @@ DropGroup(DropGroupStmt *stmt)
datum
=
heap_getattr
(
tuple
,
Anum_pg_group_groname
,
datum
=
heap_getattr
(
tuple
,
Anum_pg_group_groname
,
pg_group_dsc
,
&
null
);
pg_group_dsc
,
&
null
);
if
(
!
null
&&
strcmp
(
(
char
*
)
DatumGetName
(
datum
),
stmt
->
name
)
==
0
)
if
(
!
null
&&
strcmp
(
NameStr
(
*
DatumGetName
(
datum
)
),
stmt
->
name
)
==
0
)
{
{
gro_exists
=
true
;
gro_exists
=
true
;
simple_heap_delete
(
pg_group_rel
,
&
tuple
->
t_self
);
simple_heap_delete
(
pg_group_rel
,
&
tuple
->
t_self
);
...
...
src/backend/parser/gram.y
浏览文件 @
87d00363
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.30
4 2002/04/18 20:01:09
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.30
5 2002/04/18 21:16:16
tgl Exp $
*
*
* HISTORY
* HISTORY
* AUTHOR DATE MAJOR EVENT
* AUTHOR DATE MAJOR EVENT
...
@@ -330,7 +330,7 @@ static bool set_name_needs_quotes(const char *name);
...
@@ -330,7 +330,7 @@ static bool set_name_needs_quotes(const char *name);
MATCH, MINUTE_P, MONTH_P, NAMES,
MATCH, MINUTE_P, MONTH_P, NAMES,
NATIONAL, NATURAL, NCHAR, NEXT, NO, NOT, NULLIF, NULL_P, NUMERIC,
NATIONAL, NATURAL, NCHAR, NEXT, NO, NOT, NULLIF, NULL_P, NUMERIC,
OF, OLD, ON, ONLY, OPTION, OR, ORDER, OUTER_P, OVERLAPS,
OF, OLD, ON, ONLY, OPTION, OR, ORDER, OUTER_P, OVERLAPS,
PARTIAL, POSITION, PRECISION, PRIMARY, PRIOR, PRIVILEGES, PROCEDURE,
PUBLIC,
PARTIAL, POSITION, PRECISION, PRIMARY, PRIOR, PRIVILEGES, PROCEDURE,
READ, REFERENCES, RELATIVE, REVOKE, RIGHT, ROLLBACK,
READ, REFERENCES, RELATIVE, REVOKE, RIGHT, ROLLBACK,
SCHEMA, SCROLL, SECOND_P, SELECT, SESSION, SESSION_USER, SET, SOME, SUBSTRING,
SCHEMA, SCROLL, SECOND_P, SELECT, SESSION, SESSION_USER, SET, SOME, SUBSTRING,
TABLE, TEMPORARY, THEN, TIME, TIMESTAMP,
TABLE, TEMPORARY, THEN, TIME, TIMESTAMP,
...
@@ -2532,25 +2532,26 @@ grantee_list: grantee { $$ = makeList1($1); }
...
@@ -2532,25 +2532,26 @@ grantee_list: grantee { $$ = makeList1($1); }
| grantee_list ',' grantee { $$ = lappend($1, $3); }
| grantee_list ',' grantee { $$ = lappend($1, $3); }
;
;
grantee:
PUBLIC
grantee:
ColId
{
{
PrivGrantee *n = makeNode(PrivGrantee);
PrivGrantee *n = makeNode(PrivGrantee);
n->username = NULL;
/* This hack lets us avoid reserving PUBLIC as a keyword */
if (strcmp($1, "public") == 0)
n->username = NULL;
else
n->username = $1;
n->groupname = NULL;
n->groupname = NULL;
$$ = (Node *)n;
$$ = (Node *)n;
}
}
| GROUP ColId
| GROUP ColId
{
{
PrivGrantee *n = makeNode(PrivGrantee);
PrivGrantee *n = makeNode(PrivGrantee);
/* Treat GROUP PUBLIC as a synonym for PUBLIC */
if (strcmp($2, "public") == 0)
n->groupname = NULL;
else
n->groupname = $2;
n->username = NULL;
n->username = NULL;
n->groupname = $2;
$$ = (Node *)n;
}
| ColId
{
PrivGrantee *n = makeNode(PrivGrantee);
n->username = $1;
n->groupname = NULL;
$$ = (Node *)n;
$$ = (Node *)n;
}
}
;
;
...
@@ -6112,7 +6113,7 @@ unreserved_keyword:
...
@@ -6112,7 +6113,7 @@ unreserved_keyword:
| STATISTICS { $$ = "statistics"; }
| STATISTICS { $$ = "statistics"; }
| STDIN { $$ = "stdin"; }
| STDIN { $$ = "stdin"; }
| STDOUT { $$ = "stdout"; }
| STDOUT { $$ = "stdout"; }
| STORAGE
{ $$ = "storage"; }
| STORAGE
{ $$ = "storage"; }
| SYSID { $$ = "sysid"; }
| SYSID { $$ = "sysid"; }
| TEMP { $$ = "temp"; }
| TEMP { $$ = "temp"; }
| TEMPLATE { $$ = "template"; }
| TEMPLATE { $$ = "template"; }
...
@@ -6205,7 +6206,6 @@ func_name_keyword:
...
@@ -6205,7 +6206,6 @@ func_name_keyword:
| NOTNULL { $$ = "notnull"; }
| NOTNULL { $$ = "notnull"; }
| OUTER_P { $$ = "outer"; }
| OUTER_P { $$ = "outer"; }
| OVERLAPS { $$ = "overlaps"; }
| OVERLAPS { $$ = "overlaps"; }
| PUBLIC { $$ = "public"; }
| RIGHT { $$ = "right"; }
| RIGHT { $$ = "right"; }
| VERBOSE { $$ = "verbose"; }
| VERBOSE { $$ = "verbose"; }
;
;
...
...
src/backend/parser/keywords.c
浏览文件 @
87d00363
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.10
4 2002/03/19 02:18:19 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.10
5 2002/04/18 21:16:16 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -211,7 +211,6 @@ static ScanKeyword ScanKeywords[] = {
...
@@ -211,7 +211,6 @@ static ScanKeyword ScanKeywords[] = {
{
"privileges"
,
PRIVILEGES
},
{
"privileges"
,
PRIVILEGES
},
{
"procedural"
,
PROCEDURAL
},
{
"procedural"
,
PROCEDURAL
},
{
"procedure"
,
PROCEDURE
},
{
"procedure"
,
PROCEDURE
},
{
"public"
,
PUBLIC
},
{
"read"
,
READ
},
{
"read"
,
READ
},
{
"references"
,
REFERENCES
},
{
"references"
,
REFERENCES
},
{
"reindex"
,
REINDEX
},
{
"reindex"
,
REINDEX
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录