From: | "daidewei(at)highgo(dot)com" <daidewei(at)highgo(dot)com> |
---|---|
To: | "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | a plpgsql bug |
Date: | 2023-09-19 02:59:07 |
Message-ID: | 202309191058550158453@highgo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
hello!
I found a problem in plpgsql. When there is a large loop in plpgsql, it is found that the change of search_path will cause memory exhaustion and thus disconnect the connection.
The test examples are as follows:
1 create a schema
create schema test_schema;
2 create a function create or replace function test_schema.test_f(id integer) returns integer as $$ declare var2 integer := 1; begin if id % 4 = 1 then return var2 + 2; elseif id % 4 = 2 then return var2 + 3; elseif id % 4 = 3 then return var2 + 4; else return var2; end if; end; $$ language plpgsql;
3 a loop in plpgsql,which wil result disconnection. do $$ declare var1 integer; begin for id in 1 .. 10000000 LOOP set search_path to test_schema; var1 = test_schema.test_f(id); set search_path to public; var1 = test_schema.test_f(id); end loop; end; $$ language plpgsql;
daidewei(at)highgo(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Philip Muturura | 2023-09-19 03:38:04 | Re: Installing PostgreSQL 16 on FreeBSD 13.0 |
Previous Message | Michael Paquier | 2023-09-19 00:28:49 | Re: BUG #18070: Assertion failed when processing error from plpy's iterator |