Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
87d00363
Commit
87d00363
authored
Apr 18, 2002
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make PUBLIC an unreserved word (in fact, not a keyword at all),
per previous discussion.
parent
b3120804
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
23 deletions
+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
No files found.
src/backend/commands/user.c
View file @
87d00363
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* 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)
datum
=
heap_getattr
(
tuple
,
Anum_pg_group_groname
,
dsc
,
&
isnull
);
if
(
isnull
)
continue
;
/* ignore NULL groupnames */
groname
=
(
char
*
)
DatumGetName
(
datum
);
groname
=
NameStr
(
*
DatumGetName
(
datum
)
);
grolist_datum
=
heap_getattr
(
tuple
,
Anum_pg_group_grolist
,
dsc
,
&
isnull
);
/* Ignore NULL group lists */
...
...
@@ -293,7 +293,7 @@ write_user_file(Relation urel)
datum
=
heap_getattr
(
tuple
,
Anum_pg_shadow_usename
,
dsc
,
&
isnull
);
if
(
isnull
)
continue
;
/* ignore NULL usernames */
usename
=
(
char
*
)
DatumGetName
(
datum
);
usename
=
NameStr
(
*
DatumGetName
(
datum
)
);
datum
=
heap_getattr
(
tuple
,
Anum_pg_shadow_passwd
,
dsc
,
&
isnull
);
...
...
@@ -498,6 +498,10 @@ CreateUser(CreateUserStmt *stmt)
if
(
!
superuser
())
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
* already exist. Note we secure exclusive lock, because we also need
...
...
@@ -518,7 +522,7 @@ CreateUser(CreateUserStmt *stmt)
datum
=
heap_getattr
(
tuple
,
Anum_pg_shadow_usename
,
pg_shadow_dsc
,
&
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
,
pg_shadow_dsc
,
&
null
);
...
...
@@ -1027,7 +1031,7 @@ DropUser(DropUserStmt *stmt)
datum
=
heap_getattr
(
tmp_tuple
,
Anum_pg_database_datname
,
pg_dsc
,
&
null
);
Assert
(
!
null
);
dbname
=
(
char
*
)
DatumGetName
(
datum
);
dbname
=
NameStr
(
*
DatumGetName
(
datum
)
);
elog
(
ERROR
,
"DROP USER: user
\"
%s
\"
owns database
\"
%s
\"
, cannot be removed%s"
,
user
,
dbname
,
(
length
(
stmt
->
users
)
>
1
)
?
" (no users removed)"
:
""
);
...
...
@@ -1186,6 +1190,10 @@ CreateGroup(CreateGroupStmt *stmt)
if
(
!
superuser
())
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_dsc
=
RelationGetDescr
(
pg_group_rel
);
...
...
@@ -1200,7 +1208,7 @@ CreateGroup(CreateGroupStmt *stmt)
datum
=
heap_getattr
(
tuple
,
Anum_pg_group_groname
,
pg_group_dsc
,
&
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
,
pg_group_dsc
,
&
null
);
...
...
@@ -1597,7 +1605,7 @@ DropGroup(DropGroupStmt *stmt)
datum
=
heap_getattr
(
tuple
,
Anum_pg_group_groname
,
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
;
simple_heap_delete
(
pg_group_rel
,
&
tuple
->
t_self
);
...
...
src/backend/parser/gram.y
View file @
87d00363
...
...
@@ -11,7 +11,7 @@
*
*
* 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
* AUTHOR DATE MAJOR EVENT
...
...
@@ -330,7 +330,7 @@ static bool set_name_needs_quotes(const char *name);
MATCH, MINUTE_P, MONTH_P, NAMES,
NATIONAL, NATURAL, NCHAR, NEXT, NO, NOT, NULLIF, NULL_P, NUMERIC,
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,
SCHEMA, SCROLL, SECOND_P, SELECT, SESSION, SESSION_USER, SET, SOME, SUBSTRING,
TABLE, TEMPORARY, THEN, TIME, TIMESTAMP,
...
...
@@ -2532,25 +2532,26 @@ grantee_list: grantee { $$ = makeList1($1); }
| grantee_list ',' grantee { $$ = lappend($1, $3); }
;
grantee:
PUBLIC
grantee:
ColId
{
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;
$$ = (Node *)n;
}
| GROUP ColId
{
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->groupname = $2;
$$ = (Node *)n;
}
| ColId
{
PrivGrantee *n = makeNode(PrivGrantee);
n->username = $1;
n->groupname = NULL;
$$ = (Node *)n;
}
;
...
...
@@ -6112,7 +6113,7 @@ unreserved_keyword:
| STATISTICS { $$ = "statistics"; }
| STDIN { $$ = "stdin"; }
| STDOUT { $$ = "stdout"; }
| STORAGE
{ $$ = "storage"; }
| STORAGE
{ $$ = "storage"; }
| SYSID { $$ = "sysid"; }
| TEMP { $$ = "temp"; }
| TEMPLATE { $$ = "template"; }
...
...
@@ -6205,7 +6206,6 @@ func_name_keyword:
| NOTNULL { $$ = "notnull"; }
| OUTER_P { $$ = "outer"; }
| OVERLAPS { $$ = "overlaps"; }
| PUBLIC { $$ = "public"; }
| RIGHT { $$ = "right"; }
| VERBOSE { $$ = "verbose"; }
;
...
...
src/backend/parser/keywords.c
View file @
87d00363
...
...
@@ -8,7 +8,7 @@
*
*
* 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[] = {
{
"privileges"
,
PRIVILEGES
},
{
"procedural"
,
PROCEDURAL
},
{
"procedure"
,
PROCEDURE
},
{
"public"
,
PUBLIC
},
{
"read"
,
READ
},
{
"references"
,
REFERENCES
},
{
"reindex"
,
REINDEX
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment