1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

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.
This commit is contained in:
Peter Eisentraut
2001-06-09 23:21:55 +00:00
parent 202548d6cc
commit 7ceed2a9b5
14 changed files with 280 additions and 214 deletions

View File

@@ -20,7 +20,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.91 2001/06/05 05:26:03 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.92 2001/06/09 23:21:54 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,7 +29,6 @@
#include "nodes/plannodes.h"
#include "nodes/relation.h"
#include "utils/acl.h"
#include "utils/datum.h"
@@ -755,16 +754,27 @@ _equalAlterTableStmt(AlterTableStmt *a, AlterTableStmt *b)
}
static bool
_equalChangeACLStmt(ChangeACLStmt *a, ChangeACLStmt *b)
_equalGrantStmt(GrantStmt *a, GrantStmt *b)
{
if (!equal(a->relNames, b->relNames))
if (a->is_grant != b->is_grant)
return false;
if (!equalstr(a->aclString, b->aclString))
if (!equal(a->relnames, b->relnames))
return false;
if (!equalstr(a->privileges, b->privileges))
return false;
if (!equal(a->grantees, b->grantees))
return false;
return true;
}
static bool
_equalPrivGrantee(PrivGrantee *a, PrivGrantee *b)
{
return equalstr(a->username, b->username)
&& equalstr(a->groupname, b->groupname);
}
static bool
_equalClosePortalStmt(ClosePortalStmt *a, ClosePortalStmt *b)
{
@@ -1898,8 +1908,8 @@ equal(void *a, void *b)
case T_AlterTableStmt:
retval = _equalAlterTableStmt(a, b);
break;
case T_ChangeACLStmt:
retval = _equalChangeACLStmt(a, b);
case T_GrantStmt:
retval = _equalGrantStmt(a, b);
break;
case T_ClosePortalStmt:
retval = _equalClosePortalStmt(a, b);
@@ -2113,6 +2123,9 @@ equal(void *a, void *b)
case T_FkConstraint:
retval = _equalFkConstraint(a, b);
break;
case T_PrivGrantee:
retval = _equalPrivGrantee(a, b);
break;
default:
elog(NOTICE, "equal: don't know whether nodes of type %d are equal",