Re: default_tablespace doc and partitioned rels - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: default_tablespace doc and partitioned rels
Date
Msg-id 20210416201918.GA4771@alvherre.pgsql
Whole thread Raw
In response to default_tablespace doc and partitioned rels  (Justin Pryzby <pryzby@telsasoft.com>)
Responses Re: default_tablespace doc and partitioned rels
List 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)



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: ANALYZE counts LP_DEAD line pointers as n_dead_tup
Next
From: Tom Lane
Date:
Subject: Re: Bogus collation version recording in recordMultipleDependencies