Re: BUG #18568: BUG: Result wrong when do group by on partition table!

Поиск
Список
Период
Сортировка
От Tender Wang
Тема Re: BUG #18568: BUG: Result wrong when do group by on partition table!
Дата
Msg-id CAHewXN=vbRDiEtdtC0WxbFNyyAUdys=_0Umh3EJ_xhKU-shd5w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #18568: BUG: Result wrong when do group by on partition table!  (Tender Wang <tndrwang@gmail.com>)
Ответы Re: BUG #18568: BUG: Result wrong when do group by on partition table!
Список pgsql-bugs


Tender Wang <tndrwang@gmail.com> 于2024年10月23日周三 14:25写道:


And I found some codes only use equal not check the collation, for example, in match_expr_to_partition_keys():
if (equal(lfirst(lc), expr))
lfirst(lc) is partkeys.
I thinks other codes assume that the collation of partexprs in RelOptInfo is same with pg_partitioned_table. But it is not.

 
It seems that only partition pruning logic not only does equal() but also checks the collation match. I find below codes in 
match_clause_to_partition_key():

/*
* Partition key match also requires collation match.  There may be
* multiple partkeys with the same expression but different
* collations, so failure is NOMATCH.
*/
if (!PartCollMatchesExprColl(partcoll, opclause->inputcollid))
    return PARTCLAUSE_NOMATCH;

Others only do equal(), as far as I know.

I tried the patch I provided in [1], and the regression test cases all passed.



--
Thanks,
Tender Wang

В списке pgsql-bugs по дате отправления: