Re: Declarative partitioning - another take
От | Jaime Casanova |
---|---|
Тема | Re: Declarative partitioning - another take |
Дата | |
Msg-id | CAJGNTeMKP0+QBUrSQMgzAc0zwBTuCGCRWzRE=8T26oN4ZOFtxA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Declarative partitioning - another take (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>) |
Ответы |
Re: Declarative partitioning - another take
Re: Declarative partitioning - another take |
Список | pgsql-hackers |
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
Вложения
В списке pgsql-hackers по дате отправления: