GP-7092 - Fixed bug when deleting function with multiple function tags

This commit is contained in:
dragonmacher
2026-07-22 15:00:53 -04:00
parent 7ccc6e852b
commit c098bf9afa
4 changed files with 12 additions and 12 deletions

View File

@@ -117,7 +117,7 @@ public class DeleteFunctionCmdTest extends AbstractGenericTest {
/*
* This is a regression test. Make sure function deletes work with multiple tags.
* See issue #9386.
* See github issue #9386.
*/
@Test
public void testDeleteFunctionWithMultipleTags() {

View File

@@ -1528,21 +1528,21 @@ public class FunctionDB extends DbObject implements Function {
// cache will have the current tag state unless tags have been deleted or edited; in
// those cases the validity check will fail and we'll be forced to go back to
// the db.
Set<FunctionTag> copy = new HashSet<>();
try (Closeable c = lock.read()) {
if (refreshIfNeeded() && tags != null) {
return tags;
}
// Get a list of all tag records that map to our function.
if (!refreshIfNeeded() || tags == null) {
FunctionTagManagerDB tagManager =
(FunctionTagManagerDB) manager.getFunctionTagManager();
tags = tagManager.getFunctionTagsByFunctionID(getID());
}
copy.addAll(tags);
}
catch (IOException e) {
manager.dbError(e);
}
return tags;
return copy;
}

View File

@@ -430,7 +430,7 @@ public class FunctionManagerDB implements FunctionManager {
}
// Remove all tag mappings associated with this function
for (FunctionTag tag : new ArrayList<>(function.getTags())) {
for (FunctionTag tag : function.getTags()) {
function.removeTag(tag.getName());
}

View File

@@ -283,7 +283,7 @@ public interface Function extends Namespace {
/**
* Return all {@link FunctionTag} objects associated with this function.
*
* @return set of tag names
* @return set of tags
*/
public Set<FunctionTag> getTags();