Remove OLD_FILE_NAMING code. No longer used.
authorBruce Momjian
Wed, 30 May 2001 20:52:34 +0000 (20:52 +0000)
committerBruce Momjian
Wed, 30 May 2001 20:52:34 +0000 (20:52 +0000)
src/backend/catalog/catalog.c
src/backend/catalog/index.c
src/backend/commands/indexcmds.c
src/backend/tcop/utility.c
src/backend/utils/init/postinit.c
src/backend/utils/misc/database.c
src/include/catalog/catalog.h
src/include/catalog/index.h
src/interfaces/odbc/connection.h

index 23237e75b3c237210f16e4e7a7beafde3423797d..368a99de051f03ca6e6466dd6de8932a620477e4 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.41 2001/05/30 14:15:26 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.42 2001/05/30 20:52:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "miscadmin.h"
 #include "utils/lsyscache.h"
 
-#ifdef OLD_FILE_NAMING
-/*
- * relpath             - construct path to a relation's file
- *
- * Note that this only works with relations that are visible to the current
- * backend, ie, either in the current database or shared system relations.
- *
- * Result is a palloc'd string.
- */
-char *
-relpath(const char *relname)
-{
-   char       *path;
-
-   if (IsSharedSystemRelationName(relname))
-   {
-       /* Shared system relations live in {datadir}/global */
-       size_t      bufsize = strlen(DataDir) + 8 + sizeof(NameData) + 1;
-
-       path = (char *) palloc(bufsize);
-       snprintf(path, bufsize, "%s/global/%s", DataDir, relname);
-       return path;
-   }
-
-   /*
-    * If it is in the current database, assume it is in current working
-    * directory.  NB: this does not work during bootstrap!
-    */
-   return pstrdup(relname);
-}
-
-/*
- * relpath_blind           - construct path to a relation's file
- *
- * Construct the path using only the info available to smgrblindwrt,
- * namely the names and OIDs of the database and relation. (Shared system
- * relations are identified with dbid = 0.)  Note that we may have to
- * access a relation belonging to a different database!
- *
- * Result is a palloc'd string.
- */
-
-char *
-relpath_blind(const char *dbname, const char *relname,
-             Oid dbid, Oid relid)
-{
-   char       *path;
-
-   if (dbid == (Oid) 0)
-   {
-       /* Shared system relations live in {datadir}/global */
-       path = (char *) palloc(strlen(DataDir) + 8 + sizeof(NameData) + 1);
-       sprintf(path, "%s/global/%s", DataDir, relname);
-   }
-   else if (dbid == MyDatabaseId)
-   {
-       /* XXX why is this inconsistent with relpath() ? */
-       path = (char *) palloc(strlen(DatabasePath) + sizeof(NameData) + 2);
-       sprintf(path, "%s/%s", DatabasePath, relname);
-   }
-   else
-   {
-       /* this is work around only !!! */
-       char        dbpathtmp[MAXPGPATH];
-       Oid         id;
-       char       *dbpath;
-
-       GetRawDatabaseInfo(dbname, &id, dbpathtmp);
-
-       if (id != dbid)
-           elog(FATAL, "relpath_blind: oid of db %s is not %u",
-                dbname, dbid);
-       dbpath = ExpandDatabasePath(dbpathtmp);
-       if (dbpath == NULL)
-           elog(FATAL, "relpath_blind: can't expand path for db %s",
-                dbname);
-       path = (char *) palloc(strlen(dbpath) + sizeof(NameData) + 2);
-       sprintf(path, "%s/%s", dbpath, relname);
-       pfree(dbpath);
-   }
-   return path;
-}
-
-#else                          /* ! OLD_FILE_NAMING */
-
 /*
  * relpath         - construct path to a relation's file
  *
@@ -157,7 +72,6 @@ GetDatabasePath(Oid tblNode)
    return path;
 }
 
-#endif  /* OLD_FILE_NAMING */
 
 /*
  * IsSystemRelationName
index e6e87be728ccc6cab4217fc9ec864f9cc7a4d9e8..b6420a10e9a465307666e8b035f4856de8381689 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.151 2001/05/18 22:35:50 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.152 2001/05/30 20:52:32 momjian Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -1350,11 +1350,7 @@ setRelhasindex(Oid relid, bool hasindex)
     */
    pg_class = heap_openr(RelationRelationName, RowExclusiveLock);
 
-#ifdef OLD_FILE_NAMING
-   if (!IsIgnoringSystemIndexes())
-#else
    if (!IsIgnoringSystemIndexes() && (!IsReindexProcessing() || pg_class->rd_rel->relhasindex))
-#endif  /* OLD_FILE_NAMING */
    {
        tuple = SearchSysCacheCopy(RELOID,
                                   ObjectIdGetDatum(relid),
@@ -1424,7 +1420,6 @@ setRelhasindex(Oid relid, bool hasindex)
    heap_close(pg_class, RowExclusiveLock);
 }
 
-#ifndef OLD_FILE_NAMING
 void
 setNewRelfilenode(Relation relation)
 {
@@ -1494,7 +1489,6 @@ setNewRelfilenode(Relation relation)
    CommandCounterIncrement();
 }
 
-#endif  /* OLD_FILE_NAMING */
 
 /* ----------------
  *     UpdateStats
@@ -1553,11 +1547,7 @@ UpdateStats(Oid relid, double reltuples)
     */
    pg_class = heap_openr(RelationRelationName, RowExclusiveLock);
 
-#ifdef OLD_FILE_NAMING
-   in_place_upd = (IsReindexProcessing() || IsBootstrapProcessingMode());
-#else
    in_place_upd = (IsIgnoringSystemIndexes() || IsReindexProcessing());
-#endif  /* OLD_FILE_NAMING */
 
    if (!in_place_upd)
    {
@@ -2000,14 +1990,12 @@ reindex_index(Oid indexId, bool force, bool inplace)
    if (iRel == NULL)
        elog(ERROR, "reindex_index: can't open index relation");
 
-#ifndef OLD_FILE_NAMING
    if (!inplace)
    {
        inplace = IsSharedSystemRelationName(NameStr(iRel->rd_rel->relname));
        if (!inplace)
            setNewRelfilenode(iRel);
    }
-#endif  /* OLD_FILE_NAMING */
    /* Obtain exclusive lock on it, just to be sure */
    LockRelation(iRel, AccessExclusiveLock);
 
@@ -2084,9 +2072,6 @@ reindex_relation(Oid relid, bool force)
                overwrite,
                upd_pg_class_inplace;
 
-#ifdef OLD_FILE_NAMING
-   overwrite = upd_pg_class_inplace = deactivate_needed = true;
-#else
    Relation    rel;
 
    overwrite = upd_pg_class_inplace = deactivate_needed = false;
@@ -2138,7 +2123,7 @@ reindex_relation(Oid relid, bool force)
            elog(ERROR, "the target relation %u is shared", relid);
    }
    RelationClose(rel);
-#endif  /* OLD_FILE_NAMING */
+
    old = SetReindexProcessing(true);
    if (deactivate_needed)
    {
index 40e805137ac28a5bc295ace233fa8745ce43197b..213a3cc3ed08c8320c54e4b3ca45b14fc4ff6118 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.47 2001/03/22 06:16:11 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.48 2001/05/30 20:52:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -654,13 +654,9 @@ ReindexIndex(const char *name, bool force /* currently unused */ )
        elog(ERROR, "relation \"%s\" is of type \"%c\"",
             name, ((Form_pg_class) GETSTRUCT(tuple))->relkind);
 
-#ifdef OLD_FILE_NAMING
-   if (!reindex_index(tuple->t_data->t_oid, force, false))
-#else
    if (IsIgnoringSystemIndexes())
        overwrite = true;
    if (!reindex_index(tuple->t_data->t_oid, force, overwrite))
-#endif  /* OLD_FILE_NAMING */
        elog(NOTICE, "index \"%s\" wasn't reindexed", name);
 
    ReleaseSysCache(tuple);
index dc569455b26514d14ff68f16a608ccb11f7b8bad..5e6a044b9211933f41b7dc6eb332e4325f1a5219 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.111 2001/05/27 09:59:29 petere Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.112 2001/05/30 20:52:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -891,18 +891,6 @@ ProcessUtility(Node *parsetree,
                        break;
                    case TABLE:
                        relname = (char *) stmt->name;
-                       if (IsSystemRelationName(relname))
-                       {
-#ifdef OLD_FILE_NAMING
-                           if (!allowSystemTableMods && IsSystemRelationName(relname))
-                               elog(ERROR, "\"%s\" is a system table. call REINDEX under standalone postgres with -O -P options",
-                                    relname);
-                           if (!IsIgnoringSystemIndexes())
-                               elog(ERROR, "\"%s\" is a system table. call REINDEX under standalone postgres with -P -O options",
-
-                                    relname);
-#endif  /* OLD_FILE_NAMING */
-                       }
                        if (!pg_ownercheck(GetUserId(), relname, RELNAME))
                            elog(ERROR, "%s: %s", relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
                        ReindexTable(relname, stmt->force);
index 70d835aa250f8831b591d84d0614fb9eb7f39e5f..c3c3ad946ec4880f4eedeef19a394fad7730dcb0 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.85 2001/05/08 21:06:43 petere Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.86 2001/05/30 20:52:32 momjian Exp $
  *
  *
  *-------------------------------------------------------------------------
 #include 
 #include 
 
-#ifndef OLD_FILE_NAMING
 #include "catalog/catalog.h"
-#endif
-
 #include "access/heapam.h"
 #include "catalog/catname.h"
 #include "catalog/pg_database.h"
index 73034d2e7856c5a9eaac23bfd0456e7bfdb6db54..be56a6902ff9c4e25a51bfbdf1a23500791aceb5 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.46 2001/05/30 14:15:27 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.47 2001/05/30 20:52:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -140,19 +140,11 @@ GetRawDatabaseInfo(const char *name, Oid *db_id, char *path)
    Page        pg;
    char       *dbfname;
    Form_pg_database tup_db;
+   RelFileNode rnode;
 
-#ifdef OLD_FILE_NAMING
-   dbfname = (char *) palloc(strlen(DataDir) + 8 + strlen(DatabaseRelationName) + 2);
-   sprintf(dbfname, "%s/global/%s", DataDir, DatabaseRelationName);
-#else
-   {
-       RelFileNode rnode;
-
-       rnode.tblNode = 0;
-       rnode.relNode = RelOid_pg_database;
-       dbfname = relpath(rnode);
-   }
-#endif
+   rnode.tblNode = 0;
+   rnode.relNode = RelOid_pg_database;
+   dbfname = relpath(rnode);
 
    if ((dbfd = open(dbfname, O_RDONLY | PG_BINARY, 0)) < 0)
        elog(FATAL, "cannot open %s: %m", dbfname);
index 8a51f87c033e77159e86afd7f0a105404aa8439c..f7c970bf3782e7b30bd04969749800fa749aaca3 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: catalog.h,v 1.16 2001/03/22 04:00:34 momjian Exp $
+ * $Id: catalog.h,v 1.17 2001/05/30 20:52:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 #include "access/tupdesc.h"
 
-#ifdef OLD_FILE_NAMING
-
-extern char *relpath(const char *relname);
-extern char *relpath_blind(const char *dbname, const char *relname,
-             Oid dbid, Oid relid);
-
-#else
 #include "storage/relfilenode.h"
 
 extern char *relpath(RelFileNode rnode);
 extern char *GetDatabasePath(Oid tblNode);
 
-#endif
-
 extern bool IsSystemRelationName(const char *relname);
 extern bool IsSharedSystemRelationName(const char *relname);
 
index 07aaad61c798bc295723dfe80cded8dbc848d6c9..e139dde2cc388c91e303fcc60e1b8dca3d0518fd 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: index.h,v 1.34 2001/05/07 00:43:24 tgl Exp $
+ * $Id: index.h,v 1.35 2001/05/30 20:52:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -50,10 +50,8 @@ extern void UpdateStats(Oid relid, double reltuples);
 extern bool IndexesAreActive(Oid relid, bool comfirmCommitted);
 extern void setRelhasindex(Oid relid, bool hasindex);
 
-#ifndef OLD_FILE_NAMING
 extern void setNewRelfilenode(Relation relation);
 
-#endif  /* OLD_FILE_NAMING */
 extern bool SetReindexProcessing(bool processing);
 extern bool IsReindexProcessing(void);
 
index 034ef137d187cd8420067264629856977644d48f..d3eb8700b2861ccc40ed4719e825cfc3cbedf2ec 100644 (file)
@@ -9,6 +9,9 @@
 #ifndef __CONNECTION_H__
 #define __CONNECTION_H__
 
+#include 
+#include 
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif