diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2001-06-09 23:21:55 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2001-06-09 23:21:55 +0000 |
commit | 7ceed2a9b5f19c59a2797c5aa31d801c32cb0cc4 (patch) | |
tree | c7d02530d61fd36d5b2677293fdecba6738cc8e9 /src/backend/nodes/copyfuncs.c | |
parent | 202548d6cc276e1f2a60b3d7d3d17392b5d9795e (diff) | |
download | postgresql-7ceed2a9b5f19c59a2797c5aa31d801c32cb0cc4.tar.gz postgresql-7ceed2a9b5f19c59a2797c5aa31d801c32cb0cc4.zip |
Allow GRANT/REVOKE to/from more than one user per invocation. Command tag
for GRANT/REVOKE is now just that, not "CHANGE".
On the way, migrate some of the aclitem internal representation away from
the parser and build a real parse tree instead. Also add some 'const'
qualifiers.
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r-- | src/backend/nodes/copyfuncs.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 07907b63683..77ae4fb781a 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.143 2001/06/05 05:26:03 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.144 2001/06/09 23:21:54 petere Exp $ * *------------------------------------------------------------------------- */ @@ -24,7 +24,6 @@ #include "optimizer/clauses.h" #include "optimizer/planmain.h" -#include "utils/acl.h" /* @@ -1856,14 +1855,29 @@ _copyAlterTableStmt(AlterTableStmt *from) return newnode; } -static ChangeACLStmt * -_copyChangeACLStmt(ChangeACLStmt *from) +static GrantStmt * +_copyGrantStmt(GrantStmt *from) { - ChangeACLStmt *newnode = makeNode(ChangeACLStmt); + GrantStmt *newnode = makeNode(GrantStmt); - Node_Copy(from, newnode, relNames); - if (from->aclString) - newnode->aclString = pstrdup(from->aclString); + newnode->is_grant = from->is_grant; + Node_Copy(from, newnode, relnames); + if (from->privileges) + newnode->privileges = pstrdup(from->privileges); + Node_Copy(from, newnode, grantees); + + return newnode; +} + +static PrivGrantee * +_copyPrivGrantee(PrivGrantee *from) +{ + PrivGrantee *newnode = makeNode(PrivGrantee); + + if (from->username) + newnode->username = pstrdup(from->username); + if (from->groupname) + newnode->groupname = pstrdup(from->groupname); return newnode; } @@ -2729,8 +2743,8 @@ copyObject(void *from) case T_AlterTableStmt: retval = _copyAlterTableStmt(from); break; - case T_ChangeACLStmt: - retval = _copyChangeACLStmt(from); + case T_GrantStmt: + retval = _copyGrantStmt(from); break; case T_ClosePortalStmt: retval = _copyClosePortalStmt(from); @@ -2943,6 +2957,9 @@ copyObject(void *from) case T_FkConstraint: retval = _copyFkConstraint(from); break; + case T_PrivGrantee: + retval = _copyPrivGrantee(from); + break; default: elog(ERROR, "copyObject: don't know how to copy node type %d", |