Re: Extended Statistics set/restore/clear functions.

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, Tomas Vondra <tomas(at)vondra(dot)me>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Extended Statistics set/restore/clear functions.
Date: 2025-12-05 01:19:27
Message-ID: aTIzH-2Spb4H6BNP@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 04, 2025 at 07:37:32PM -0500, Tom Lane wrote:
> This of course arises because the source code is passing the address
> of a local ErrorSaveContext variable to that macro. We don't have
> any other instances of that coding pattern AFAICS, so I wonder if
> that was really the most adapted way to do it. Looking at the
> code, it seems to be turning around and stuffing a different error
> message into a passed-in ErrorSaveContext, which feels a little
> weird.

Thanks for the report. Right. There are three instances of that in
pg_dependencies.c, two in pg_ndistinct.c. I would not mind doing the
attached to calm down these warnings, matching with the other areas of
the code, that simply removes the macro and checks the state value
directly.

> Also, I don't think these errdetail messages meet our style
> guidelines:
>
> errdetail("Invalid \"%s\" value.", PG_DEPENDENCIES_KEY_ATTRIBUTES));
>
> They're supposed to be complete sentences.

Yeah, I should have been more careful here. I have spent more time on
all of these, and adjusted all the errdetails for pg_ndistinct.c and
pg_dependencies.c to use full sentences.

I am just grouping everything with the attached. They'd be better
if handled separately, obviously. Comments?
--
Michael

Attachment Content-Type Size
0001-Improve-pg_dependencies.c-and-pg_ndistinct.c.patch text/x-diff 75.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2025-12-05 01:29:48 Re: Safer hash table initialization macro
Previous Message Michael Paquier 2025-12-05 00:41:21 Re: BUG #19095: Test if function exit() is used fail when linked static