Search Postgresql Archives

Re: 8.3-beta4, analyze and db owner

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Clodoaldo escribió:

> > > fahstats=> analyze;
> > > WARNING:  skipping "pg_authid" --- only table or database owner can analyze it

> The problem with that warning message is that it implies that the db
> owner can analyze them which can not be done according to your
> comment. The message, if emited, should say then that only superuser
> can analyze those tables.

How about this patch.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Index: src/backend/commands/analyze.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/commands/analyze.c,v
retrieving revision 1.114
diff -c -p -r1.114 analyze.c
*** src/backend/commands/analyze.c	3 Jan 2008 21:23:15 -0000	1.114
--- src/backend/commands/analyze.c	15 Jan 2008 22:50:24 -0000
***************
*** 22,27 ****
--- 22,28 ----
  #include "catalog/index.h"
  #include "catalog/indexing.h"
  #include "catalog/namespace.h"
+ #include "catalog/pg_namespace.h"
  #include "commands/dbcommands.h"
  #include "commands/vacuum.h"
  #include "executor/executor.h"
*************** analyze_rel(Oid relid, VacuumStmt *vacst
*** 161,169 ****
  	{
  		/* No need for a WARNING if we already complained during VACUUM */
  		if (!vacstmt->vacuum)
! 			ereport(WARNING,
! 					(errmsg("skipping \"%s\" --- only table or database owner can analyze it",
! 							RelationGetRelationName(onerel))));
  		relation_close(onerel, ShareUpdateExclusiveLock);
  		return;
  	}
--- 162,181 ----
  	{
  		/* No need for a WARNING if we already complained during VACUUM */
  		if (!vacstmt->vacuum)
! 		{
! 			if (onerel->rd_rel->relisshared)
! 				ereport(WARNING,
! 						(errmsg("skipping \"%s\" --- only superuser can analyze it",
! 								RelationGetRelationName(onerel))));
! 			else if (onerel->rd_rel->relnamespace == PG_CATALOG_NAMESPACE)
! 				ereport(WARNING,
! 						(errmsg("skipping \"%s\" --- only superuser or database owner can analyze it",
! 								RelationGetRelationName(onerel))));
! 			else
! 				ereport(WARNING,
! 						(errmsg("skipping \"%s\" --- only table or database owner can analyze it",
! 								RelationGetRelationName(onerel))));
! 		}
  		relation_close(onerel, ShareUpdateExclusiveLock);
  		return;
  	}
Index: src/backend/commands/vacuum.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/commands/vacuum.c,v
retrieving revision 1.363
diff -c -p -r1.363 vacuum.c
*** src/backend/commands/vacuum.c	3 Jan 2008 21:23:15 -0000	1.363
--- src/backend/commands/vacuum.c	15 Jan 2008 22:50:01 -0000
***************
*** 30,35 ****
--- 30,36 ----
  #include "access/xlog.h"
  #include "catalog/namespace.h"
  #include "catalog/pg_database.h"
+ #include "catalog/pg_namespace.h"
  #include "commands/dbcommands.h"
  #include "commands/vacuum.h"
  #include "executor/executor.h"
*************** vacuum_rel(Oid relid, VacuumStmt *vacstm
*** 1048,1056 ****
  	if (!(pg_class_ownercheck(RelationGetRelid(onerel), GetUserId()) ||
  		  (pg_database_ownercheck(MyDatabaseId, GetUserId()) && !onerel->rd_rel->relisshared)))
  	{
! 		ereport(WARNING,
! 				(errmsg("skipping \"%s\" --- only table or database owner can vacuum it",
! 						RelationGetRelationName(onerel))));
  		relation_close(onerel, lmode);
  		CommitTransactionCommand();
  		return;
--- 1049,1066 ----
  	if (!(pg_class_ownercheck(RelationGetRelid(onerel), GetUserId()) ||
  		  (pg_database_ownercheck(MyDatabaseId, GetUserId()) && !onerel->rd_rel->relisshared)))
  	{
! 		if (onerel->rd_rel->relisshared)
! 			ereport(WARNING,
! 					(errmsg("skipping \"%s\" --- only superuser can vacuum it",
! 							RelationGetRelationName(onerel))));
! 		else if (onerel->rd_rel->relnamespace == PG_CATALOG_NAMESPACE)
! 			ereport(WARNING,
! 					(errmsg("skipping \"%s\" --- only superuser or database owner can vacuum it",
! 							RelationGetRelationName(onerel))));
! 		else
! 			ereport(WARNING,
! 					(errmsg("skipping \"%s\" --- only table or database owner can vacuum it",
! 							RelationGetRelationName(onerel))));
  		relation_close(onerel, lmode);
  		CommitTransactionCommand();
  		return;
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux