Subject: Wrong argument name in error message from attribute_stats functions

From: Ilia Evdokimov <[email-masked]>
Date: Fri, 10 Jul 2026 15:11:17 +0300

Hi,

While using pg_clear_attribute_stats() I noticed weird printing:

```
CREATE TABLE t(a int);
SELECT pg_clear_attribute_stats(NULL, 't', 'a', false);
ERROR:  argument "relation" must not be null
```

NULL was passed for `schemaname`, not for a `relation` argument. This 
comes from cleararginfo[], where both the schema and relname entries are 
labeled `relation`.

In v1-patch I propose naming these the same way `pg_proc.dat` does, i.e. 
`schemaname` and `relname`.

After applying patch:
```
SELECT pg_clear_attribute_stats(NULL, 't', 'a', false);
ERROR:  argument "schemaname" must not be null

SELECT pg_clear_attribute_stats('public', NULL, 'a', false);
ERROR:  argument "relname" must not be null
```

--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC,
https://tantorlabs.com/
From 396adba853e9ea2956e581e7cf71c39da8a2cdaf Mon Sep 17 00:00:00 2001
From: Ilia Evdokimov <[email-masked]>
Date: Fri, 10 Jul 2026 14:58:34 +0300
Subject: [PATCH v1] Wrong argument name in error message from attribute_stats
 functions

---
 src/backend/statistics/attribute_stats.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/statistics/attribute_stats.c b/src/backend/statistics/attribute_stats.c
index 2efb74b95a6..fac6168f916 100644
--- a/src/backend/statistics/attribute_stats.c
+++ b/src/backend/statistics/attribute_stats.c
@@ -97,8 +97,8 @@ enum clear_attribute_stats_argnum
 
 static struct StatsArgInfo cleararginfo[] =
 {
-	[C_ATTRELSCHEMA_ARG] = {"relation", TEXTOID},
-	[C_ATTRELNAME_ARG] = {"relation", TEXTOID},
+	[C_ATTRELSCHEMA_ARG] = {"schemaname", TEXTOID},
+	[C_ATTRELNAME_ARG] = {"relname", TEXTOID},
 	[C_ATTNAME_ARG] = {"attname", TEXTOID},
 	[C_INHERITED_ARG] = {"inherited", BOOLOID},
 	[C_NUM_ATTRIBUTE_STATS_ARGS] = {0}
-- 
2.34.1

---

From: Fujii Masao <[email-masked]>
Date: Fri, 10 Jul 2026 21:32:32 +0900

> `schemaname` and `relname`.

Thanks for the patch! LGTM.

Regards,

-- 
Fujii Masao