fetch_search_path_listcopy.diff
application/octet-stream
Filename: fetch_search_path_listcopy.diff
Type: application/octet-stream
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/backend/catalog/namespace.c | 12 | 5 |
diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c
index 5cdd51cb5d..2221455ff7 100644
--- a/src/backend/catalog/namespace.c
+++ b/src/backend/catalog/namespace.c
@@ -4291,7 +4291,8 @@ NamespaceCallback(Datum arg, int cacheid, uint32 hashvalue)
List *
fetch_search_path(bool includeImplicit)
{
- List *result;
+ ListCell *l;
+ int skipSearchPaths = 0;
recomputeNamespacePath();
@@ -4308,14 +4309,20 @@ fetch_search_path(bool includeImplicit)
recomputeNamespacePath();
}
- result = list_copy(activeSearchPath);
if (!includeImplicit)
{
- while (result && linitial_oid(result) != activeCreationNamespace)
- result = list_delete_first(result);
+ foreach (l, activeSearchPath)
+ {
+ Oid namespaceId = lfirst_oid(l);
+
+ if (namespaceId != activeCreationNamespace)
+ skipSearchPaths++;
+ else
+ break;
+ }
}
- return result;
+ return list_copy_tail(activeSearchPath, skipSearchPaths);
}
/*