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
3284758a
Commit
3284758a
authored
Jul 12, 2001
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove grammar restrictions on order of optional clauses in CREATE GROUP.
From Vince Vielhaber.
parent
5c4d1398
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
126 additions
and
81 deletions
+126
-81
doc/src/sgml/ref/create_group.sgml
doc/src/sgml/ref/create_group.sgml
+7
-5
src/backend/commands/user.c
src/backend/commands/user.c
+50
-18
src/backend/nodes/copyfuncs.c
src/backend/nodes/copyfuncs.c
+2
-4
src/backend/nodes/equalfuncs.c
src/backend/nodes/equalfuncs.c
+2
-6
src/backend/parser/gram.y
src/backend/parser/gram.y
+43
-33
src/include/nodes/parsenodes.h
src/include/nodes/parsenodes.h
+2
-4
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/preproc.y
+20
-11
No files found.
doc/src/sgml/ref/create_group.sgml
View file @
3284758a
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_group.sgml,v 1.
2 2000/03/27 17:14:42 thomas
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_group.sgml,v 1.
3 2001/07/12 18:02:58 tgl
Exp $
Postgres documentation
Postgres documentation
-->
-->
...
@@ -23,10 +23,12 @@ Postgres documentation
...
@@ -23,10 +23,12 @@ Postgres documentation
<date>2000-01-14</date>
<date>2000-01-14</date>
</refsynopsisdivinfo>
</refsynopsisdivinfo>
<synopsis>
<synopsis>
CREATE GROUP <replaceable class="PARAMETER">name</replaceable>
CREATE GROUP <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ]
[ WITH
[ SYSID <replaceable class="PARAMETER">gid</replaceable> ]
where <replaceable class="PARAMETER">option</replaceable> can be:
[ USER <replaceable class="PARAMETER">username</replaceable> [, ...] ] ]
SYSID <replaceable class="PARAMETER">gid</replaceable>
| USER <replaceable class="PARAMETER">username</replaceable> [, ...]
</synopsis>
</synopsis>
<refsect2 id="R2-SQL-CREATEGROUP-1">
<refsect2 id="R2-SQL-CREATEGROUP-1">
...
...
src/backend/commands/user.c
View file @
3284758a
...
@@ -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.7
8 2001/07/10 22:09:28
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.7
9 2001/07/12 18:02:59
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -787,13 +787,47 @@ CreateGroup(CreateGroupStmt *stmt)
...
@@ -787,13 +787,47 @@ CreateGroup(CreateGroupStmt *stmt)
HeapTuple
tuple
;
HeapTuple
tuple
;
TupleDesc
pg_group_dsc
;
TupleDesc
pg_group_dsc
;
bool
group_exists
=
false
,
bool
group_exists
=
false
,
sysid_exists
=
false
;
sysid_exists
=
false
,
havesysid
=
false
;
int
max_id
=
0
;
int
max_id
=
0
;
Datum
new_record
[
Natts_pg_group
];
Datum
new_record
[
Natts_pg_group
];
char
new_record_nulls
[
Natts_pg_group
];
char
new_record_nulls
[
Natts_pg_group
];
List
*
item
,
List
*
item
,
*
newlist
=
NULL
;
*
option
,
*
newlist
=
NIL
;
ArrayType
*
userarray
;
ArrayType
*
userarray
;
int
sysid
=
0
;
List
*
userElts
=
NIL
;
DefElem
*
dsysid
=
NULL
;
DefElem
*
duserElts
=
NULL
;
foreach
(
option
,
stmt
->
options
)
{
DefElem
*
defel
=
(
DefElem
*
)
lfirst
(
option
);
if
(
strcasecmp
(
defel
->
defname
,
"sysid"
)
==
0
)
{
if
(
dsysid
)
elog
(
ERROR
,
"CREATE GROUP: conflicting options"
);
dsysid
=
defel
;
}
else
if
(
strcasecmp
(
defel
->
defname
,
"userElts"
)
==
0
)
{
if
(
duserElts
)
elog
(
ERROR
,
"CREATE GROUP: conflicting options"
);
duserElts
=
defel
;
}
else
elog
(
ERROR
,
"CREATE GROUP: option
\"
%s
\"
not recognized"
,
defel
->
defname
);
}
if
(
dsysid
)
{
sysid
=
intVal
(
dsysid
->
arg
);
havesysid
=
true
;
}
if
(
duserElts
)
userElts
=
(
List
*
)
duserElts
->
arg
;
/*
/*
* Make sure the user can do this.
* Make sure the user can do this.
...
@@ -819,8 +853,8 @@ CreateGroup(CreateGroupStmt *stmt)
...
@@ -819,8 +853,8 @@ CreateGroup(CreateGroupStmt *stmt)
datum
=
heap_getattr
(
tuple
,
Anum_pg_group_grosysid
,
datum
=
heap_getattr
(
tuple
,
Anum_pg_group_grosysid
,
pg_group_dsc
,
&
null
);
pg_group_dsc
,
&
null
);
Assert
(
!
null
);
Assert
(
!
null
);
if
(
stmt
->
sysid
>=
0
)
/* customized id wanted */
if
(
havesysid
)
/* customized id wanted */
sysid_exists
=
(
DatumGetInt32
(
datum
)
==
s
tmt
->
s
ysid
);
sysid_exists
=
(
DatumGetInt32
(
datum
)
==
sysid
);
else
else
{
{
/* pick 1 + max */
/* pick 1 + max */
...
@@ -835,19 +869,19 @@ CreateGroup(CreateGroupStmt *stmt)
...
@@ -835,19 +869,19 @@ CreateGroup(CreateGroupStmt *stmt)
stmt
->
name
);
stmt
->
name
);
if
(
sysid_exists
)
if
(
sysid_exists
)
elog
(
ERROR
,
"CREATE GROUP: group sysid %d is already assigned"
,
elog
(
ERROR
,
"CREATE GROUP: group sysid %d is already assigned"
,
s
tmt
->
s
ysid
);
sysid
);
/*
/*
* Translate the given user names to ids
* Translate the given user names to ids
*/
*/
foreach
(
item
,
stmt
->
initUser
s
)
foreach
(
item
,
userElt
s
)
{
{
const
char
*
groupuser
=
strVal
(
lfirst
(
item
));
const
char
*
groupuser
=
strVal
(
lfirst
(
item
));
Value
*
v
;
Value
*
v
;
v
=
makeInteger
(
get_usesysid
(
groupuser
));
v
=
makeInteger
(
get_usesysid
(
groupuser
));
if
(
!
member
(
v
,
newlist
))
if
(
!
member
(
v
,
newlist
))
newlist
=
l
cons
(
v
,
newlist
);
newlist
=
l
append
(
newlist
,
v
);
}
}
/* build an array to insert */
/* build an array to insert */
...
@@ -872,14 +906,12 @@ CreateGroup(CreateGroupStmt *stmt)
...
@@ -872,14 +906,12 @@ CreateGroup(CreateGroupStmt *stmt)
/*
/*
* Form a tuple to insert
* Form a tuple to insert
*/
*/
if
(
stmt
->
sysid
>=
0
)
if
(
!
havesysid
)
max_id
=
stmt
->
sysid
;
sysid
=
max_id
+
1
;
else
max_id
++
;
new_record
[
Anum_pg_group_groname
-
1
]
=
new_record
[
Anum_pg_group_groname
-
1
]
=
DirectFunctionCall1
(
namein
,
CStringGetDatum
(
stmt
->
name
));
DirectFunctionCall1
(
namein
,
CStringGetDatum
(
stmt
->
name
));
new_record
[
Anum_pg_group_grosysid
-
1
]
=
Int32GetDatum
(
max_
id
);
new_record
[
Anum_pg_group_grosysid
-
1
]
=
Int32GetDatum
(
sys
id
);
new_record
[
Anum_pg_group_grolist
-
1
]
=
PointerGetDatum
(
userarray
);
new_record
[
Anum_pg_group_grolist
-
1
]
=
PointerGetDatum
(
userarray
);
new_record_nulls
[
Anum_pg_group_groname
-
1
]
=
' '
;
new_record_nulls
[
Anum_pg_group_groname
-
1
]
=
' '
;
...
@@ -952,7 +984,7 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
...
@@ -952,7 +984,7 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
char
new_record_nulls
[
Natts_pg_group
];
char
new_record_nulls
[
Natts_pg_group
];
ArrayType
*
newarray
,
ArrayType
*
newarray
,
*
oldarray
;
*
oldarray
;
List
*
newlist
=
N
UL
L
,
List
*
newlist
=
N
I
L
,
*
item
;
*
item
;
HeapTuple
tuple
;
HeapTuple
tuple
;
bool
null
=
false
;
bool
null
=
false
;
...
@@ -976,7 +1008,7 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
...
@@ -976,7 +1008,7 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
v
=
makeInteger
(
arrval
);
v
=
makeInteger
(
arrval
);
/* filter out duplicates */
/* filter out duplicates */
if
(
!
member
(
v
,
newlist
))
if
(
!
member
(
v
,
newlist
))
newlist
=
l
cons
(
v
,
newlist
);
newlist
=
l
append
(
newlist
,
v
);
}
}
/*
/*
...
@@ -1007,7 +1039,7 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
...
@@ -1007,7 +1039,7 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
}
}
if
(
!
member
(
v
,
newlist
))
if
(
!
member
(
v
,
newlist
))
newlist
=
l
cons
(
v
,
newlist
);
newlist
=
l
append
(
newlist
,
v
);
else
else
/*
/*
* we silently assume here that this error will only come
* we silently assume here that this error will only come
...
@@ -1074,7 +1106,7 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
...
@@ -1074,7 +1106,7 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
char
new_record_nulls
[
Natts_pg_group
];
char
new_record_nulls
[
Natts_pg_group
];
ArrayType
*
oldarray
,
ArrayType
*
oldarray
,
*
newarray
;
*
newarray
;
List
*
newlist
=
N
UL
L
,
List
*
newlist
=
N
I
L
,
*
item
;
*
item
;
int
i
;
int
i
;
...
@@ -1094,7 +1126,7 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
...
@@ -1094,7 +1126,7 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
v
=
makeInteger
(
arrval
);
v
=
makeInteger
(
arrval
);
/* filter out duplicates */
/* filter out duplicates */
if
(
!
member
(
v
,
newlist
))
if
(
!
member
(
v
,
newlist
))
newlist
=
l
cons
(
v
,
newlist
);
newlist
=
l
append
(
newlist
,
v
);
}
}
/*
/*
...
...
src/backend/nodes/copyfuncs.c
View file @
3284758a
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.14
6 2001/07/10 22:09:28
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.14
7 2001/07/12 18:02:59
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -2462,8 +2462,7 @@ _copyCreateGroupStmt(CreateGroupStmt *from)
...
@@ -2462,8 +2462,7 @@ _copyCreateGroupStmt(CreateGroupStmt *from)
if
(
from
->
name
)
if
(
from
->
name
)
newnode
->
name
=
pstrdup
(
from
->
name
);
newnode
->
name
=
pstrdup
(
from
->
name
);
newnode
->
sysid
=
from
->
sysid
;
Node_Copy
(
from
,
newnode
,
options
);
Node_Copy
(
from
,
newnode
,
initUsers
);
return
newnode
;
return
newnode
;
}
}
...
@@ -2476,7 +2475,6 @@ _copyAlterGroupStmt(AlterGroupStmt *from)
...
@@ -2476,7 +2475,6 @@ _copyAlterGroupStmt(AlterGroupStmt *from)
if
(
from
->
name
)
if
(
from
->
name
)
newnode
->
name
=
pstrdup
(
from
->
name
);
newnode
->
name
=
pstrdup
(
from
->
name
);
newnode
->
action
=
from
->
action
;
newnode
->
action
=
from
->
action
;
newnode
->
sysid
=
from
->
sysid
;
Node_Copy
(
from
,
newnode
,
listUsers
);
Node_Copy
(
from
,
newnode
,
listUsers
);
return
newnode
;
return
newnode
;
...
...
src/backend/nodes/equalfuncs.c
View file @
3284758a
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.9
4 2001/07/10 22:09:28
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.9
5 2001/07/12 18:02:59
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -1320,9 +1320,7 @@ _equalCreateGroupStmt(CreateGroupStmt *a, CreateGroupStmt *b)
...
@@ -1320,9 +1320,7 @@ _equalCreateGroupStmt(CreateGroupStmt *a, CreateGroupStmt *b)
{
{
if
(
!
equalstr
(
a
->
name
,
b
->
name
))
if
(
!
equalstr
(
a
->
name
,
b
->
name
))
return
false
;
return
false
;
if
(
a
->
sysid
!=
b
->
sysid
)
if
(
!
equal
(
a
->
options
,
b
->
options
))
return
false
;
if
(
!
equal
(
a
->
initUsers
,
b
->
initUsers
))
return
false
;
return
false
;
return
true
;
return
true
;
...
@@ -1335,8 +1333,6 @@ _equalAlterGroupStmt(AlterGroupStmt *a, AlterGroupStmt *b)
...
@@ -1335,8 +1333,6 @@ _equalAlterGroupStmt(AlterGroupStmt *a, AlterGroupStmt *b)
return
false
;
return
false
;
if
(
a
->
action
!=
b
->
action
)
if
(
a
->
action
!=
b
->
action
)
return
false
;
return
false
;
if
(
a
->
sysid
!=
b
->
sysid
)
return
false
;
if
(
!
equal
(
a
->
listUsers
,
b
->
listUsers
))
if
(
!
equal
(
a
->
listUsers
,
b
->
listUsers
))
return
false
;
return
false
;
...
...
src/backend/parser/gram.y
View file @
3284758a
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.23
5 2001/07/10 22:09:28
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.23
6 2001/07/12 18:02:59
tgl Exp $
*
*
* HISTORY
* HISTORY
* AUTHOR DATE MAJOR EVENT
* AUTHOR DATE MAJOR EVENT
...
@@ -155,7 +155,10 @@ static void doNegateFloat(Value *v);
...
@@ -155,7 +155,10 @@ static void doNegateFloat(Value *v);
%type <ival> opt_lock, lock_type
%type <ival> opt_lock, lock_type
%type <boolean> opt_force
%type <boolean> opt_force
%type <list> user_list, users_in_new_group_clause
%type <list> user_list
%type <list> OptGroupList
%type <defelt> OptGroupElem
%type <list> OptUserList
%type <list> OptUserList
%type <defelt> OptUserElem
%type <defelt> OptUserElem
...
@@ -489,19 +492,19 @@ stmt : AlterSchemaStmt
...
@@ -489,19 +492,19 @@ stmt : AlterSchemaStmt
*****************************************************************************/
*****************************************************************************/
CreateUserStmt: CREATE USER UserId OptUserList
CreateUserStmt: CREATE USER UserId OptUserList
{
{
CreateUserStmt *n = makeNode(CreateUserStmt);
CreateUserStmt *n = makeNode(CreateUserStmt);
n->user = $3;
n->user = $3;
n->options = $4;
n->options = $4;
$$ = (Node *)n;
$$ = (Node *)n;
}
}
| CREATE USER UserId WITH OptUserList
| CREATE USER UserId WITH OptUserList
{
{
CreateUserStmt *n = makeNode(CreateUserStmt);
CreateUserStmt *n = makeNode(CreateUserStmt);
n->user = $3;
n->user = $3;
n->options = $5;
n->options = $5;
$$ = (Node *)n;
$$ = (Node *)n;
}
}
;
;
/*****************************************************************************
/*****************************************************************************
...
@@ -512,19 +515,19 @@ CreateUserStmt: CREATE USER UserId OptUserList
...
@@ -512,19 +515,19 @@ CreateUserStmt: CREATE USER UserId OptUserList
*****************************************************************************/
*****************************************************************************/
AlterUserStmt: ALTER USER UserId OptUserList
AlterUserStmt: ALTER USER UserId OptUserList
{
{
AlterUserStmt *n = makeNode(AlterUserStmt);
AlterUserStmt *n = makeNode(AlterUserStmt);
n->user = $3;
n->user = $3;
n->options = $4;
n->options = $4;
$$ = (Node *)n;
$$ = (Node *)n;
}
}
| ALTER USER UserId WITH OptUserList
| ALTER USER UserId WITH OptUserList
{
{
AlterUserStmt *n = makeNode(AlterUserStmt);
AlterUserStmt *n = makeNode(AlterUserStmt);
n->user = $3;
n->user = $3;
n->options = $5;
n->options = $5;
$$ = (Node *)n;
$$ = (Node *)n;
}
}
;
;
/*****************************************************************************
/*****************************************************************************
...
@@ -618,35 +621,43 @@ user_list: user_list ',' UserId
...
@@ -618,35 +621,43 @@ user_list: user_list ',' UserId
*
*
*****************************************************************************/
*****************************************************************************/
CreateGroupStmt: CREATE GROUP UserId
CreateGroupStmt: CREATE GROUP UserId
OptGroupList
{
{
CreateGroupStmt *n = makeNode(CreateGroupStmt);
CreateGroupStmt *n = makeNode(CreateGroupStmt);
n->name = $3;
n->name = $3;
n->sysid = -1;
n->options = $4;
n->initUsers = NIL;
$$ = (Node *)n;
$$ = (Node *)n;
}
}
| CREATE GROUP UserId WITH users_in_new_group_clause
| CREATE GROUP UserId WITH OptGroupList
{
{
CreateGroupStmt *n = makeNode(CreateGroupStmt);
CreateGroupStmt *n = makeNode(CreateGroupStmt);
n->name = $3;
n->name = $3;
n->sysid = -1;
n->options = $5;
n->initUsers = $5;
$$ = (Node *)n;
$$ = (Node *)n;
}
;
/*
* Options for CREATE GROUP
*/
OptGroupList: OptGroupList OptGroupElem { $$ = lappend($1, $2); }
| /* EMPTY */ { $$ = NIL; }
;
OptGroupElem: USER user_list
{
$$ = makeNode(DefElem);
$$->defname = "userElts";
$$->arg = (Node *)$2;
}
}
| CREATE GROUP UserId WITH SYSID Iconst users_in_new_group_clause
| SYSID Iconst
{
{
CreateGroupStmt *n = makeNode(CreateGroupStmt);
$$ = makeNode(DefElem);
n->name = $3;
$$->defname = "sysid";
n->sysid = $6;
$$->arg = (Node *)makeInteger($2);
n->initUsers = $7;
$$ = (Node *)n;
}
}
;
;
users_in_new_group_clause: USER user_list { $$ = $2; }
| /* EMPTY */ { $$ = NIL; }
;
/*****************************************************************************
/*****************************************************************************
*
*
...
@@ -659,7 +670,6 @@ AlterGroupStmt: ALTER GROUP UserId ADD USER user_list
...
@@ -659,7 +670,6 @@ AlterGroupStmt: ALTER GROUP UserId ADD USER user_list
{
{
AlterGroupStmt *n = makeNode(AlterGroupStmt);
AlterGroupStmt *n = makeNode(AlterGroupStmt);
n->name = $3;
n->name = $3;
n->sysid = -1;
n->action = +1;
n->action = +1;
n->listUsers = $6;
n->listUsers = $6;
$$ = (Node *)n;
$$ = (Node *)n;
...
@@ -668,13 +678,13 @@ AlterGroupStmt: ALTER GROUP UserId ADD USER user_list
...
@@ -668,13 +678,13 @@ AlterGroupStmt: ALTER GROUP UserId ADD USER user_list
{
{
AlterGroupStmt *n = makeNode(AlterGroupStmt);
AlterGroupStmt *n = makeNode(AlterGroupStmt);
n->name = $3;
n->name = $3;
n->sysid = -1;
n->action = -1;
n->action = -1;
n->listUsers = $6;
n->listUsers = $6;
$$ = (Node *)n;
$$ = (Node *)n;
}
}
;
;
/*****************************************************************************
/*****************************************************************************
*
*
* Drop a postgresql group
* Drop a postgresql group
...
...
src/include/nodes/parsenodes.h
View file @
3284758a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,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
*
*
* $Id: parsenodes.h,v 1.13
4 2001/07/10 22:09:29
tgl Exp $
* $Id: parsenodes.h,v 1.13
5 2001/07/12 18:03:00
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -365,8 +365,7 @@ typedef struct CreateGroupStmt
...
@@ -365,8 +365,7 @@ typedef struct CreateGroupStmt
{
{
NodeTag
type
;
NodeTag
type
;
char
*
name
;
/* name of the new group */
char
*
name
;
/* name of the new group */
int
sysid
;
/* group id (-1 if pick default) */
List
*
options
;
/* List of DefElem nodes */
List
*
initUsers
;
/* list of initial users */
}
CreateGroupStmt
;
}
CreateGroupStmt
;
typedef
struct
AlterGroupStmt
typedef
struct
AlterGroupStmt
...
@@ -374,7 +373,6 @@ typedef struct AlterGroupStmt
...
@@ -374,7 +373,6 @@ typedef struct AlterGroupStmt
NodeTag
type
;
NodeTag
type
;
char
*
name
;
/* name of group to alter */
char
*
name
;
/* name of group to alter */
int
action
;
/* +1 = add, -1 = drop user */
int
action
;
/* +1 = add, -1 = drop user */
int
sysid
;
/* sysid change */
List
*
listUsers
;
/* list of users to add/drop */
List
*
listUsers
;
/* list of users to add/drop */
}
AlterGroupStmt
;
}
AlterGroupStmt
;
...
...
src/interfaces/ecpg/preproc/preproc.y
View file @
3284758a
...
@@ -331,7 +331,7 @@ make_name(void)
...
@@ -331,7 +331,7 @@ make_name(void)
%type <str> select_clause opt_select_limit select_limit_value ConstraintTimeSpec
%type <str> select_clause opt_select_limit select_limit_value ConstraintTimeSpec
%type <str> select_offset_value ReindexStmt join_type opt_boolean
%type <str> select_offset_value ReindexStmt join_type opt_boolean
%type <str> join_qual update_list AlterSchemaStmt joined_table
%type <str> join_qual update_list AlterSchemaStmt joined_table
%type <str> opt_level opt_lock lock_type
users_in_new_group_clause
%type <str> opt_level opt_lock lock_type
OptGroupList OptGroupElem
%type <str> OptConstrFromTable comment_op OptTempTableName StringConst
%type <str> OptConstrFromTable comment_op OptTempTableName StringConst
%type <str> constraints_set_list constraints_set_namelist comment_fn
%type <str> constraints_set_list constraints_set_namelist comment_fn
%type <str> constraints_set_mode comment_type comment_cl comment_ag
%type <str> constraints_set_mode comment_type comment_cl comment_ag
...
@@ -691,23 +691,32 @@ user_list: user_list ',' UserId
...
@@ -691,23 +691,32 @@ user_list: user_list ',' UserId
*
*
*
*
****************************************************************************/
****************************************************************************/
CreateGroupStmt:
CREATE GROUP UserId
CreateGroupStmt:
CREATE GROUP UserId OptGroupList
{
{
$$ = cat
2_str(make_str("create group"), $3
);
$$ = cat
_str(3, make_str("create group"), $3, $4
);
}
}
| CREATE GROUP UserId WITH
users_in_new_group_clause
| CREATE GROUP UserId WITH
OptGroupList
{
{
$$ = cat_str(4, make_str("create group"), $3, make_str("with"), $5);
$$ = cat_str(4, make_str("create group"), $3, make_str("with"), $5);
}
}
| CREATE GROUP UserId WITH SYSID Iconst users_in_new_group_clause
;
/*
* Options for CREATE GROUP
*/
OptGroupList: OptGroupList OptGroupElem { $$ = cat2_str($1, $2); }
| /* EMPTY */ { $$ = EMPTY; }
;
OptGroupElem: USER user_list
{
$$ = cat2_str(make_str("user"), $2);
}
| SYSID Iconst
{
{
$$ = cat
_str(5, make_str("create group"), $3, make_str("with sysid"), $6, $7
);
$$ = cat
2_str(make_str("sysid"), $2
);
}
}
;
;
users_in_new_group_clause: USER user_list { $$ = cat2_str(make_str("user"), $2); }
| /* EMPTY */ { $$ = EMPTY; }
;
/*****************************************************************************
/*****************************************************************************
...
...
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