Alvaro Herrera wrote:
> crystal wrote:
> 
> > TEST=# drop owned by u1, u2 cascade;
> > NOTICE:  drop cascades to view v2
> > ERROR:  cache lookup failed for relation 16390
> 
> Rats.  I guess this is due to the two-pass nature of some algorithm.
> (Dropping owned by u1 cascade drops the view too, and then when dropping
> owned by u2, it tries to find the view and the cache lookup fails).

This patch fixes it, but I'm not sure if it breaks some other case (not
awake enough yet I think).

The problem is that we're accumulating objects for all users in a single
pass, and then calling performMultipleDeletion with all of them.  As far
as I understand the comments in performMultipleDeletion, this should
work ...

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Index: src/backend/catalog/pg_shdepend.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/catalog/pg_shdepend.c,v
retrieving revision 1.23.2.2
diff -c -p -r1.23.2.2 pg_shdepend.c
*** src/backend/catalog/pg_shdepend.c	29 Apr 2008 19:37:13 -0000	1.23.2.2
--- src/backend/catalog/pg_shdepend.c	9 Jul 2008 14:03:27 -0000
*************** shdepDropOwned(List *roleids, DropBehavi
*** 1107,1115 ****
  {
  	Relation	sdepRel;
  	ListCell   *cell;
- 	ObjectAddresses *deleteobjs;
  
- 	deleteobjs = new_object_addresses();
  
  	/*
  	 * We don't need this strong a lock here, but we'll call routines that
--- 1107,1113 ----
*************** shdepDropOwned(List *roleids, DropBehavi
*** 1128,1133 ****
--- 1126,1134 ----
  		ScanKeyData key[2];
  		SysScanDesc scan;
  		HeapTuple	tuple;
+ 		ObjectAddresses *deleteobjs;
+ 
+ 		deleteobjs = new_object_addresses();
  
  		/* Doesn't work for pinned objects */
  		if (isSharedObjectPinned(AuthIdRelationId, roleid, sdepRel))
*************** shdepDropOwned(List *roleids, DropBehavi
*** 1225,1238 ****
  		}
  
  		systable_endscan(scan);
! 	}
  
! 	/* the dependency mechanism does the actual work */
! 	performMultipleDeletions(deleteobjs, behavior);
  
  	heap_close(sdepRel, RowExclusiveLock);
- 
- 	free_object_addresses(deleteobjs);
  }
  
  /*
--- 1226,1238 ----
  		}
  
  		systable_endscan(scan);
! 		/* the dependency mechanism does the actual work */
! 		performMultipleDeletions(deleteobjs, behavior);
  
! 		free_object_addresses(deleteobjs);
! 	}
  
  	heap_close(sdepRel, RowExclusiveLock);
  }
  
  /*
-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to