On 12.09.24 03:43, David Rowley wrote:
On Sat, 30 Dec 2023 at 04:05, Zhang Mingli <zmlpostg...@gmail.com> wrote:
So my patch make it easy: check unique index’s columns, it’s a valid candidate
if all of that have NOT NULL constraint.
And we choose a best one who has the least column numbers in
get_min_unique_not_null_attnos(), as the reason: less columns mean that more
group by columns could be removed.
This patch no longer applies. We no longer catalogue NOT NULL
constraints, which this patch is coded to rely upon.
Work is ongoing to revive the patch that catalogs not-null constraints:
<https://commitfest.postgresql.org/49/5224/>. This patch should
probably wait for that patch at the moment.
(Likely it could just look at pg_attribute.attnotnull instead)
That won't work because you can't record dependencies on that. (This is
one of the reasons for cataloging not-null constraints as real constraints.)