Index: src/backend/catalog/catalog.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/catalog/catalog.c,v retrieving revision 1.41 diff -c -r1.41 catalog.c *** src/backend/catalog/catalog.c 2001/05/30 14:15:26 1.41 --- src/backend/catalog/catalog.c 2001/05/30 20:46:22 *************** *** 22,113 **** #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 * * Result is a palloc'd string. --- 22,28 ---- *************** *** 157,163 **** return path; } - #endif /* OLD_FILE_NAMING */ /* * IsSystemRelationName --- 72,77 ---- Index: src/backend/catalog/index.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/catalog/index.c,v retrieving revision 1.151 diff -c -r1.151 index.c *** src/backend/catalog/index.c 2001/05/18 22:35:50 1.151 --- src/backend/catalog/index.c 2001/05/30 20:46:27 *************** *** 1350,1360 **** */ 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), --- 1350,1356 ---- *************** *** 1424,1430 **** heap_close(pg_class, RowExclusiveLock); } - #ifndef OLD_FILE_NAMING void setNewRelfilenode(Relation relation) { --- 1420,1425 ---- *************** *** 1494,1500 **** CommandCounterIncrement(); } - #endif /* OLD_FILE_NAMING */ /* ---------------- * UpdateStats --- 1489,1494 ---- *************** *** 1553,1563 **** */ 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) { --- 1547,1553 ---- *************** *** 2000,2013 **** 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); --- 1990,2001 ---- *************** *** 2084,2092 **** 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; --- 2072,2077 ---- *************** *** 2138,2144 **** elog(ERROR, "the target relation %u is shared", relid); } RelationClose(rel); ! #endif /* OLD_FILE_NAMING */ old = SetReindexProcessing(true); if (deactivate_needed) { --- 2123,2129 ---- elog(ERROR, "the target relation %u is shared", relid); } RelationClose(rel); ! old = SetReindexProcessing(true); if (deactivate_needed) { Index: src/backend/commands/indexcmds.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/commands/indexcmds.c,v retrieving revision 1.47 diff -c -r1.47 indexcmds.c *** src/backend/commands/indexcmds.c 2001/03/22 06:16:11 1.47 --- src/backend/commands/indexcmds.c 2001/05/30 20:46:27 *************** *** 654,666 **** 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); --- 654,662 ---- Index: src/backend/tcop/utility.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/tcop/utility.c,v retrieving revision 1.111 diff -c -r1.111 utility.c *** src/backend/tcop/utility.c 2001/05/27 09:59:29 1.111 --- src/backend/tcop/utility.c 2001/05/30 20:46:29 *************** *** 891,908 **** 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); --- 891,896 ---- Index: src/backend/utils/init/postinit.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/init/postinit.c,v retrieving revision 1.85 diff -c -r1.85 postinit.c *** src/backend/utils/init/postinit.c 2001/05/08 21:06:43 1.85 --- src/backend/utils/init/postinit.c 2001/05/30 20:46:30 *************** *** 21,30 **** #include #include - #ifndef OLD_FILE_NAMING #include "catalog/catalog.h" - #endif - #include "access/heapam.h" #include "catalog/catname.h" #include "catalog/pg_database.h" --- 21,27 ---- Index: src/backend/utils/misc/database.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/misc/database.c,v retrieving revision 1.46 diff -c -r1.46 database.c *** src/backend/utils/misc/database.c 2001/05/30 14:15:27 1.46 --- src/backend/utils/misc/database.c 2001/05/30 20:46:30 *************** *** 140,158 **** Page pg; char *dbfname; Form_pg_database tup_db; ! #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 if ((dbfd = open(dbfname, O_RDONLY | PG_BINARY, 0)) < 0) elog(FATAL, "cannot open %s: %m", dbfname); --- 140,150 ---- Page pg; char *dbfname; Form_pg_database tup_db; + RelFileNode rnode; ! 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: src/include/catalog/catalog.h =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/catalog.h,v retrieving revision 1.16 diff -c -r1.16 catalog.h *** src/include/catalog/catalog.h 2001/03/22 04:00:34 1.16 --- src/include/catalog/catalog.h 2001/05/30 20:46:30 *************** *** 16,34 **** #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); --- 16,25 ---- Index: src/include/catalog/index.h =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/index.h,v retrieving revision 1.34 diff -c -r1.34 index.h *** src/include/catalog/index.h 2001/05/07 00:43:24 1.34 --- src/include/catalog/index.h 2001/05/30 20:46:30 *************** *** 50,59 **** 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); --- 50,57 ---- Index: src/interfaces/odbc/connection.h =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/odbc/connection.h,v retrieving revision 1.23 diff -c -r1.23 connection.h *** src/interfaces/odbc/connection.h 2001/05/25 08:12:31 1.23 --- src/interfaces/odbc/connection.h 2001/05/30 20:46:32 *************** *** 9,14 **** --- 9,17 ---- #ifndef __CONNECTION_H__ #define __CONNECTION_H__ + #include + #include + #ifdef HAVE_CONFIG_H #include "config.h" #endif