From: | Tender Wang <tndrwang(at)gmail(dot)com> |
---|---|
To: | 狂奔的蜗牛 <1105066510(at)qq(dot)com> |
Cc: | pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>, aleksander(at)timescale(dot)com |
Subject: | Re: BUG #18568: BUG: Result wrong when do group by on partition table! |
Date: | 2024-08-07 06:57:39 |
Message-ID: | CAHewXNnzROMZRt=GTmEw1araiAsbS68Bs+Lf3d0s=o01E5B6WQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
狂奔的蜗牛 <1105066510(at)qq(dot)com> 于2024年8月7日周三 13:35写道:
> this case will enter `if (IsA(groupexpr, RelabelType))` branch.
>
> We set "C" as groupkey's collation, and it's not equal to column's.
> In transformGroupClause(), syntax `COLLATE xxx` will create CollateExpr
> node, and CollateExpr's arg is Var node.
> And then, planner will call eval_const_expressions_mutator() to transform
> CollateExpr to RelableType if CollateExpr->collOid not equal to
> Collate->arg's collation.
>
Yech. Thanks for the explanation.
Because exprCollation() return the resultcollid if the nodetag is
Relabletype, the expr() && PartKeyCollMatchesExprColl() can handle this
situation.
So we don't need "if (IsA(groupexpr, RelableTyple) " this branch.
>
>
> About V3 patch, PartCollMatchesExprColl() may be not suitable, because
> collation of partkey must be equal to groupkey's, even though they are all
> InvalidOid.
>
I'm not sure about what you said. I uesd it because partition prune do
this way. I keep it temporarily.
The test case in v3 patch only has EXPLAIN statement. I add SELECT
statement and make the result more stable according to Aleksander advices.
--
Tender Wang
Attachment | Content-Type | Size |
---|---|---|
v4-0001-fix-group_by_has_partkey-bug-and-add-regress-test.patch | application/octet-stream | 6.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Sandeep Thakkar | 2024-08-07 07:45:01 | Re: BUG #18572: Crash during postgresql-16.3-2-windows-x64.exe installation |
Previous Message | PG Bug reporting form | 2024-08-07 05:55:24 | BUG #18574: procedure cache does not invalidate when output parameter type mismatch |