Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6517f37

Browse files
committed
Implement ALTER DATABASE SET TABLESPACE to move a whole database (or at least
as much of it as lives in its default tablespace) to a new tablespace.Guillaume Lelarge, with some help from Bernd Helmle and Tom Lane
1 parent85e2ced commit6517f37

File tree

8 files changed

+437
-13
lines changed

8 files changed

+437
-13
lines changed

‎doc/src/sgml/ref/alter_database.sgml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_database.sgml,v 1.20 2007/09/03 18:46:29 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_database.sgml,v 1.21 2008/11/07 18:25:06 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -30,6 +30,8 @@ ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RENAME TO <repl
3030

3131
ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> OWNER TO <replaceable>new_owner</replaceable>
3232

33+
ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> SET TABLESPACE <replaceable class="PARAMETER">new_tablespace</replaceable>
34+
3335
ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> SET <replaceable>configuration_parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT }
3436
ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> SET <replaceable>configuration_parameter</replaceable> FROM CURRENT
3537
ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RESET <replaceable>configuration_parameter</replaceable>
@@ -67,6 +69,15 @@ ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RESET ALL
6769
(Note that superusers have all these privileges automatically.)
6870
</para>
6971

72+
<para>
73+
The fourth form changes the default tablespace of the database.
74+
Only the database owner or a superuser can do this; you must also have
75+
create privilege for the new tablespace.
76+
This command physically moves any tables or indexes in the database's old
77+
default tablespace to the new tablespace. Note that tables and indexes
78+
in non-default tablespaces are not affected.
79+
</para>
80+
7081
<para>
7182
The remaining forms change the session default for a run-time
7283
configuration variable for a <productname>PostgreSQL</productname>
@@ -122,6 +133,15 @@ ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RESET ALL
122133
</listitem>
123134
</varlistentry>
124135

136+
<varlistentry>
137+
<term><replaceable class="parameter">new_tablespace</replaceable></term>
138+
<listitem>
139+
<para>
140+
The new default tablespace of the database.
141+
</para>
142+
</listitem>
143+
</varlistentry>
144+
125145
<varlistentry>
126146
<term><replaceable>configuration_parameter</replaceable></term>
127147
<term><replaceable>value</replaceable></term>
@@ -189,6 +209,7 @@ ALTER DATABASE test SET enable_indexscan TO off;
189209
<member><xref linkend="sql-createdatabase" endterm="sql-createdatabase-title"></member>
190210
<member><xref linkend="sql-dropdatabase" endterm="sql-dropdatabase-title"></member>
191211
<member><xref linkend="sql-set" endterm="sql-set-title"></member>
212+
<member><xref linkend="sql-createtablespace" endterm="sql-createtablespace-title"></member>
192213
</simplelist>
193214
</refsect1>
194215
</refentry>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp