1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00
Subject: [PATCHES] DROP AGGREGATE patch/fix.


Here's a patch that fixes the DROP AGGREGATE command to delete
the desired aggregate for a specific type.
This commit is contained in:
Marc G. Fournier
1997-05-22 00:17:24 +00:00
parent 021ccf0b8c
commit 5e7c0a0b9a
13 changed files with 202 additions and 49 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/Attic/aclchk.c,v 1.9 1997/04/03 21:31:47 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/Attic/aclchk.c,v 1.10 1997/05/22 00:15:21 scrappy Exp $
*
* NOTES
* See acl.h.
@@ -29,6 +29,7 @@
#include "catalog/catname.h"
#include "catalog/pg_group.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_aggregate.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_user.h"
#include "utils/syscache.h"
@@ -561,3 +562,43 @@ pg_func_ownercheck(char *usename,
return(user_id == owner_id);
}
int32
pg_aggr_ownercheck(char *usename,
char *aggname,
Oid basetypeID)
{
HeapTuple htp;
AclId user_id, owner_id;
htp = SearchSysCacheTuple(USENAME, PointerGetDatum(usename),
0,0,0);
if (!HeapTupleIsValid(htp))
elog(WARN, "pg_aggr_ownercheck: user \"%-.*s\" not found",
NAMEDATALEN, usename);
user_id = (AclId) ((Form_pg_user) GETSTRUCT(htp))->usesysid;
/*
* Superusers bypass all permission-checking.
*/
if (((Form_pg_user) GETSTRUCT(htp))->usesuper) {
#ifdef ACLDEBUG_TRACE
elog(DEBUG, "pg_aggr_ownercheck: user \"%-.*s\" is superuser",
NAMEDATALEN, usename);
#endif
return(1);
}
htp = SearchSysCacheTuple(AGGNAME,
PointerGetDatum(aggname),
PointerGetDatum(basetypeID),
0,
0);
if (!HeapTupleIsValid(htp))
agg_error("pg_aggr_ownercheck", aggname, basetypeID);
owner_id = ((Form_pg_aggregate) GETSTRUCT(htp))->aggowner;
return(user_id == owner_id);
}