You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"execute(\"DROP FUNCTION IF EXISTS ash_to_jsonb_immutable(anyelement)\")"
53
+
end
54
+
43
55
defuninstall(_version)do
44
-
"execute(\"DROP FUNCTION IF EXISTS ash_raise_error_immutable(jsonb, ANYCOMPATIBLE), ash_raise_error_immutable(jsonb, ANYELEMENT, ANYCOMPATIBLE)\")"
56
+
"execute(\"DROP FUNCTION IF EXISTS ash_to_jsonb_immutable(anyelement), ash_raise_error_immutable(jsonb, anycompatible), ash_raise_error_immutable(jsonb, anyelement, anycompatible)\")"
45
57
end
46
58
47
59
defpash_raise_error_immutabledo
48
60
"""
49
61
execute(\"\"\"
50
-
CREATE OR REPLACE FUNCTION ash_raise_error_immutable(json_data jsonb, token ANYCOMPATIBLE)
51
-
RETURNS BOOLEAN AS $$
62
+
CREATE OR REPLACE FUNCTION ash_raise_error_immutable(json_data jsonb, token anycompatible)
63
+
RETURNS boolean AS $$
52
64
BEGIN
53
65
-- Raise an error with the provided JSON data.
54
66
-- The JSON object is converted to text for inclusion in the error message.
@@ -62,8 +74,8 @@ defmodule AshPostgres.Extensions.ImmutableRaiseError do
62
74
\"\"\")
63
75
64
76
execute(\"\"\"
65
-
CREATE OR REPLACE FUNCTION ash_raise_error_immutable(json_data jsonb, type_signal ANYELEMENT, token ANYCOMPATIBLE)
66
-
RETURNS ANYELEMENT AS $$
77
+
CREATE OR REPLACE FUNCTION ash_raise_error_immutable(json_data jsonb, type_signal anyelement, token anycompatible)
78
+
RETURNS anyelement AS $$
67
79
BEGIN
68
80
-- Raise an error with the provided JSON data.
69
81
-- The JSON object is converted to text for inclusion in the error message.
@@ -78,60 +90,48 @@ defmodule AshPostgres.Extensions.ImmutableRaiseError do
78
90
"""
79
91
end
80
92
93
+
# Wraps to_jsonb and pins session GUCs that affect JSON. This makes the function’s result
94
+
# deterministic, so it is safe to mark IMMUTABLE.
95
+
defpash_to_jsonb_immutabledo
96
+
"""
97
+
execute(\"\"\"
98
+
CREATE OR REPLACE FUNCTION ash_to_jsonb_immutable(value anyelement)
0 commit comments