On Thu, Mar  6, 2014 at 08:34:29AM +0100, Antonin Houska wrote:
> >>> You're right. I missed the fact that Postgres (unlike another DBMS that
> >>> I worked with) allows for tablespace to be shared across databases.
> >>
> >> I have update the C comment:
> >>
> >>         <  * Notice that relNode is only unique within a particular 
> >> database.
> >>         ---
> >>         >  * Notice that relNode is only unique within a particular 
> >> tablespace.
> > 
> > Yep. But the new text is no more correct than the old text.  Did you
> > read what I wrote upthread?
> 
> Perhaps "... unique within a particular (tablespace, database)
> combination." ?

Oh, I thought people just wanted the text to be consistent with other
mentions, rather than improving it.  Attached is a patch which updates
comments about the tablespace/database issue.

-- 
  Bruce Momjian  <br...@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +
diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c
new file mode 100644
index e3002eb..282e0b9
*** a/src/backend/catalog/catalog.c
--- b/src/backend/catalog/catalog.c
*************** GetNewOidWithIndex(Relation relation, Oi
*** 408,415 ****
  
  /*
   * GetNewRelFileNode
!  *		Generate a new relfilenode number that is unique within the given
!  *		tablespace.
   *
   * If the relfilenode will also be used as the relation's OID, pass the
   * opened pg_class catalog, and this routine will guarantee that the result
--- 408,415 ----
  
  /*
   * GetNewRelFileNode
!  *		Generate a new relfilenode number that is unique within the
!  *		database of the given tablespace.
   *
   * If the relfilenode will also be used as the relation's OID, pass the
   * opened pg_class catalog, and this routine will guarantee that the result
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
new file mode 100644
index 1de3170..25f01e5
*** a/src/backend/commands/tablecmds.c
--- b/src/backend/commands/tablecmds.c
*************** ATExecSetTableSpace(Oid tableOid, Oid ne
*** 9078,9085 ****
  	FlushRelationBuffers(rel);
  
  	/*
! 	 * Relfilenodes are not unique across tablespaces, so we need to allocate
! 	 * a new one in the new tablespace.
  	 */
  	newrelfilenode = GetNewRelFileNode(newTableSpace, NULL,
  									   rel->rd_rel->relpersistence);
--- 9078,9085 ----
  	FlushRelationBuffers(rel);
  
  	/*
! 	 * Relfilenodes are not unique in databases across tablespaces, so we
! 	 * need to allocate a new one in the new tablespace.
  	 */
  	newrelfilenode = GetNewRelFileNode(newTableSpace, NULL,
  									   rel->rd_rel->relpersistence);
diff --git a/src/include/storage/relfilenode.h b/src/include/storage/relfilenode.h
new file mode 100644
index c995c10..8616bd3
*** a/src/include/storage/relfilenode.h
--- b/src/include/storage/relfilenode.h
*************** typedef enum ForkNumber
*** 55,61 ****
   * relNode identifies the specific relation.  relNode corresponds to
   * pg_class.relfilenode (NOT pg_class.oid, because we need to be able
   * to assign new physical files to relations in some situations).
!  * Notice that relNode is only unique within a particular tablespace.
   *
   * Note: spcNode must be GLOBALTABLESPACE_OID if and only if dbNode is
   * zero.  We support shared relations only in the "global" tablespace.
--- 55,62 ----
   * relNode identifies the specific relation.  relNode corresponds to
   * pg_class.relfilenode (NOT pg_class.oid, because we need to be able
   * to assign new physical files to relations in some situations).
!  * Notice that relNode is only unique within a database in a particular
!  * tablespace.
   *
   * Note: spcNode must be GLOBALTABLESPACE_OID if and only if dbNode is
   * zero.  We support shared relations only in the "global" tablespace.
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to