Re: Declarative partitioning - another take
Amit Langote <amitlangote09@gmail.com>
Hi, On Tue, Sep 6, 2016 at 8:15 PM, Rajkumar Raghuwanshi <rajkumar.raghuwanshi@enterprisedb.com> wrote: > Hi, > > I have applied updated patches given by you, and observe below. > > here in the given example, t6_p3 partition is not allowed to have null, but > I am able to insert it, causing two nulls in the table. > > --create a partition table > create table t6 (a int, b varchar) partition by list(a); > create table t6_p1 partition of t6 for values in (1,2,null); > create table t6_p2 partition of t6 for values in (4,5); > create table t6_p3 partition of t6 for values in (3,6); > > --insert some values > insert into t6 select i,i::varchar from generate_series(1,6) i; > insert into t6 values (null,'A'); > > --try inserting null to t6_p3 partition table > insert into t6_p3 values (null,'A'); > > select tableoid::regclass,* from t6; > tableoid | a | b > ----------+---+--- > t6_p1 | 1 | 1 > t6_p1 | 2 | 2 > t6_p1 | | A > t6_p2 | 4 | 4 > t6_p2 | 5 | 5 > t6_p3 | 3 | 3 > t6_p3 | 6 | 6 > t6_p3 | | A > (8 rows) Thanks for testing! That looks like a bug. The same won't occur if you had inserted through the parent (it would be correctly routed to the partition that has been defined to accept nulls (that is, t6_p1 of your example). The bug seems to have to do with the handling of nulls in generating implicit constraints from the list of values of a given list partition. The direct insert on t6_p1 should have failed because partition key has a value (null) violating the partition boundary condition. Will fix. Thanks, Amit
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