Re: Declarative partitioning - another take
Amit Langote <langote_amit_f8@lab.ntt.co.jp>
Attachments
- 0001-Miscallaneous-code-and-comment-improvements.patch (text/x-diff)
Hi,
On 2016/12/13 2:45, Dmitry Ivanov wrote:
> Huh, this code is broken as well. We have to ignore partitions that don't
> have any subpartitions. Patch is attached below (v2).
Good catch and thanks a lot for the patch! I have revised it a bit and
added some explanatory comments to that function.
Attaching the above patch, along with some other patches posted earlier,
and one more patch fixing another bug I found. Patch descriptions follow:
0001-Miscallaneous-code-and-comment-improvements.patch
Fixes some obsolete comments while improving others. Also, implements
some of Tomas Vondra's review comments.
0002-Miscallaneous-documentation-improvements.patch
Fixes inconsistencies and improves some examples in the documentation.
Also, mentions the limitation regarding row movement.
0003-Invalidate-the-parent-s-relcache-after-partition-cre.patch
Fixes a bug reported by Tomas, whereby a parent's relcache was not
invalidated after creation of a new partition using CREATE TABLE PARTITION
OF. This resulted in tuple-routing code not being to able to find a
partition that was created by the last command in a given transaction.
0004-Fix-a-bug-of-insertion-into-an-internal-partition.patch
Fixes a bug I found this morning, whereby an internal partition's
constraint would not be enforced if it is targeted directly. See example
below:
create table p (a int, b char) partition by range (a);
create table p1 partition of p for values from (1) to (10) partition by
list (b);
create table p1a partition of p1 for values in ('a');
insert into p1 values (0, 'a'); -- should fail, but doesn't
0005-Fix-a-tuple-routing-bug-in-multi-level-partitioned-t.patch
Fixes a bug discovered by Dmitry Ivanov, whereby wrong indexes were
assigned to the partitions of lower levels (level > 1), causing spurious
"partition not found" error as demonstrated in his email [1].
Sorry about sending some of these patches repeatedly though.
Thanks,
Amit
[1]
https://www.postgresql.org/message-id/e6c56fe9-4b87-4f64-ac6f-bc99675f3f9e%40postgrespro.ru
Commits
-
Fix typo.
- 03bf59676ea0 10.0 landed
-
Document trigger-firing behavior for inheritance/partitioning.
- e17628145ac3 10.0 landed
-
Fire per-statement triggers on partitioned tables.
- e180c8aa8caf 10.0 landed
-
Set ecxt_scantuple correctly for tuple routing.
- 132488bfee68 10.0 landed
-
Fix interaction of partitioned tables with BulkInsertState.
- b1ecb9b3fcfb 10.0 landed
-
Avoid core dump for empty prepared statement in an aborted transaction.
- ba61a04bc7fe 10.0 cited
-
Fix some problems in check_new_partition_bound().
- 8a8afe2f54c2 10.0 landed
-
Remove unnecessary arguments from partitioning functions.
- 18fc5192a631 10.0 cited
-
Fix reporting of constraint violations for table partitioning.
- f1b4c771ea74 10.0 cited
-
Fix tuple routing in cases where tuple descriptors don't match.
- 2ac3ef7a01df 10.0 cited
-
Invalid parent's relcache after CREATE TABLE .. PARTITION OF.
- 7cd0fd655d68 10.0 landed
-
Doc: improve documentation about inheritance.
- 162477a63d3c 10.0 cited