This is an automated email from the ASF dual-hosted git repository.

MuhammadTahaNaveed pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/age.git


The following commit(s) were added to refs/heads/master by this push:
     new dbb880c7 Mark agtype_string_match_starts_with/_ends_with IMMUTABLE 
(#2579)
dbb880c7 is described below

commit dbb880c77ddd1b43ddc396e05d300701860198aa
Author: mmustafasenoglu <[email protected]>
AuthorDate: Mon Oct 12 21:31:05 2026 +0300

    Mark agtype_string_match_starts_with/_ends_with IMMUTABLE (#2579)
    
    Same inputs always produce the same output with no catalog lookups
    or session state, matching agtype_string_match_contains which is
    already IMMUTABLE. Unblocks user-built expression indexes on
    STARTS WITH / ENDS WITH predicates.
    
    Also updates the 1.8.0 upgrade script with ALTER FUNCTION entries.
    
    Fixes 2576
    
    Signed-off-by: Mustafa Senoglu <[email protected]>
---
 age--1.8.0--y.y.y.sql | 19 +++++++++++++++----
 sql/agtype_string.sql |  4 ++--
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/age--1.8.0--y.y.y.sql b/age--1.8.0--y.y.y.sql
index 974604dc..c5fa679d 100644
--- a/age--1.8.0--y.y.y.sql
+++ b/age--1.8.0--y.y.y.sql
@@ -58,10 +58,10 @@ CREATE FUNCTION ag_catalog.load_labels_from_file(graph_name 
name,
 DROP FUNCTION IF EXISTS ag_catalog.load_edges_from_file(name, name, text, 
bool);
 
 CREATE FUNCTION ag_catalog.load_edges_from_file(graph_name name,
-                                                label_name name,
-                                                file_path text,
-                                                load_as_agtype bool default 
false,
-                                                delimiter text default ',')
+                                                 label_name name,
+                                                 file_path text,
+                                                 load_as_agtype bool default 
false,
+                                                 delimiter text default ',')
     RETURNS void
     LANGUAGE c
     AS 'MODULE_PATHNAME';
@@ -100,3 +100,14 @@ BEGIN
       AND opcfamily = btree_family;
 END
 $$;
+
+--
+-- Mark agtype_string_match_starts_with/_ends_with IMMUTABLE
+--
+-- Issue #2576: same inputs always produce the same output with no catalog
+-- lookups or session state, matching agtype_string_match_contains which is
+-- already IMMUTABLE.
+
+ALTER FUNCTION ag_catalog.agtype_string_match_starts_with(agtype, agtype) 
IMMUTABLE;
+
+ALTER FUNCTION ag_catalog.agtype_string_match_ends_with(agtype, agtype) 
IMMUTABLE;
diff --git a/sql/agtype_string.sql b/sql/agtype_string.sql
index 0d7b2013..0be44eb1 100644
--- a/sql/agtype_string.sql
+++ b/sql/agtype_string.sql
@@ -24,7 +24,7 @@
 CREATE FUNCTION ag_catalog.agtype_string_match_starts_with(agtype, agtype)
     RETURNS agtype
     LANGUAGE c
-    STABLE
+    IMMUTABLE
 RETURNS NULL ON NULL INPUT
 PARALLEL SAFE
 AS 'MODULE_PATHNAME';
@@ -32,7 +32,7 @@ AS 'MODULE_PATHNAME';
 CREATE FUNCTION ag_catalog.agtype_string_match_ends_with(agtype, agtype)
     RETURNS agtype
     LANGUAGE c
-    STABLE
+    IMMUTABLE
 RETURNS NULL ON NULL INPUT
 PARALLEL SAFE
 AS 'MODULE_PATHNAME';

Reply via email to