Re: Wrong result when enable_partitionwise_join is on if collation of PartitionKey and Column is different.

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Junwang Zhao <zhjwpku(at)gmail(dot)com>, Tender Wang <tndrwang(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Subject: Re: Wrong result when enable_partitionwise_join is on if collation of PartitionKey and Column is different.
Date: 2024-11-08 09:27:32
Message-ID: CA+HiwqGKn4Nn0QbtG8MpknW=uMZ+kcQ=VbCteXVaO9bHZFkoEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Wed, Nov 6, 2024 at 12:19 PM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
> looks good to me.
> I didn't find any issue.

Thanks for the review.

> group_by_has_partkey can even cope with:
> EXPLAIN (COSTS OFF, settings)
> SELECT c collate "C" collate case_insensitive collate "C", count(c)
> FROM pagg_tab3 GROUP BY c collate "C" collate case_insensitive collate
> "C" ORDER BY 1;
>
> so i guess in group_by_has_partkey
> if (IsA(groupexpr, RelabelType))
> groupexpr = ((RelabelType *) groupexpr)->arg;
> should be enough.
>
> not need while loop.
>
> while (IsA(groupexpr, RelabelType))
> groupexpr = (Expr *) (castNode(RelabelType, groupexpr))->arg;

Added a comment about that.

Pushed both patches after making changes to 0001 to allow "partial"
partitionwise aggregation after all. The differences in output with
partial partitionwise aggregation and no partitionwise aggregation
that I mentioned before don't seem to have anything to do with
partitionwise aggregation, but apparently with whether aggregation was
hashed or not. I confirmed that by turning enable_hashagg on and off
to see the difference. Changing enable_partitionwise_aggregate for
either of the values of enable_hashagg didn't change the plan.

Thank you all for working on this.

--
Thanks, Amit Langote

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2024-11-08 09:32:35 Re: not null constraints, again
Previous Message Alvaro Herrera 2024-11-08 09:25:57 Re: not null constraints, again