Re: Declarative partitioning - another take
Jaime Casanova <jaime.casanova@2ndquadrant.com>
Attachments
- failing_test_1.sql (application/sql)
- failing_test_2.sql (application/sql)
On 28 October 2016 at 02:53, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> wrote: > > Please find attached the latest version of the patches Hi, I started to review the functionality of this patch, so i applied all 9 patches. After that i found this warning, which i guess is because it needs a cast. After that, i tried a case that i think is important: to partition an already existing table. Because there is no ALTER TABL SET PARTITION or something similar (which i think makes sense because such a command would need to create the partitions and move the rows to follow the rule that there is no rows in a parent table). So, what i tried was: 1) rename original table 2) create a new partitioned table with old name 3) attach old table as a partition with bounds outside normal bounds and no validate the idea is to start attaching valid partitions and delete and insert rows from the invalid one (is there a better way of doing that?), that will allow to partition a table easily. So far so good, until i decided points 1 to 3 should happen inside a transaction to make things transparent to the user. Attached is script that shows the failure when trying it: script 1 (failing_test_1.sql) fails the assert "Assert(RelationGetPartitionKey(parentRel) != NULL);" in transformAttachPartition() at src/backend/parser/parse_utilcmd.c:3164 After that i tried the same but with an already partitioned (via inheritance) table and got this (i did this first without a transaction, doing it with a transaction will show the same failure as before): script 2 (failing_test_2.sql) fails the assert "Assert(childrte->relkind == RELKIND_PARTITIONED_TABLE);" in expand_inherited_rte_internal() at src/backend/optimizer/prep/prepunion.c:1551 PS: i don't like the START END syntax but i don't have any ideas there... except, there was a reason not to use expressions (like a CHECK constraint?) -- Jaime Casanova www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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