aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/nodes')
-rw-r--r--src/backend/nodes/copyfuncs.c37
-rw-r--r--src/backend/nodes/equalfuncs.c27
2 files changed, 47 insertions, 17 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",
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index 656c1e9ea67..f7bfcc19776 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -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,17 +754,28 @@ _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)
{
if (!equalstr(a->portalname, b->portalname))
@@ -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",