[PATCH] Replace COUNT(NULL) with '0'::bigint

From: Junwang Zhao <zhjwpku(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] Replace COUNT(NULL) with '0'::bigint
Date: 2026-01-25 06:48:15
Message-ID: CAEG8a3K1OZJm2k2W9ijasqQr3qkM2Ggy2LfB0ZP+cwLhEYzbeQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

In [1], David Rowley noted that COUNT(NULL) can be replaced
with '0'::bigint. The change should be straightforward, and I came
up with the attached patch to implement it.

[1] https://www.postgresql.org/message-id/CAApHDvrde9DUpQ3DhPd3ia9tchVmhZqewfzxSYWmYFWVj%3DLPpg%40mail.gmail.com

--
Regards
Junwang Zhao

Attachment Content-Type Size
0001-Replace-COUNT-NULL-with-0-bigint.patch application/octet-stream 2.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2026-01-25 07:05:03 Re: Fix a reference error for window functions: In the function 'find_window_functions', the deduplication logic should be removed
Previous Message Alexander Lakhin 2026-01-25 06:00:00 Re: pg_stat_statements: add missing tests for nesting_level