Re: BUG #18568: BUG: Result wrong when do group by on partition table! - Mailing list pgsql-bugs

From Amit Langote
Subject Re: BUG #18568: BUG: Result wrong when do group by on partition table!
Date
Msg-id CA+HiwqFN7ydxu3vCrGqbF0rM0bruk59er9mSCbTFJufG1h2-Lg@mail.gmail.com
Whole thread Raw
In response to Re: BUG #18568: BUG: Result wrong when do group by on partition table!  (Tender Wang <tndrwang@gmail.com>)
Responses Re: BUG #18568: BUG: Result wrong when do group by on partition table!
Re: BUG #18568: BUG: Result wrong when do group by on partition table!
List pgsql-bugs
On Tue, Oct 22, 2024 at 5:30 PM Tender Wang <tndrwang@gmail.com> wrote:
> Amit Langote <amitlangote09@gmail.com> 于2024年10月22日周二 15:33写道:
>> Not really.  As the documentation says, collation can be specified per
>> column or per operation:
>>
>> https://www.postgresql.org/docs/current/collation.html
>>
>> In this case, the operation is partitioning.  When you specify the
>> COLLATE clause for a partition key, it means that the partitioning
>> logic, such as partition tuple routing, will use that collation
>> instead of the column-specified or the column type's collation.
>
>
> Since you said partition key had its own collation, and but we used column type's collation in
>  set_baserel_partition_key_exprs() as below:
>
> partexpr = (Expr *) makeVar(varno, attno,
> partkey->parttypid[cnt],
> partkey->parttypmod[cnt],
> partkey->parttypcoll[cnt], 0);
>
> I think why not we directly use the partition key collation(e.g.  partcollation).

That's a good question but I don't immediately know the answer.

It seems like it has been like this since the beginning or since the
commit that added the RelOptInfo.partexprs field (9140cf8269).

--
Thanks, Amit Langote



pgsql-bugs by date:

Previous
From: Tender Wang
Date:
Subject: Re: BUG #18568: BUG: Result wrong when do group by on partition table!
Next
From: Tender Wang
Date:
Subject: Re: BUG #18568: BUG: Result wrong when do group by on partition table!