Wrong argument name in error message from attribute_stats functions

Started by Ilia Evdokimov5 months ago4 messageshackers
Jump to latest
#1Ilia Evdokimov
ilya.evdokimov@tantorlabs.com

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:

v1-0001-Wrong-argument-name-in-error-message-from-attribu.patchtext/x-patch; charset=UTF-8; name=v1-0001-Wrong-argument-name-in-error-message-from-attribu.patchDownload+2-3
#2Fujii Masao
masao.fujii@gmail.com
In reply to: Ilia Evdokimov (#1)
Re: Wrong argument name in error message from attribute_stats functions

On Fri, Jul 10, 2026 at 9:11 PM Ilia Evdokimov
<ilya.evdokimov@tantorlabs.com> wrote:

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`.

Thanks for the patch! LGTM.

Regards,

--
Fujii Masao

#3Ilia Evdokimov
ilya.evdokimov@tantorlabs.com
In reply to: Fujii Masao (#2)
Re: Wrong argument name in error message from attribute_stats functions

On 7/10/26 15:32, Fujii Masao wrote:

On Fri, Jul 10, 2026 at 9:11 PM Ilia Evdokimov
<ilya.evdokimov@tantorlabs.com> wrote:

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`.

Thanks for the patch! LGTM.

Since Beta 2 is scheduled for July 16, it might be worth getting this
fixed before then. Incorrect error messages can mislead users during
debugging.

--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC,
https://tantorlabs.com/

#4Fujii Masao
masao.fujii@gmail.com
In reply to: Ilia Evdokimov (#3)
Re: Wrong argument name in error message from attribute_stats functions

On Mon, Jul 13, 2026 at 10:20 PM Ilia Evdokimov
<ilya.evdokimov@tantorlabs.com> wrote:

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

Thanks for the patch! LGTM.

I've pushed the patch and backpatched it to v18,
where pg_clear_attribute_stats() was introduced. Thanks!

Since Beta 2 is scheduled for July 16, it might be worth getting this
fixed before then. Incorrect error messages can mislead users during
debugging.

Although we're still before the v19 beta2 release, the beta2 tag has
already been created, so this fix won't make it into beta2. It will be
included in the next v19 beta or RC release, as well as the next
minor releases.

Regards,

--
Fujii Masao