pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: default_tablespace doc and partitioned rels
Date: Fri, 16 Apr 2021 16:19:18 -0400
Message-ID: <20210416201918.GA4771@alvherre.pgsql> (raw)
In-Reply-To: <20210416143135.GI3315@telsasoft.com>

On 2021-Apr-16, Justin Pryzby wrote:

> +++ 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>
> 
> default_tablespace is a global GUC, so if a partitioned relation "directs"
> partitions anywhere, it's not to the fallback value of the GUC, but to its
> reltablespace, as this patch wrote in doc/src/sgml/ref/create_table.sgml:

Yes, but also the partitioned table's reltablespace is going to be set
to default_tablespace, if no tablespace is explicitly specified in the
partitioned table creation.

A partitioned table is not created anywhere itself; the only thing it
can do, is direct where are future partitions created.  I don't think
it's 100% obvious that default_tablespace will become the partitioned
table's tablespace, which is why I added that phrase.  I understand that
the language might be unclear, but I don't think either of your
suggestions make this any clearer.  Removing it just hides the behavior,
and this one:

> +        ... It also determines the tablespace where new partitions are created,
> +        if the parent, partitioned relation doesn't have a tablespace set.

just documents that default_tablespace will be in effect at partition
CREATE time, but it fails to remind the user that the partitioned table
will acquire default_tablespace as its own tablespace.

Maybe we can reword it in some other way.  "If this parameter is set
when a partitioned table is created, it will become the default
tablespace for future partitions too, even if default_tablespace itself
is reset later" ...??

-- 
Álvaro Herrera                            39°49'30"S 73°17'W
"En las profundidades de nuestro inconsciente hay una obsesiva necesidad
de un universo lógico y coherente. Pero el universo real se halla siempre
un paso más allá de la lógica" (Irulan)





view thread (4+ messages)  latest in thread

Message-ID: <20210416201918.GA4771@alvherre.pgsql>
Permalink:  ../20210416201918.GA4771@alvherre.pgsql/
Also on:    postgresql.org/message-id/20210416201918.GA4771@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, pryzby@telsasoft.com
  Subject: Re: default_tablespace doc and partitioned rels
  In-Reply-To: <20210416201918.GA4771@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox