Do not allocate anything in subtransaction memory context (#12176)

## Problem

See https://github.com/neondatabase/neon/issues/12173

## Summary of changes

Allocate table in TopTransactionMemoryContext

---------

Co-authored-by: Konstantin Knizhnik <knizhnik@neon.tech>
This commit is contained in:
Konstantin Knizhnik
2025-07-04 13:24:39 +03:00
committed by GitHub
parent cc699f6f85
commit 436a117c15
4 changed files with 80 additions and 12 deletions

View File

@@ -0,0 +1,21 @@
DO $$
DECLARE
i numeric;
BEGIN
create role somebody;
FOR i IN 1..1000000 LOOP
BEGIN
IF i % 1000 = 0 THEN
alter role somebody password 'welcome';
ELSE
PERFORM 1;
END IF;
EXCEPTION WHEN OTHERS THEN
RAISE WARNING 'error';
END;
IF I = 1000000 THEN
PERFORM pg_log_backend_memory_contexts(pg_backend_pid());
END IF;
END LOOP;
END;
$$;