aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2019-04-25 10:20:23 -0400
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2019-04-25 10:31:32 -0400
commit87259588d0ab0b8e742e30596afa7ae25caadb18 (patch)
tree965b3dc1c2f09fe30a7a6968d28ee0b0bb5378fa /doc/src
parent3b23552ad8bbb1384381b67f860019d14d5b680e (diff)
downloadpostgresql-87259588d0ab0b8e742e30596afa7ae25caadb18.tar.gz
postgresql-87259588d0ab0b8e742e30596afa7ae25caadb18.zip
Fix tablespace inheritance for partitioned rels
Commit ca4103025dfe left a few loose ends. The most important one (broken pg_dump output) is already fixed by virtue of commit 3b23552ad8bb, but some things remained: * When ALTER TABLE rewrites tables, the indexes must remain in the tablespace they were originally in. This didn't work because index recreation during ALTER TABLE runs manufactured SQL (yuck), which runs afoul of default_tablespace in competition with the parent relation tablespace. To fix, reset default_tablespace to the empty string temporarily, and add the TABLESPACE clause as appropriate. * Setting a partitioned rel's tablespace to the database default is confusing; if it worked, it would direct the partitions to that tablespace regardless of default_tablespace. But in reality it does not work, and making it work is a larger project. Therefore, throw an error when this condition is detected, to alert the unwary. Add some docs and tests, too. Author: Álvaro Herrera Discussion: https://postgr.es/m/CAKJS1f_1c260nOt_vBJ067AZ3JXptXVRohDVMLEBmudX1YEx-A@mail.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/config.sgml3
-rw-r--r--doc/src/sgml/ref/create_table.sgml6
2 files changed, 5 insertions, 4 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 189219ad88d..dbe3026d051 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -7356,7 +7356,8 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
<para>
This variable specifies the default tablespace in which to create
objects (tables and indexes) when a <command>CREATE</command> command does
- not explicitly specify a tablespace.
+ not explicitly specify a tablespace. It also determines the tablespace
+ that a partitioned relation will direct future partitions to.
</para>
<para>
diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml
index 77c254862b6..786510f94ca 100644
--- a/doc/src/sgml/ref/create_table.sgml
+++ b/doc/src/sgml/ref/create_table.sgml
@@ -1265,9 +1265,9 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
<xref linkend="guc-default-tablespace"/> is consulted, or
<xref linkend="guc-temp-tablespaces"/> if the table is temporary. For
partitioned tables, since no storage is required for the table itself,
- the tablespace specified here only serves to mark the default tablespace
- for any newly created partitions when no other tablespace is explicitly
- specified.
+ the tablespace specified overrides <literal>default_tablespace</literal>
+ as the default tablespace to use for any newly created partitions when no
+ other tablespace is explicitly specified.
</para>
</listitem>
</varlistentry>