mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Create 'default_tablespace' GUC variable that supplies a TABLESPACE
clause implicitly whenever one is not given explicitly. Remove concept of a schema having an associated tablespace, and simplify the rules for selecting a default tablespace for a table or index. It's now just (a) explicit TABLESPACE clause; (b) default_tablespace if that's not an empty string; (c) database's default. This will allow pg_dump to use SET commands instead of tablespace clauses to determine object locations (but I didn't actually make it do so). All per recent discussions.
This commit is contained in:
58
src/backend/utils/cache/lsyscache.c
vendored
58
src/backend/utils/cache/lsyscache.c
vendored
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.117 2004/10/20 16:04:49 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.118 2004/11/05 19:16:14 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Eventually, the index information should go through here, too.
|
||||
@ -985,34 +985,6 @@ get_rel_namespace(Oid relid)
|
||||
return InvalidOid;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_rel_tablespace
|
||||
* Returns the pg_tablespace OID associated with a given relation.
|
||||
*
|
||||
* Note: failure return is InvalidOid, which cannot be distinguished from
|
||||
* "default tablespace for this database", but that seems OK.
|
||||
*/
|
||||
Oid
|
||||
get_rel_tablespace(Oid relid)
|
||||
{
|
||||
HeapTuple tp;
|
||||
|
||||
tp = SearchSysCache(RELOID,
|
||||
ObjectIdGetDatum(relid),
|
||||
0, 0, 0);
|
||||
if (HeapTupleIsValid(tp))
|
||||
{
|
||||
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
|
||||
Oid result;
|
||||
|
||||
result = reltup->reltablespace;
|
||||
ReleaseSysCache(tp);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
return InvalidOid;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_rel_type_id
|
||||
*
|
||||
@ -2044,34 +2016,6 @@ get_namespace_name(Oid nspid)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_namespace_tablespace
|
||||
* Returns the default tablespace of a given namespace
|
||||
*
|
||||
* Note: failure return is InvalidOid, which cannot be distinguished from
|
||||
* "default tablespace for this database", but that seems OK.
|
||||
*/
|
||||
Oid
|
||||
get_namespace_tablespace(Oid nspid)
|
||||
{
|
||||
HeapTuple tp;
|
||||
|
||||
tp = SearchSysCache(NAMESPACEOID,
|
||||
ObjectIdGetDatum(nspid),
|
||||
0, 0, 0);
|
||||
if (HeapTupleIsValid(tp))
|
||||
{
|
||||
Form_pg_namespace nsptup = (Form_pg_namespace) GETSTRUCT(tp);
|
||||
Oid result;
|
||||
|
||||
result = nsptup->nsptablespace;
|
||||
ReleaseSysCache(tp);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
return InvalidOid;
|
||||
}
|
||||
|
||||
/* ---------- PG_SHADOW CACHE ---------- */
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user