public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ilia Evdokimov <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: Wrong argument name in error message from attribute_stats functions
Date: Fri, 10 Jul 2026 15:11:17 +0300
Message-ID: <[email protected]> (raw)

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/


Attachments:

  [text/x-patch] v1-0001-Wrong-argument-name-in-error-message-from-attribu.patch (1014B, ../[email protected]/2-v1-0001-Wrong-argument-name-in-error-message-from-attribu.patch)
  download | inline diff:
From 396adba853e9ea2956e581e7cf71c39da8a2cdaf Mon Sep 17 00:00:00 2001
From: Ilia Evdokimov <[email protected]>
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



view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Wrong argument name in error message from attribute_stats functions
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox