postgresql/src/backend/commands
Michael Paquier 1c7c317cd9 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
2018-06-20 10:42:25 +09:00
..
aggregatecmds.c Improve spelling of new FINALFUNC_MODIFY aggregate attribute. 2018-05-21 11:41:42 -04:00
alter.c Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
amcmds.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
analyze.c Rename IndexInfo.ii_KeyAttrNumbers array 2018-04-12 13:02:45 +03:00
async.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
cluster.c Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
collationcmds.c Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers. 2018-04-08 14:35:29 -04:00
comment.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
constraint.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
conversioncmds.c Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers. 2018-04-08 14:35:29 -04:00
copy.c Don't needlessly check the partition contraint twice 2018-06-11 17:12:16 -04:00
createas.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
dbcommands.c Rename TransactionChain functions 2018-03-16 13:18:06 -04:00
define.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
discard.c Rename TransactionChain functions 2018-03-16 13:18:06 -04:00
dropcmds.c Add prokind column, replacing proisagg and proiswindow 2018-03-02 13:48:33 -05:00
event_trigger.c Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
explain.c Clean up warnings from -Wimplicit-fallthrough. 2018-05-01 19:35:08 -04:00
extension.c Replace AclObjectKind with ObjectType 2018-01-19 14:01:15 -05:00
foreigncmds.c Replace AclObjectKind with ObjectType 2018-01-19 14:01:15 -05:00
functioncmds.c Adjust hints and docs to suggest CREATE EXTENSION not CREATE LANGUAGE. 2018-04-27 13:42:03 -04:00
indexcmds.c Clean up warnings from -Wimplicit-fallthrough. 2018-05-01 19:35:08 -04:00
lockcmds.c Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
Makefile Implement multivariate n-distinct coefficients 2017-03-24 14:06:10 -03:00
matview.c Indexes with INCLUDE columns and their support in B-tree 2018-04-07 23:00:39 +03:00
opclasscmds.c Support all SQL:2011 options for window frame clauses. 2018-02-07 00:06:56 -05:00
operatorcmds.c Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers. 2018-04-08 14:35:29 -04:00
policy.c Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
portalcmds.c Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
prepare.c Revert MERGE patch 2018-04-12 11:22:56 +01:00
proclang.c Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers. 2018-04-08 14:35:29 -04:00
publicationcmds.c Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers. 2018-04-08 14:35:29 -04:00
schemacmds.c Replace AclObjectKind with ObjectType 2018-01-19 14:01:15 -05:00
seclabel.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
sequence.c Combine options for RangeVarGetRelidExtended() into a flags argument. 2018-03-30 17:05:16 -07:00
statscmds.c Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
subscriptioncmds.c Split the SetSubscriptionRelState function into two 2018-04-06 10:00:26 -04:00
tablecmds.c Clarify use of temporary tables within partition trees 2018-06-20 10:42:25 +09:00
tablespace.c Refactor dir/file permissions 2018-04-07 17:45:39 -04:00
trigger.c Clean up warnings from -Wimplicit-fallthrough. 2018-05-01 19:35:08 -04:00
tsearchcmds.c Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers. 2018-01-26 18:25:14 -05:00
typecmds.c Fix a couple minor typos 2018-04-20 19:04:54 -04:00
user.c Replace AclObjectKind with ObjectType 2018-01-19 14:01:15 -05:00
vacuum.c Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers. 2018-04-08 14:35:29 -04:00
vacuumlazy.c Further cleanup of client dependencies on src/include/catalog headers. 2018-04-09 14:39:58 -04:00
variable.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
view.c Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers. 2018-01-26 18:25:14 -05:00