postgres.git / summary / log / commit / refs

commit    a36aa223ec447276bf7050ab9ec6d974cafdf6c4
Author:   Noah Misch <noah@leadboat.com>
Date:     Thu Aug 22 07:07:04 2024 +0000
First released in: 18.0, 17.0

    Fix attach of a previously-detached injection point.
    
    It's normal for the name in a free slot to match the new name.  The
    max_inuse mechanism kept simple cases from reaching the problem.  The
    problem could appear when index 0 was the previously-detached entry and
    index 1 is in use.  Back-patch to v17, where this code first appeared.


src/backend/utils/misc/injection_point.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backend/utils/misc/injection_point.c b/src/backend/utils/misc/injection_point.c index 80bc32b0e08..7c1a7cf889d 100644 --- a/src/backend/utils/misc/injection_point.c +++ b/src/backend/utils/misc/injection_point.c @@ -315,8 +315,7 @@ InjectionPointAttach(const char *name, if (free_idx == -1) free_idx = idx; } - - if (strcmp(entry->name, name) == 0) + else if (strcmp(entry->name, name) == 0) elog(ERROR, "injection point \"%s\" already defined", name); } if (free_idx == -1) [parent: 04158e7fa37c]