Re: Have the planner convert COUNT(1) / COUNT(not_null_col) to COUNT(*)

From: "Matheus Alcantara" <matheusssilv97(at)gmail(dot)com>
To: "David Rowley" <dgrowleyml(at)gmail(dot)com>, "Corey Huinker" <corey(dot)huinker(at)gmail(dot)com>
Cc: "PostgreSQL Developers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Have the planner convert COUNT(1) / COUNT(not_null_col) to COUNT(*)
Date: 2025-11-03 20:38:35
Message-ID: DDZCL3TK09B4.6D44Y4PQLGVX@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, thanks for working on this!

On Thu Oct 30, 2025 at 1:20 AM -03, David Rowley wrote:
> I've attached a very slightly revised version of the patch. I became
> aware of a function named get_func_support(), which can be used rather
> than fetching the pg_proc tuple from SysCache, which I was doing in
> v1. No other changes.
>
I looked the code and it seems to be in a good shape, but I tried to
apply the v2 on top of e7ccb247b38 in master to run some tests and a
rebase is necessary.

git am v2-0001-Have-the-planner-replace-COUNT-ANY-with-COUNT-whe.patch
Applying: Have the planner replace COUNT(ANY) with COUNT(*), when possible
error: patch failed: contrib/postgres_fdw/expected/postgres_fdw.out:2975
error: contrib/postgres_fdw/expected/postgres_fdw.out: patch does not apply
error: patch failed: src/test/regress/expected/aggregates.out:1219
error: src/test/regress/expected/aggregates.out: patch does not apply
Patch failed at 0001 Have the planner replace COUNT(ANY) with COUNT(*), when possible

--
Matheus Alcantara

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mihail Nikalayeu 2025-11-03 20:41:00 Re: Issues with ON CONFLICT UPDATE and REINDEX CONCURRENTLY
Previous Message Mats Kindahl 2025-11-03 20:20:32 Re: Use stack-allocated StringInfoData