Re: Declarative partitioning - another take
Amit Langote <langote_amit_f8@lab.ntt.co.jp>
Hi Keith, On 2017/01/20 12:40, Keith Fiske wrote: > So testing things out in pg_partman for native sub-partitioning and ran > into what is a bug for me that I know I have to fix, but I'm curious if > this can be prevented in the first place within the native partitioning > code itself. The below shows a sub-partitioning set where the sub-partition > has a constraint range that is outside of the range of its parent. If the > columns were different I could see where this would be allowed, but the > same column is used throughout the levels of sub-partitioning. > Understandable if that may be too complex to check for, but figured I'd > bring it up as something I accidentally ran into in case you see an easy > way to prevent it. This was discussed. See Robert's response (2nd part of): https://www.postgresql.org/message-id/CA%2BTgmoaQABrsLQK4ms_4NiyavyJGS-b6ZFkZBBNC%2B-P5DjJNFA%40mail.gmail.com In short, defining partitions across different levels such that the data user intended to insert into the table (the part of the sub-partition's range that doesn't overlap with its parent's) couldn't be, that's an operator error. It's like adding contradictory check constraints to the table: create table foo (a int check (a > 0 and a < 0)); insert into foo values (1); ERROR: new row for relation "foo" violates check constraint "foo_a_check" DETAIL: Failing row contains (1). One (perhaps the only) thing that could be done is to warn users to prevent this kind of mistake through documentation. Trying to do anything else in the core partitioning code is making it too complicated for not much benefit (also see Robert's last line, :)). 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