Skip to content

Commit 09914f4

Browse files
committed
Reset internal ctxs in fini_local_cache only when they actually exist.
1 parent 9c2ab5f commit 09914f4

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Diff for: expected/pathman_cache_pranks.out

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ CREATE EXTENSION pg_pathman;
1414
DROP EXTENSION pg_pathman;
1515
-- create it for further tests
1616
CREATE EXTENSION pg_pathman;
17+
-- make sure nothing breaks on disable/enable
18+
SET pg_pathman.enable = false;
19+
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been disabled
20+
SET pg_pathman.enable = true;
21+
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been enabled
1722
-- 079797e0d5
1823
CREATE TABLE part_test(val serial);
1924
INSERT INTO part_test SELECT generate_series(1, 30);

Diff for: sql/pathman_cache_pranks.sql

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ DROP EXTENSION pg_pathman;
1616
-- create it for further tests
1717
CREATE EXTENSION pg_pathman;
1818

19+
-- make sure nothing breaks on disable/enable
20+
SET pg_pathman.enable = false;
21+
SET pg_pathman.enable = true;
22+
1923
-- 079797e0d5
2024
CREATE TABLE part_test(val serial);
2125
INSERT INTO part_test SELECT generate_series(1, 30);

Diff for: src/init.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,12 @@ fini_local_cache(void)
403403
}
404404

405405
/* Now we can clear allocations */
406-
MemoryContextReset(PathmanParentsCacheContext);
407-
MemoryContextReset(PathmanStatusCacheContext);
408-
MemoryContextReset(PathmanBoundsCacheContext);
406+
if (TopPathmanContext)
407+
{
408+
MemoryContextReset(PathmanParentsCacheContext);
409+
MemoryContextReset(PathmanStatusCacheContext);
410+
MemoryContextReset(PathmanBoundsCacheContext);
411+
}
409412
}
410413

411414

0 commit comments

Comments
 (0)