1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-21 05:21:08 +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:
Tom Lane
2004-11-05 19:17:13 +00:00
parent 0ed3c7665e
commit 98e8b48053
37 changed files with 370 additions and 585 deletions

View File

@@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_index.sgml,v 1.49 2004/07/12 01:22:53 momjian Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/create_index.sgml,v 1.50 2004/11/05 19:15:51 tgl Exp $
PostgreSQL documentation
-->
@@ -186,7 +186,9 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">name</replaceable> ON <re
<listitem>
<para>
The tablespace in which to create the index. If not specified,
the tablespace of the parent table is used.
<xref linkend="guc-default-tablespace"> is used, or the database's
default tablespace if <varname>default_tablespace</> is an empty
string.
</para>
</listitem>
</varlistentry>

View File

@@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_schema.sgml,v 1.15 2004/09/01 14:09:19 tgl Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/create_schema.sgml,v 1.16 2004/11/05 19:15:51 tgl Exp $
PostgreSQL documentation
-->
@@ -20,8 +20,8 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
CREATE SCHEMA <replaceable class="parameter">schemaname</replaceable> [ AUTHORIZATION <replaceable class="parameter">username</replaceable> ] [ TABLESPACE <replaceable class="parameter">tablespace</replaceable> ] [ <replaceable class="parameter">schema_element</replaceable> [ ... ] ]
CREATE SCHEMA AUTHORIZATION <replaceable class="parameter">username</replaceable> [ TABLESPACE <replaceable class="parameter">tablespace</replaceable> ] [ <replaceable class="parameter">schema_element</replaceable> [ ... ] ]
CREATE SCHEMA <replaceable class="parameter">schemaname</replaceable> [ AUTHORIZATION <replaceable class="parameter">username</replaceable> ] [ <replaceable class="parameter">schema_element</replaceable> [ ... ] ]
CREATE SCHEMA AUTHORIZATION <replaceable class="parameter">username</replaceable> [ <replaceable class="parameter">schema_element</replaceable> [ ... ] ]
</synopsis>
</refsynopsisdiv>
@@ -82,17 +82,6 @@ CREATE SCHEMA AUTHORIZATION <replaceable class="parameter">username</replaceable
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">tablespace</replaceable></term>
<listitem>
<para>
The name of the tablespace that is to be the default tablespace
for all new objects created in the schema. If not supplied, the schema
will inherit the default tablespace of the database.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">schema_element</replaceable></term>
<listitem>
@@ -116,9 +105,7 @@ CREATE SCHEMA AUTHORIZATION <replaceable class="parameter">username</replaceable
<para>
To create a schema, the invoking user must have the
<literal>CREATE</> privilege for the current database.
Also, the <literal>TABLESPACE</> option requires having
<literal>CREATE</> privilege for the specified tablespace.
(Of course, superusers bypass these checks.)
(Of course, superusers bypass this check.)
</para>
</refsect1>
@@ -161,15 +148,6 @@ CREATE VIEW hollywood.winners AS
</programlisting>
</para>
<para>
Create a schema <literal>sales</> whose tables and indexes
will be stored in the tablespace <literal>mirrorspace</> by default:
<programlisting>
CREATE SCHEMA sales TABLESPACE mirrorspace;
</programlisting>
</para>
</refsect1>
<refsect1>
@@ -206,7 +184,6 @@ CREATE SCHEMA sales TABLESPACE mirrorspace;
<simplelist type="inline">
<member><xref linkend="sql-alterschema" endterm="sql-alterschema-title"></member>
<member><xref linkend="sql-dropschema" endterm="sql-dropschema-title"></member>
<member><xref linkend="sql-createtablespace" endterm="sql-createtablespace-title"></member>
</simplelist>
</refsect1>

View File

@@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_table.sgml,v 1.85 2004/10/21 21:33:59 tgl Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/create_table.sgml,v 1.86 2004/11/05 19:15:51 tgl Exp $
PostgreSQL documentation
-->
@@ -603,8 +603,11 @@ and <replaceable class="PARAMETER">table_constraint</replaceable> is:
<listitem>
<para>
The <replaceable class="PARAMETER">tablespace</replaceable> is the name
of the tablespace in which the new table is to be created. If not
supplied, the default tablespace of the table's schema will be used.
of the tablespace in which the new table is to be created.
If not specified,
<xref linkend="guc-default-tablespace"> is used, or the database's
default tablespace if <varname>default_tablespace</> is an empty
string.
</para>
</listitem>
</varlistentry>
@@ -615,8 +618,11 @@ and <replaceable class="PARAMETER">table_constraint</replaceable> is:
<para>
This clause allows selection of the tablespace in which the index
associated with a <literal>UNIQUE</literal> or <literal>PRIMARY
KEY</literal> constraint will be created. If not supplied, the index
will be created in the same tablespace as the table.
KEY</literal> constraint will be created.
If not specified,
<xref linkend="guc-default-tablespace"> is used, or the database's
default tablespace if <varname>default_tablespace</> is an empty
string.
</para>
</listitem>
</varlistentry>

View File

@@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_tablespace.sgml,v 1.4 2004/08/24 00:06:51 neilc Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/create_tablespace.sgml,v 1.5 2004/11/05 19:15:51 tgl Exp $
PostgreSQL documentation
-->
@@ -41,8 +41,8 @@ CREATE TABLESPACE <replaceable class="parameter">tablespacename</replaceable> [
<para>
A user with appropriate privileges can pass
<replaceable class="parameter">tablespacename</> to <command>CREATE
DATABASE</>, <command>CREATE SCHEMA</>, <command>CREATE TABLE</>,
<replaceable class="parameter">tablespacename</> to
<command>CREATE DATABASE</>, <command>CREATE TABLE</>,
<command>CREATE INDEX</> or <command>ADD CONSTRAINT</> to have the data
files for these objects stored within the specified tablespace.
</para>
@@ -130,7 +130,6 @@ CREATE TABLESPACE indexspace OWNER genevieve LOCATION '/data/indexes';
<simplelist type="inline">
<member><xref linkend="sql-createdatabase" endterm="sql-createdatabase-title"></member>
<member><xref linkend="sql-createschema" endterm="sql-createschema-title"></member>
<member><xref linkend="sql-createtable" endterm="sql-createtable-title"></member>
<member><xref linkend="sql-createindex" endterm="sql-createindex-title"></member>
<member><xref linkend="sql-droptablespace" endterm="sql-droptablespace-title"></member>

View File

@@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.43 2004/09/01 04:13:11 tgl Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.44 2004/11/05 19:15:51 tgl Exp $
PostgreSQL documentation
-->
@@ -29,10 +29,6 @@ GRANT { { CREATE | TEMPORARY | TEMP } [,...] | ALL [ PRIVILEGES ] }
ON DATABASE <replaceable>dbname</replaceable> [, ...]
TO { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
GRANT { CREATE | ALL [ PRIVILEGES ] }
ON TABLESPACE <replaceable>tablespacename</> [, ...]
TO { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
GRANT { EXECUTE | ALL [ PRIVILEGES ] }
ON FUNCTION <replaceable>funcname</replaceable> ([<replaceable>type</replaceable>, ...]) [, ...]
TO { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
@@ -44,6 +40,10 @@ GRANT { USAGE | ALL [ PRIVILEGES ] }
GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
ON SCHEMA <replaceable>schemaname</replaceable> [, ...]
TO { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
GRANT { CREATE | ALL [ PRIVILEGES ] }
ON TABLESPACE <replaceable>tablespacename</> [, ...]
TO { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
</synopsis>
</refsynopsisdiv>
@@ -52,8 +52,8 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
<para>
The <command>GRANT</command> command gives specific privileges on
an object (table, view, sequence, database, tablespace, function,
procedural language, or schema) to
an object (table, view, sequence, database, function,
procedural language, schema, or tablespace) to
one or more users or groups of users. These privileges are added
to those already granted, if any.
</para>
@@ -188,17 +188,17 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
<para>
For databases, allows new schemas to be created within the database.
</para>
<para>
For tablespaces, allows tables to be created within the tablespace,
and allows databases and schemas to be created that have the tablespace
as their default tablespace. (Note that revoking this privilege
will not alter the behavior of existing databases and schemas.)
</para>
<para>
For schemas, allows new objects to be created within the schema.
To rename an existing object, you must own the object <emphasis>and</>
have this privilege for the containing schema.
</para>
<para>
For tablespaces, allows tables and indexes to be created within the
tablespace, and allows databases to be created that have the tablespace
as their default tablespace. (Note that revoking this privilege
will not alter the placement of existing objects.)
</para>
</listitem>
</varlistentry>

View File

@@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/revoke.sgml,v 1.31 2004/06/18 06:13:05 tgl Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/revoke.sgml,v 1.32 2004/11/05 19:15:52 tgl Exp $
PostgreSQL documentation
-->
@@ -33,12 +33,6 @@ REVOKE [ GRANT OPTION FOR ]
FROM { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...]
[ CASCADE | RESTRICT ]
REVOKE [ GRANT OPTION FOR ]
{ CREATE | ALL [ PRIVILEGES ] }
ON TABLESPACE <replaceable>tablespacename</replaceable> [, ...]
FROM { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...]
[ CASCADE | RESTRICT ]
REVOKE [ GRANT OPTION FOR ]
{ EXECUTE | ALL [ PRIVILEGES ] }
ON FUNCTION <replaceable>funcname</replaceable> ([<replaceable>type</replaceable>, ...]) [, ...]
@@ -56,6 +50,12 @@ REVOKE [ GRANT OPTION FOR ]
ON SCHEMA <replaceable>schemaname</replaceable> [, ...]
FROM { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...]
[ CASCADE | RESTRICT ]
REVOKE [ GRANT OPTION FOR ]
{ CREATE | ALL [ PRIVILEGES ] }
ON TABLESPACE <replaceable>tablespacename</replaceable> [, ...]
FROM { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...]
[ CASCADE | RESTRICT ]
</synopsis>
</refsynopsisdiv>