summaryrefslogtreecommitdiff
path: root/src/test/regress/sql/sysviews.sql
diff options
context:
space:
mode:
authorDavid Rowley2024-04-16 04:21:31 +0000
committerDavid Rowley2024-04-16 04:21:31 +0000
commitbea97cd02ebb347ab469b78673c2b33a72109669 (patch)
tree3649cbfb67ca118da5101eac3a6287b83f294035 /src/test/regress/sql/sysviews.sql
parent768ceeeaa127a8001d60ad6a62846a8be3f35d93 (diff)
Improve test coverage in bump.c
There were no callers of BumpAllocLarge() in the regression tests, so here we add a sort with a tuple large enough to use that path in bump.c. Also, BumpStats() wasn't being called, so add a test to sysviews.sql to call pg_backend_memory_contexts() while a bump context exists in the backend. Reported-by: Andres Freund Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/test/regress/sql/sysviews.sql')
-rw-r--r--src/test/regress/sql/sysviews.sql15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/regress/sql/sysviews.sql b/src/test/regress/sql/sysviews.sql
index 6b4e24601d9..c4f59ddc89a 100644
--- a/src/test/regress/sql/sysviews.sql
+++ b/src/test/regress/sql/sysviews.sql
@@ -17,6 +17,21 @@ select count(*) >= 0 as ok from pg_available_extensions;
select name, ident, parent, level, total_bytes >= free_bytes
from pg_backend_memory_contexts where level = 0;
+-- We can exercise some MemoryContext type stats functions. Most of the
+-- column values are too platform-dependant to display.
+
+-- Ensure stats from the bump allocator look sane. Bump isn't a commonly
+-- used context, but it is used in tuplesort.c, so open a cursor to keep
+-- the tuplesort alive long enough for us to query the context stats.
+begin;
+declare cur cursor for select left(a,10), b
+ from (values(repeat('a', 512 * 1024),1),(repeat('b', 512),2)) v(a,b)
+ order by v.a desc;
+fetch 1 from cur;
+select name, parent, total_bytes > 0, total_nblocks, free_bytes > 0, free_chunks
+from pg_backend_memory_contexts where name = 'Caller tuples';
+rollback;
+
-- At introduction, pg_config had 23 entries; it may grow
select count(*) > 20 as ok from pg_config;