[PATCH] Test coverage for pg_clear_attribute_stats() null arguments

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH] Test coverage for pg_clear_attribute_stats() null arguments
Date: 2026-08-28 02:44:58
Message-ID: CAGRkXqQEFzVh_bQSoLGDqaRTq7Xta6OUoda8PDrWDPWcAuwk=w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

pg_clear_attribute_stats() has no test coverage for its null-argument
checks, while pg_restore_relation_stats(), pg_restore_attribute_stats(),
pg_restore_ext_stats() and pg_clear_ext_stats() all do. It is called
exactly once in the whole test suite, and only on its success path.
That gap let a real bug live from v18 until 11ed011ae22([1])

The attached patch adds four cases, one per required argument. It is
test-only, with no behaviour change. The checks run at the top of the
function, before the relation lookup, so the expected output does not
depend on the state of the cluster.

[1]: https://github.com/postgres/postgres/commit/11ed011ae22a620b01a43634b5eea2f9af5c709c

Thanks,
Shihao

Attachment Content-Type Size
v1-0001-Add-test-coverage-for-pg_clear_attribute_stats-nu.patch application/octet-stream 3.6 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-08-28 02:51:52 Re: tablecmds: fix bug where index rebuild loses replica identity on partitions
Previous Message Jeff Davis 2026-08-28 02:38:16 Re: Commit Sequence Numbers and Visibility