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_global.sql | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/src/pl/plpython/sql/plpython_global.sql b/src/pl/plpython/sql/plpython_global.sql
index 96d2049..6f59600 100644
--- a/src/pl/plpython/sql/plpython_global.sql
+++ b/src/pl/plpython/sql/plpython_global.sql
@@ -36,3 +36,21 @@
SELECT static_test();
SELECT global_test_one();
SELECT global_test_two();
+
+-- SD is shared by all calls of a function, whatever the input collation,
+-- and survives CREATE OR REPLACE FUNCTION
+CREATE FUNCTION static_test_coll(t text) RETURNS int4
+AS $$
+SD["n"] = SD.get("n", 0) + 1
+return SD["n"]
+$$ LANGUAGE plpython3u;
+
+SELECT static_test_coll('a'), static_test_coll('a' COLLATE "C");
+
+CREATE OR REPLACE FUNCTION static_test_coll(t text) RETURNS int4
+AS $$
+SD["n"] = SD.get("n", 0) + 1
+return SD["n"]
+$$ LANGUAGE plpython3u;
+
+SELECT static_test_coll('a');
--
Gitblit v1.10.0