Re: default_tablespace doc and partitioned rels

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: default_tablespace doc and partitioned rels
Date: 2021-04-16 20:19:18
Message-ID: 20210416201918.GA4771@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-04-16 20:39:39 Re: Bogus collation version recording in recordMultipleDependencies
Previous Message Peter Geoghegan 2021-04-16 20:16:07 Re: ANALYZE counts LP_DEAD line pointers as n_dead_tup