diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-07-04 04:51:52 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-07-04 04:51:52 +0000 |
commit | eb5949d190e80360386113fde0f05854f0c9824d (patch) | |
tree | f5683b4ff77c0b311ae975817b88c5ccc65ce5a9 /src/backend/utils/adt/misc.c | |
parent | 7504f0bae853b0b9fec03c8e361c8b1a4b1c3209 (diff) | |
download | postgresql-eb5949d190e80360386113fde0f05854f0c9824d.tar.gz postgresql-eb5949d190e80360386113fde0f05854f0c9824d.zip |
Arrange for the postmaster (and standalone backends, initdb, etc) to
chdir into PGDATA and subsequently use relative paths instead of absolute
paths to access all files under PGDATA. This seems to give a small
performance improvement, and it should make the system more robust
against naive DBAs doing things like moving a database directory that
has a live postmaster in it. Per recent discussion.
Diffstat (limited to 'src/backend/utils/adt/misc.c')
-rw-r--r-- | src/backend/utils/adt/misc.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c index 45532539664..867f7da7e2a 100644 --- a/src/backend/utils/adt/misc.c +++ b/src/backend/utils/adt/misc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.44 2005/06/19 21:34:02 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.45 2005/07/04 04:51:50 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -145,10 +145,10 @@ pg_tablespace_databases(PG_FUNCTION_ARGS) fctx = palloc(sizeof(ts_db_fctx)); /* - * size = path length + tablespace dirname length + 2 dir sep - * chars + oid + terminator + * size = tablespace dirname length + dir sep + * char + oid + terminator */ - fctx->location = (char *) palloc(strlen(DataDir) + 11 + 10 + 1); + fctx->location = (char *) palloc(10 + 10 + 1); if (tablespaceOid == GLOBALTABLESPACE_OID) { fctx->dirdesc = NULL; @@ -158,10 +158,9 @@ pg_tablespace_databases(PG_FUNCTION_ARGS) else { if (tablespaceOid == DEFAULTTABLESPACE_OID) - sprintf(fctx->location, "%s/base", DataDir); + sprintf(fctx->location, "base"); else - sprintf(fctx->location, "%s/pg_tblspc/%u", DataDir, - tablespaceOid); + sprintf(fctx->location, "pg_tblspc/%u", tablespaceOid); fctx->dirdesc = AllocateDir(fctx->location); |