Re: Wrong result when enable_partitionwise_join is on if collation of PartitionKey and Column is different. - Mailing list pgsql-hackers

From Junwang Zhao
Subject Re: Wrong result when enable_partitionwise_join is on if collation of PartitionKey and Column is different.
Date
Msg-id CAEG8a3Ks7_5b+0bnqbSceAbofj=o1RmP4qedv1Jr43Nz1wY-vA@mail.gmail.com
Whole thread Raw
In response to Re: Wrong result when enable_partitionwise_join is on if collation of PartitionKey and Column is different.  (Tender Wang <tndrwang@gmail.com>)
List pgsql-hackers
On Wed, Oct 30, 2024 at 11:58 AM jian he <jian.universality@gmail.com> wrote:
>
> I missed a case when column collation and partition key collation are
> the same and indeterministic.
> that should be fine for partition-wise join.
> so v2 attached.
>
> have_partkey_equi_join, match_expr_to_partition_keys didn't do any
> collation related check.
> propose v2 change disallow partitionwise join for  case when
> column collation is indeterministic *and* is differ from partition
> key's collation.
>
> the attached partition_wise_join_collation.sql is the test script.
> you may use it to compare with the master behavior.

What if the partkey collation and column collation are both deterministic,
but with different sort order?

I'm not familiar with this part of the code base, but it seems to me the
partition wise join should use partkey collation instead of column collation,
because it's the partkey collation that decides which partition a row to
be dispatched.

What Jian proposed is also reasonable but seems another aspect of $subject?

Just some random thought, might be wrong ;(

--
Regards
Junwang Zhao



pgsql-hackers by date:

Previous
From: Rafia Sabih
Date:
Subject: Re: Forbid to DROP temp tables of other sessions
Next
From: Ashutosh Bapat
Date:
Subject: Re: Alias of VALUES RTE in explain plan