Re: Support a wildcard in backtrace_functions - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Support a wildcard in backtrace_functions
Date
Msg-id 202402291035.op26n4voqmba@alvherre.pgsql
Whole thread Raw
In response to Re: Support a wildcard in backtrace_functions  (Jelte Fennema-Nio <me@jeltef.nl>)
Responses Re: Support a wildcard in backtrace_functions
List pgsql-hackers
On 2024-Feb-28, Jelte Fennema-Nio wrote:

> diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
> index 699d9d0a241..553e4785520 100644
> --- a/src/backend/utils/error/elog.c
> +++ b/src/backend/utils/error/elog.c
> @@ -843,6 +843,8 @@ matches_backtrace_functions(const char *funcname)
>          if (*p == '\0')            /* end of backtrace_function_list */
>              break;
>  
> +        if (strcmp("*", p) == 0)
> +            return true;
>          if (strcmp(funcname, p) == 0)
>              return true;
>          p += strlen(p) + 1;

Hmm, so if I write "foo,*" this will work but check all function names
first and on the second entry.  But if I write "foo*" the GUC value will
be accepted but match nothing (as will "*foo" or "foo*bar").  I don't
like either of these behaviors.  I think we should tighten this up: an
asterisk should be allowed only if it appears alone in the string
(short-circuiting check_backtrace_functions before strspn); and let's
leave the strspn() call alone.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
Bob [Floyd] used to say that he was planning to get a Ph.D. by the "green
stamp method," namely by saving envelopes addressed to him as 'Dr. Floyd'.
After collecting 500 such letters, he mused, a university somewhere in
Arizona would probably grant him a degree.              (Don Knuth)



pgsql-hackers by date:

Previous
From: Teodor Sigaev
Date:
Subject: type cache cleanup improvements
Next
From: Alvaro Herrera
Date:
Subject: Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock