Index: src/backend/postmaster/pgstat.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/postmaster/pgstat.c,v
retrieving revision 1.158
diff -c -p -r1.158 pgstat.c
*** src/backend/postmaster/pgstat.c	27 May 2007 17:28:35 -0000	1.158
--- src/backend/postmaster/pgstat.c	7 Jun 2007 15:25:30 -0000
*************** pgstat_vacuum_tabstat(void)
*** 897,902 ****
--- 897,906 ----
   *	Collect the OIDs of either all databases or all tables, according to
   *	the parameter, into a temporary hash table.  Caller should hash_destroy
   *	the result when done with it.
+  *
+  *	NB -- this function adds an entry with InvalidOid if asked for a list of
+  *	databases.  This is because we use a shared table for such a database to
+  *	keep stats for shared tables.
   * ----------
   */
  static HTAB *
*************** pgstat_collect_oids(Oid catalogid)
*** 930,935 ****
--- 934,950 ----
  	heap_endscan(scan);
  	heap_close(rel, AccessShareLock);
  
+ 	/*
+ 	 * If we were asked for databases, add an entry for the pseudo-database
+ 	 * with InvalidOid, where we store shared tables.
+ 	 */
+ 	if (catalogid == DatabaseRelationId)
+ 	{
+ 		Oid			invalid = InvalidOid;
+ 
+ 		hash_search(htab, (void *) &invalid, HASH_ENTER, NULL);
+ 	}
+ 
  	return htab;
  }
  
