Re: BUG #18568: BUG: Result wrong when do group by on partition table!
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: 狂奔的蜗牛 <1105066510@qq.com>
Cc: Tender Wang <tndrwang@gmail.com>,
pgsql-bugs <pgsql-bugs@lists.postgresql.org>, aleksander <aleksander@timescale.com>
Date: 2024-10-21T08:10:00Z
Lists: pgsql-bugs
On Thu, Aug 8, 2024 at 7:21 PM 狂奔的蜗牛 <1105066510@qq.com> wrote:
>
> Oh no!
> Sorry, I made a mistake on patch.
> v7 is new patch.
regress tests will fail for build with.
-Dicu=disabled
So I guess you have to put
src/test/regress/sql/partition_aggregate.sql related tests to
src/test/regress/sql/collate.icu.utf8.sql.
foreach(lc, partexprs)
{
ListCell *lg;
Expr *partexpr = lfirst(lc);
Oid partcoll =
input_rel->part_scheme->partcollation[cnt];
foreach (lg, groupexprs)
{
Expr *groupexpr = lfirst(lg);
Oid groupcoll = exprCollation((Node *) groupexpr);
/*
* GROUP BY xx COLLATE xxx
* Set collation in group by clause using COLLATE syntax,
* AND the collation IS NOT equal to column's default collation.
*/
if (IsA(groupexpr, RelabelType))
groupexpr = ((RelabelType *) groupexpr)->arg;
if (equal(groupexpr, partexpr) && partcoll == groupcoll)
{
found = true;
break;
}
}
if (found)
break;
}
/*
* GROUP BY xx COLLATE xxx
* Set collation in group by clause using COLLATE syntax,
* AND the collation IS NOT equal to column's default collation.
*/
i can understand the first part of the comment.
but here it is not related to column collation,
It's related to collation comparison between groupby expression and
partition key expressions.
so the second part of the comments confused me.
I added a commitfest entry in
https://commitfest.postgresql.org/50/5312/
you can put your name in the Authors field.
Other than that, it looks good to me.
Commits
-
Disallow partitionwise grouping when collations don't match
- 90fe6251c816 18.0 landed
- b6484ca9535e 17.1 landed
- dd2f8ebee221 16.5 landed
- 0a620659c549 15.9 landed
- 96f9b29a3e1e 14.14 landed
- ff65f695c0d3 13.17 landed
- 46d9be5efb1a 12.21 landed