While reviewing the code I was trying to explore more cases, and I here comes an
open question to my mind:
should we allow the default partition table to be partitioned further?
If we allow it(as in the current case) then observe following case, where I
have defined a default partitioned which is further partitioned on a different
column.
postgres=# CREATE TABLE test ( a int, b int, c int) PARTITION BY LIST (a);
CREATE TABLE
postgres=# CREATE TABLE test_p1 PARTITION OF test FOR VALUES IN(4, 5, 6, 7, 8);
CREATE TABLE
postgres=# CREATE TABLE test_pd PARTITION OF test DEFAULT PARTITION BY LIST(b);
CREATE TABLE
postgres=# INSERT INTO test VALUES (20, 24, 12);
ERROR: no partition of relation "test_pd" found for row
DETAIL: Partition key of the failing row contains (b) = (24).
Note, that it does not allow inserting the tuple(20, 24, 12) because though a=20
would fall in default partition i.e. test_pd, table test_pd itself is further
partitioned and does not have any partition satisfying b=24.
Further if I define a default partition for table test_pd, the the tuple gets inserted.
Doesn't this sound like the whole purpose of having DEFAULT partition on test
table is defeated?
Any views?
Regards,
Jeevan Ladhe