| From: | Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | Andres Freund <andres(at)anarazel(dot)de>, Peter Eisentraut <peter(at)eisentraut(dot)org> |
| Subject: | Fix WITHOUT OVERLAPS PKs used for functional grouping |
| Date: | 2026-10-09 04:30:24 |
| Message-ID: | CA+renyWoOf6dM_+e6Zath+0i5Lr+uzn1hz7DAuSaV_A5Tz6XhA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Hackers,
Andres reported that a WITHOUT OVERLAPS primary key is wrongly
considered valid for functional grouping.[0] The problem is that the
GiST equals operator may not behave the same as the default btree
operator, which is what GROUP BY uses. This patch disables functional
grouping for WITHOUT OVERLAPS PKs.
It would be nice to still prove functional grouping if the GiST
equality operator has the same proc as the btree equality operator.
I'd be happy to update this submission if people think that is an
acceptable backpatch. Otherwise I'll submit it separately for v20.
Incidentally, maybe there is another issue?: The only concrete
built-in opclass I could find to reproduce the problem was citext. The
btree opclass compares insensitively, but there is no citext opclass
in btree_gist, so we use the text opclass instead (by binary
coercion). Isn't that a problem in general (regardless of WITHOUT
OVERLAPS)? It only breaks GROUP BY with a primary key, but it still
seems weird to get case-sensitive comparisons on a citext column.
Should I send another patch (against v20) adding citext to btree_gist?
Is there a deeper fix, where GiST doesn't use the text opclass for
citext columns?
Yours,
--
Paul ~{:-)
pj(at)illuminatedcomputing(dot)com
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Fix-bad-functional-grouping-inference-with-a-temp.patch | application/octet-stream | 4.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shihao zhong | 2026-10-09 04:42:29 | [PG19] Three bugs with a CHECK constraint that only the child enforces |
| Previous Message | solai v | 2026-10-09 04:28:48 | Re: Asynchronous MergeAppend |