Re: BUG #18568: BUG: Result wrong when do group by on partition table!
Tender Wang <tndrwang@gmail.com>
From: Tender Wang <tndrwang@gmail.com>
To: 狂奔的蜗牛 <1105066510@qq.com>
Cc: pgsql-bugs <pgsql-bugs@lists.postgresql.org>,
aleksander <aleksander@timescale.com>
Date: 2024-08-07T09:23:21Z
Lists: pgsql-bugs
狂奔的蜗牛 <1105066510@qq.com> 于2024年8月7日周三 16:06写道: > PartCollMatchesExprColl() is not strict enough. > If partcoll == InvalidOid and groupcoll != InvalidOid, > PartCollMatchesExprColl() return true always. > Just determine whether groupcoll is equal to partcoll, like this "partcoll > == groupcoll". > > I understand what you said. Actually, I keep it just curious when partcoll is InvalidOid. Why it works for partition prune. Is it not same between check partkey is equal to groupexpr and check partkey is equal to qualclause? > We cannot delete "if (IsA(groupexpr, RelableTyple) " branch, > becasuse if groupexpr is RelabelType and partcoll equal to groupcoll, > the "equal(groupexpr, partexpr) && PartKeyCollMatchesExprColl(partcoll, > groupexpr_coll)" condition return false!!! > This is not what we expect. > " if groupexpr is RelabelType and partcoll equal to groupcoll ", according to original logic, will return false in this situation. Now you think we can support above situation. Am I understand correctly? We're better to add more test case to cover the code if we're going to support this. The test cases now seem not going into the RelableTyple branch. > We could rename "groupexpr_coll" to groupcoll, it looks more elegant. > > No objection. You can continue to support RelableType situation and add more test cases based on V4. -- Tender Wang
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
-
For partitionwise join, match on partcollation, not parttypcoll.
- 2af28e603319 11.0 cited