Re: Multi-Column List Partitioning - Mailing list pgsql-hackers

From Zhihong Yu
Subject Re: Multi-Column List Partitioning
Date
Msg-id CALNJ-vQmmRrM3AAAXZumovWrOybC_ALDwPHAJ+3K71tBNcGb5Q@mail.gmail.com
Whole thread Raw
In response to Re: Multi-Column List Partitioning  (Nitin Jadhav <nitinjadhavpostgres@gmail.com>)
Responses Re: Multi-Column List Partitioning  (Zhihong Yu <zyu@yugabyte.com>)
List pgsql-hackers


On Fri, Oct 22, 2021 at 2:48 AM Nitin Jadhav <nitinjadhavpostgres@gmail.com> wrote:
> While testing further I got a crash with partition wise join enabled for multi-col list partitions. please find test case & stack-trace below.

Thanks for sharing. I have fixed the issue in the attached patch.

Thanks & Regards,
Nitin Jadhav



Hi,

+isListBoundDuplicated(List *list_bounds, List *new_bound)

+           Const   *value1 = castNode(Const, list_nth(elem, i));
+           Const   *value2 = castNode(Const, list_nth(new_bound, i));

Should the upper bound for index i take into account the length of new_bound ?
If the length of new_bound is always the same as that for elem, please add an assertion.

For transformPartitionListBounds():
+               deparse_expression((Node *) list_nth(partexprs, j),
+                                  deparse_context_for(RelationGetRelationName(parent),
+                                                      RelationGetRelid(parent)),

Please consider calling RelationGetRelationName(parent) and RelationGetRelid(parent) (and assigning to local variables) outside the loop.

+get_list_datum_count(PartitionBoundSpec **boundspecs, int nparts)

get_list_datum_count -> get_list_datums_count

For partition_bounds_equal():

+               if (b1->isnulls)
+                   b1_isnull = b1->isnulls[i][j];
+               if (b2->isnulls)
+                   b2_isnull = b2->isnulls[i][j];

Should the initialization of b1_isnull and b2_isnull be done inside the loop (so that they don't inherit value from previous iteration) ?

Cheers

pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: logical decoding/replication: new functions pg_ls_logicaldir and pg_ls_replslotdir
Next
From: Amul Sul
Date:
Subject: Re: prevent immature WAL streaming