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/expected/plpython_composite.out | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/pl/plpython/expected/plpython_composite.out b/src/pl/plpython/expected/plpython_composite.out
index 674af93..ffce7fc 100644
--- a/src/pl/plpython/expected/plpython_composite.out
+++ b/src/pl/plpython/expected/plpython_composite.out
@@ -606,3 +606,19 @@
HINT: To return a composite type in an array, return the composite type as a Python tuple, e.g., "[('foo',)]".
CONTEXT: while creating return value
PL/Python function "composite_type_as_list_broken"
+-- A custom sequence whose length matches the tuple but whose __getitem__
+-- raises should be reported as an error, not crash the backend.
+CREATE FUNCTION composite_type_as_broken_sequence() RETURNS type_record AS $$
+class C:
+ def __len__(self):
+ return 2
+ def __getitem__(self, i):
+ raise ValueError('getitem failed')
+return C()
+$$ LANGUAGE plpython3u;
+SELECT * FROM composite_type_as_broken_sequence();
+ERROR: could not get element 0 from sequence
+DETAIL: ValueError: getitem failed
+CONTEXT: Traceback (most recent call last):
+while creating return value
+PL/Python function "composite_type_as_broken_sequence"
--
Gitblit v1.10.0