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

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: Tender Wang <tndrwang(at)gmail(dot)com>, 1105066510(at)qq(dot)com
Subject: Re: BUG #18568: BUG: Result wrong when do group by on partition table!
Date: 2024-08-06 09:09:30
Message-ID: CAJ7c6TPD+KMeT19jaoXjPf8_4mdQWOYXzOEyCuFDGanv=_k8UQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

> [...]
> I continue to find out why the collation id of partkey is 16384(e.g. case_insensitive). The partkey expr info is
> set in set_baserel_partition_key_exprs(), which it uses partkey->parttypcoll[cnt] value not partkey->partcollation value.
>
> And partkey->parttypcoll[cnt] is assigned from pg_attribute , which is the column c meta data.
> Should we use partkey->partcollation value? I try to fix that in the attached patch. I add your case in the test, and I don't find
> failed regress.

```
+SELECT c collate case_insensitive, count(c) FROM
+pagg_tab_col GROUP BY c collate case_insensitive;
+ c | count
+---+-------
+ e | 600
+ D | 600
+ C | 600
+ B | 600
+ A | 600
+(5 rows)
```

Shouldn't we use UPPER(c) and ORDER BY in the test case to make the
results deterministic?

--
Best regards,
Aleksander Alekseev

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tender Wang 2024-08-06 09:27:07 Re: BUG #18568: BUG: Result wrong when do group by on partition table!
Previous Message PG Bug reporting form 2024-08-06 08:53:19 BUG #18570: Drop event trigger for DDL finishes successfully but trigger still executed on DDL