Re: Question -- why is there no errhint_internal function?

From: Andres Freund <andres(at)anarazel(dot)de>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Question -- why is there no errhint_internal function?
Date: 2025-04-02 23:26:08
Message-ID: hagkz2jg3rbz7bfmbzou6wmhveqaa6pmtxpquxep7bptyiljqb@w5ccnxrvf2zb
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2025-04-03 09:58:30 +1100, Peter Smith wrote:
> I saw that a new errhint_internal() function was recently committed
> [1]. I had also posted above asking about this same missing function a
> month ago [2].
>
> But, your patch only added the new function -- it does not make any
> use of it for existing code that was using the errhint("%s", str)
> method.
>
> I wondered, given your commit message "but that's not exactly pretty
> and makes it harder to avoid memory leaks", if you think it is
> worthwhile to revisit those existing "%s" usages and modify them to
> use the new errhint_internal? Tom above [3] seemed not keen to modify
> those without performance reasons, although at that time
> errhint_internal didn't even exist.

I'd not go around and just categorically convert all users of errhint("%s",
str), that's probably not worth the noise. And plenty of them won't
benefit. E.g. the first one I just looked at is dblink_res_error(), where I
don't think using it would bring meaningful benefit. I suspect a bunch of
other places are going to be similar.

But I could also imageine there are some places where it'd improve the code /
remove unnecessary allocations.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2025-04-02 23:32:24 Re: Adding skip scan (including MDAM style range skip scan) to nbtree
Previous Message Peter Geoghegan 2025-04-02 23:15:33 Re: Adding skip scan (including MDAM style range skip scan) to nbtree