Re: [PATCH] Test coverage for pg_clear_attribute_stats() null arguments

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Test coverage for pg_clear_attribute_stats() null arguments
Date: 2026-09-01 05:51:42
Message-ID: apZn7QNk5eAq2meL@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 27, 2026 at 10:44:58PM -0400, shihao zhong wrote:
> 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])

Right.

> 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

Hmm. I don't think that this is ambitious enough, we also missing
tests for error cases related to the following pieces for
pg_clear_attribute_stats():
- System columns defined, should be rejected.
- Missing relation or namespace.
- Missing column.
- Perhaps sequence and view case rejection?
- Something with inherited = true?

Could you expand the patch to do more of this stuff, please?
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-09-01 06:00:33 Re: Routed ON CONFLICT inserts broken by partition-local deferrable unique constraints in 19 and master
Previous Message Greg Burd 2026-09-01 05:18:42 Re: another autovacuum scheduling thread