Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 53020d0

Browse files
committed
Remove OLD_FILE_NAMING code. No longer used.
1 parent 06e5f1d commit 53020d0

File tree

9 files changed

+16
-152
lines changed

9 files changed

+16
-152
lines changed

src/backend/catalog/catalog.c

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.41 2001/05/30 14:15:26 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.42 2001/05/30 20:52:32 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -22,91 +22,6 @@
2222
#include "miscadmin.h"
2323
#include "utils/lsyscache.h"
2424

25-
#ifdef OLD_FILE_NAMING
26-
/*
27-
* relpath - construct path to a relation's file
28-
*
29-
* Note that this only works with relations that are visible to the current
30-
* backend, ie, either in the current database or shared system relations.
31-
*
32-
* Result is a palloc'd string.
33-
*/
34-
char *
35-
relpath(const char *relname)
36-
{
37-
char *path;
38-
39-
if (IsSharedSystemRelationName(relname))
40-
{
41-
/* Shared system relations live in {datadir}/global */
42-
size_t bufsize = strlen(DataDir) + 8 + sizeof(NameData) + 1;
43-
44-
path = (char *) palloc(bufsize);
45-
snprintf(path, bufsize, "%s/global/%s", DataDir, relname);
46-
return path;
47-
}
48-
49-
/*
50-
* If it is in the current database, assume it is in current working
51-
* directory. NB: this does not work during bootstrap!
52-
*/
53-
return pstrdup(relname);
54-
}
55-
56-
/*
57-
* relpath_blind - construct path to a relation's file
58-
*
59-
* Construct the path using only the info available to smgrblindwrt,
60-
* namely the names and OIDs of the database and relation. (Shared system
61-
* relations are identified with dbid = 0.) Note that we may have to
62-
* access a relation belonging to a different database!
63-
*
64-
* Result is a palloc'd string.
65-
*/
66-
67-
char *
68-
relpath_blind(const char *dbname, const char *relname,
69-
Oid dbid, Oid relid)
70-
{
71-
char *path;
72-
73-
if (dbid == (Oid) 0)
74-
{
75-
/* Shared system relations live in {datadir}/global */
76-
path = (char *) palloc(strlen(DataDir) + 8 + sizeof(NameData) + 1);
77-
sprintf(path, "%s/global/%s", DataDir, relname);
78-
}
79-
else if (dbid == MyDatabaseId)
80-
{
81-
/* XXX why is this inconsistent with relpath() ? */
82-
path = (char *) palloc(strlen(DatabasePath) + sizeof(NameData) + 2);
83-
sprintf(path, "%s/%s", DatabasePath, relname);
84-
}
85-
else
86-
{
87-
/* this is work around only !!! */
88-
char dbpathtmp[MAXPGPATH];
89-
Oid id;
90-
char *dbpath;
91-
92-
GetRawDatabaseInfo(dbname, &id, dbpathtmp);
93-
94-
if (id != dbid)
95-
elog(FATAL, "relpath_blind: oid of db %s is not %u",
96-
dbname, dbid);
97-
dbpath = ExpandDatabasePath(dbpathtmp);
98-
if (dbpath == NULL)
99-
elog(FATAL, "relpath_blind: can't expand path for db %s",
100-
dbname);
101-
path = (char *) palloc(strlen(dbpath) + sizeof(NameData) + 2);
102-
sprintf(path, "%s/%s", dbpath, relname);
103-
pfree(dbpath);
104-
}
105-
return path;
106-
}
107-
108-
#else /* ! OLD_FILE_NAMING */
109-
11025
/*
11126
* relpath - construct path to a relation's file
11227
*
@@ -157,7 +72,6 @@ GetDatabasePath(Oid tblNode)
15772
return path;
15873
}
15974

160-
#endif /* OLD_FILE_NAMING */
16175

16276
/*
16377
* IsSystemRelationName

src/backend/catalog/index.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.151 2001/05/18 22:35:50 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.152 2001/05/30 20:52:32 momjian Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -1350,11 +1350,7 @@ setRelhasindex(Oid relid, bool hasindex)
13501350
*/
13511351
pg_class = heap_openr(RelationRelationName, RowExclusiveLock);
13521352

1353-
#ifdef OLD_FILE_NAMING
1354-
if (!IsIgnoringSystemIndexes())
1355-
#else
13561353
if (!IsIgnoringSystemIndexes() && (!IsReindexProcessing() || pg_class->rd_rel->relhasindex))
1357-
#endif /* OLD_FILE_NAMING */
13581354
{
13591355
tuple = SearchSysCacheCopy(RELOID,
13601356
ObjectIdGetDatum(relid),
@@ -1424,7 +1420,6 @@ setRelhasindex(Oid relid, bool hasindex)
14241420
heap_close(pg_class, RowExclusiveLock);
14251421
}
14261422

1427-
#ifndef OLD_FILE_NAMING
14281423
void
14291424
setNewRelfilenode(Relation relation)
14301425
{
@@ -1494,7 +1489,6 @@ setNewRelfilenode(Relation relation)
14941489
CommandCounterIncrement();
14951490
}
14961491

1497-
#endif /* OLD_FILE_NAMING */
14981492

14991493
/* ----------------
15001494
* UpdateStats
@@ -1553,11 +1547,7 @@ UpdateStats(Oid relid, double reltuples)
15531547
*/
15541548
pg_class = heap_openr(RelationRelationName, RowExclusiveLock);
15551549

1556-
#ifdef OLD_FILE_NAMING
1557-
in_place_upd = (IsReindexProcessing() || IsBootstrapProcessingMode());
1558-
#else
15591550
in_place_upd = (IsIgnoringSystemIndexes() || IsReindexProcessing());
1560-
#endif /* OLD_FILE_NAMING */
15611551

15621552
if (!in_place_upd)
15631553
{
@@ -2000,14 +1990,12 @@ reindex_index(Oid indexId, bool force, bool inplace)
20001990
if (iRel == NULL)
20011991
elog(ERROR, "reindex_index: can't open index relation");
20021992

2003-
#ifndef OLD_FILE_NAMING
20041993
if (!inplace)
20051994
{
20061995
inplace = IsSharedSystemRelationName(NameStr(iRel->rd_rel->relname));
20071996
if (!inplace)
20081997
setNewRelfilenode(iRel);
20091998
}
2010-
#endif /* OLD_FILE_NAMING */
20111999
/* Obtain exclusive lock on it, just to be sure */
20122000
LockRelation(iRel, AccessExclusiveLock);
20132001

@@ -2084,9 +2072,6 @@ reindex_relation(Oid relid, bool force)
20842072
overwrite,
20852073
upd_pg_class_inplace;
20862074

2087-
#ifdef OLD_FILE_NAMING
2088-
overwrite = upd_pg_class_inplace = deactivate_needed = true;
2089-
#else
20902075
Relation rel;
20912076

20922077
overwrite = upd_pg_class_inplace = deactivate_needed = false;
@@ -2138,7 +2123,7 @@ reindex_relation(Oid relid, bool force)
21382123
elog(ERROR, "the target relation %u is shared", relid);
21392124
}
21402125
RelationClose(rel);
2141-
#endif /* OLD_FILE_NAMING */
2126+
21422127
old = SetReindexProcessing(true);
21432128
if (deactivate_needed)
21442129
{

src/backend/commands/indexcmds.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.47 2001/03/22 06:16:11 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.48 2001/05/30 20:52:32 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -654,13 +654,9 @@ ReindexIndex(const char *name, bool force /* currently unused */ )
654654
elog(ERROR, "relation \"%s\" is of type \"%c\"",
655655
name, ((Form_pg_class) GETSTRUCT(tuple))->relkind);
656656

657-
#ifdef OLD_FILE_NAMING
658-
if (!reindex_index(tuple->t_data->t_oid, force, false))
659-
#else
660657
if (IsIgnoringSystemIndexes())
661658
overwrite = true;
662659
if (!reindex_index(tuple->t_data->t_oid, force, overwrite))
663-
#endif /* OLD_FILE_NAMING */
664660
elog(NOTICE, "index \"%s\" wasn't reindexed", name);
665661

666662
ReleaseSysCache(tuple);

src/backend/tcop/utility.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.111 2001/05/27 09:59:29 petere Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.112 2001/05/30 20:52:32 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -891,18 +891,6 @@ ProcessUtility(Node *parsetree,
891891
break;
892892
case TABLE:
893893
relname = (char *) stmt->name;
894-
if (IsSystemRelationName(relname))
895-
{
896-
#ifdef OLD_FILE_NAMING
897-
if (!allowSystemTableMods && IsSystemRelationName(relname))
898-
elog(ERROR, "\"%s\" is a system table. call REINDEX under standalone postgres with -O -P options",
899-
relname);
900-
if (!IsIgnoringSystemIndexes())
901-
elog(ERROR, "\"%s\" is a system table. call REINDEX under standalone postgres with -P -O options",
902-
903-
relname);
904-
#endif /* OLD_FILE_NAMING */
905-
}
906894
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
907895
elog(ERROR, "%s: %s", relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
908896
ReindexTable(relname, stmt->force);

src/backend/utils/init/postinit.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.85 2001/05/08 21:06:43 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.86 2001/05/30 20:52:32 momjian Exp $
1212
*
1313
*
1414
*-------------------------------------------------------------------------
@@ -21,10 +21,7 @@
2121
#include <math.h>
2222
#include <unistd.h>
2323

24-
#ifndef OLD_FILE_NAMING
2524
#include "catalog/catalog.h"
26-
#endif
27-
2825
#include "access/heapam.h"
2926
#include "catalog/catname.h"
3027
#include "catalog/pg_database.h"

src/backend/utils/misc/database.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.46 2001/05/30 14:15:27 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.47 2001/05/30 20:52:34 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -140,19 +140,11 @@ GetRawDatabaseInfo(const char *name, Oid *db_id, char *path)
140140
Page pg;
141141
char *dbfname;
142142
Form_pg_database tup_db;
143+
RelFileNode rnode;
143144

144-
#ifdef OLD_FILE_NAMING
145-
dbfname = (char *) palloc(strlen(DataDir) + 8 + strlen(DatabaseRelationName) + 2);
146-
sprintf(dbfname, "%s/global/%s", DataDir, DatabaseRelationName);
147-
#else
148-
{
149-
RelFileNode rnode;
150-
151-
rnode.tblNode = 0;
152-
rnode.relNode = RelOid_pg_database;
153-
dbfname = relpath(rnode);
154-
}
155-
#endif
145+
rnode.tblNode = 0;
146+
rnode.relNode = RelOid_pg_database;
147+
dbfname = relpath(rnode);
156148

157149
if ((dbfd = open(dbfname, O_RDONLY | PG_BINARY, 0)) < 0)
158150
elog(FATAL, "cannot open %s: %m", dbfname);

src/include/catalog/catalog.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: catalog.h,v 1.16 2001/03/22 04:00:34 momjian Exp $
10+
* $Id: catalog.h,v 1.17 2001/05/30 20:52:34 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -16,20 +16,11 @@
1616

1717
#include "access/tupdesc.h"
1818

19-
#ifdef OLD_FILE_NAMING
20-
21-
extern char *relpath(const char *relname);
22-
extern char *relpath_blind(const char *dbname, const char *relname,
23-
Oid dbid, Oid relid);
24-
25-
#else
2619
#include "storage/relfilenode.h"
2720

2821
extern char *relpath(RelFileNode rnode);
2922
extern char *GetDatabasePath(Oid tblNode);
3023

31-
#endif
32-
3324
extern bool IsSystemRelationName(const char *relname);
3425
extern bool IsSharedSystemRelationName(const char *relname);
3526

src/include/catalog/index.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: index.h,v 1.34 2001/05/07 00:43:24 tgl Exp $
10+
* $Id: index.h,v 1.35 2001/05/30 20:52:34 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -50,10 +50,8 @@ extern void UpdateStats(Oid relid, double reltuples);
5050
extern bool IndexesAreActive(Oid relid, bool comfirmCommitted);
5151
extern void setRelhasindex(Oid relid, bool hasindex);
5252

53-
#ifndef OLD_FILE_NAMING
5453
extern void setNewRelfilenode(Relation relation);
5554

56-
#endif /* OLD_FILE_NAMING */
5755
extern bool SetReindexProcessing(bool processing);
5856
extern bool IsReindexProcessing(void);
5957

src/interfaces/odbc/connection.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
#ifndef __CONNECTION_H__
1010
#define __CONNECTION_H__
1111

12+
#include <stdlib.h>
13+
#include <string.h>
14+
1215
#ifdef HAVE_CONFIG_H
1316
#include "config.h"
1417
#endif

0 commit comments

Comments
 (0)