mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Remove spclocation field from pg_tablespace
Instead, add a function pg_tablespace_location(oid) used to return the same information, and do this by reading the symbolic link. Doing it this way makes it possible to relocate a tablespace when the database is down by simply changing the symbolic link.
This commit is contained in:
@ -44,12 +44,18 @@ get_tablespace_paths(void)
|
||||
PGresult *res;
|
||||
int tblnum;
|
||||
int i_spclocation;
|
||||
char query[QUERY_ALLOC];
|
||||
|
||||
res = executeQueryOrDie(conn,
|
||||
"SELECT spclocation "
|
||||
"FROM pg_catalog.pg_tablespace "
|
||||
"WHERE spcname != 'pg_default' AND "
|
||||
" spcname != 'pg_global'");
|
||||
snprintf(query, sizeof(query),
|
||||
"SELECT %s "
|
||||
"FROM pg_catalog.pg_tablespace "
|
||||
"WHERE spcname != 'pg_default' AND "
|
||||
" spcname != 'pg_global'",
|
||||
/* 9.2 removed the spclocation column */
|
||||
(GET_MAJOR_VERSION(old_cluster.major_version) <= 901) ?
|
||||
"t.spclocation" : "pg_catalog.pg_tablespace_location(oid) AS spclocation");
|
||||
|
||||
res = executeQueryOrDie(conn, "%s", query);
|
||||
|
||||
if ((os_info.num_tablespaces = PQntuples(res)) != 0)
|
||||
os_info.tablespaces = (char **) pg_malloc(
|
||||
|
Reference in New Issue
Block a user