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