From bd039d1e92813358c5c5a1e346b49074baf513f2 Mon Sep 17 00:00:00 2001
From: rudb <office@database.ru>
Date: Thu, 03 Dec 2026 07:46:00 +0000
Subject: [PATCH] СУБД RuDB - релиз 4
---
src/pl/plpython/sql/plpython_setof.sql | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/pl/plpython/sql/plpython_setof.sql b/src/pl/plpython/sql/plpython_setof.sql
index 1a0472b..f25c739 100644
--- a/src/pl/plpython/sql/plpython_setof.sql
+++ b/src/pl/plpython/sql/plpython_setof.sql
@@ -107,3 +107,20 @@
SELECT get_user_records2();
SELECT * FROM get_user_records2();
+
+-- Test partial execution of a set-returning function
+SELECT get_user_records2() LIMIT 2;
+SELECT * FROM get_user_records2() LIMIT 2;
+
+-- A set-returning function that is invalidated mid-iteration must run to
+-- completion using its original definition (bug #19480).
+CREATE OR REPLACE FUNCTION self_invalidating_srf(x int) RETURNS SETOF int AS $$
+for i in range(3):
+ if i == 1:
+ plpy.execute("CREATE OR REPLACE FUNCTION self_invalidating_srf(x int) "
+ "RETURNS SETOF int LANGUAGE plpython3u AS 'return [-1]'")
+ yield x + i
+$$ LANGUAGE plpython3u;
+
+SELECT self_invalidating_srf(10); -- expect 10,11,12 (original definition)
+SELECT self_invalidating_srf(10); -- expect -1 (replacement now in effect)
--
Gitblit v1.10.0