From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Clarify use of temporary tables within partition trees |
Date: | 2018-06-20 01:53:35 |
Message-ID: | E1fVSJT-0000Lw-Mu@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Clarify use of temporary tables within partition trees
Since their introduction, partition trees have been a bit lossy
regarding temporary relations. Inheritance trees respect the following
patterns:
1) a child relation can be temporary if the parent is permanent.
2) a child relation can be temporary if the parent is temporary.
3) a child relation cannot be permanent if the parent is temporary.
4) The use of temporary relations also imply that when both parent and
child need to be from the same sessions.
Partitions share many similar patterns with inheritance, however the
handling of the partition bounds make the situation a bit tricky for
case 1) as the partition code bases a lot of its lookup code upon
PartitionDesc which does not really look after relpersistence. This
causes for example a temporary partition created by session A to be
visible by another session B, preventing this session B to create an
extra partition which overlaps with the temporary one created by A with
a non-intuitive error message. There could be use-cases where mixing
permanent partitioned tables with temporary partitions make sense, but
that would be a new feature. Partitions respect 2), 3) and 4) already.
It is a bit depressing to see those error checks happening in
MergeAttributes() whose purpose is different, but that's left as future
refactoring work.
Back-patch down to 10, which is where partitioning has been introduced,
except that default partitions do not apply there. Documentation also
includes limitations related to the use of temporary tables with
partition trees.
Reported-by: David Rowley
Author: Amit Langote, Michael Paquier
Reviewed-by: Ashutosh Bapat, Amit Langote, Michael Paquier
Discussion: https://postgr.es/m/CAKJS1f94Ojk0og9GMkRHGt8wHTW=ijq5KzJKuoBoqWLwSVwGmw@mail.gmail.com
Branch
------
REL_10_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/5862174ec78a173c41710c5ef33feb993ae45cc7
Modified Files
--------------
doc/src/sgml/ddl.sgml | 10 ++++++++++
src/backend/commands/tablecmds.c | 21 +++++++++++++++++++++
src/test/regress/expected/alter_table.out | 16 ++++++++++++++++
src/test/regress/expected/create_table.out | 10 ++++++++++
src/test/regress/expected/foreign_data.out | 12 ++++++++++++
src/test/regress/sql/alter_table.sql | 15 +++++++++++++++
src/test/regress/sql/create_table.sql | 9 +++++++++
src/test/regress/sql/foreign_data.sql | 11 +++++++++++
8 files changed, 104 insertions(+)
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2018-06-20 02:54:21 | pgsql: Don't consider parallel append for parallel unsafe paths. |
Previous Message | Tom Lane | 2018-06-19 23:30:55 | pgsql: Clarify the README files for the various separate TAP-based test |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2018-06-20 01:54:39 | Re: Partitioning with temp tables is broken |
Previous Message | David Rowley | 2018-06-20 01:20:21 | Re: Internal error XX000 with enable_partition_pruning=on, pg 11 beta1 on Debian |