diff --git a/lib/migration_generator/ash_functions.ex b/lib/migration_generator/ash_functions.ex index 369173cb..53b29ac9 100644 --- a/lib/migration_generator/ash_functions.ex +++ b/lib/migration_generator/ash_functions.ex @@ -10,6 +10,7 @@ defmodule AshPostgres.MigrationGenerator.AshFunctions do CREATE OR REPLACE FUNCTION ash_elixir_or(left BOOLEAN, in right ANYCOMPATIBLE, out f1 ANYCOMPATIBLE) AS $$ SELECT COALESCE(NULLIF($1, FALSE), $2) $$ LANGUAGE SQL + SET search_path = '' IMMUTABLE; \"\"\") @@ -17,6 +18,7 @@ defmodule AshPostgres.MigrationGenerator.AshFunctions do CREATE OR REPLACE FUNCTION ash_elixir_or(left ANYCOMPATIBLE, in right ANYCOMPATIBLE, out f1 ANYCOMPATIBLE) AS $$ SELECT COALESCE($1, $2) $$ LANGUAGE SQL + SET search_path = '' IMMUTABLE; \"\"\") @@ -27,6 +29,7 @@ defmodule AshPostgres.MigrationGenerator.AshFunctions do ELSE $1 END $$ LANGUAGE SQL + SET search_path = '' IMMUTABLE; \"\"\") @@ -37,6 +40,7 @@ defmodule AshPostgres.MigrationGenerator.AshFunctions do ELSE $1 END $$ LANGUAGE SQL + SET search_path = '' IMMUTABLE; \"\"\") @@ -62,6 +66,7 @@ defmodule AshPostgres.MigrationGenerator.AshFunctions do END IF; END; $$ LANGUAGE plpgsql + SET search_path = '' IMMUTABLE; \"\"\") @@ -115,6 +120,7 @@ defmodule AshPostgres.MigrationGenerator.AshFunctions do END IF; END; $$ LANGUAGE plpgsql + SET search_path = '' IMMUTABLE; \"\"\") """ @@ -177,7 +183,8 @@ defmodule AshPostgres.MigrationGenerator.AshFunctions do RAISE EXCEPTION '#{prefix}%', json_data::text; RETURN NULL; END; - $$ LANGUAGE plpgsql; + $$ LANGUAGE plpgsql + SET search_path = ''; \"\"\") execute(\"\"\" @@ -189,7 +196,8 @@ defmodule AshPostgres.MigrationGenerator.AshFunctions do RAISE EXCEPTION '#{prefix}%', json_data::text; RETURN NULL; END; - $$ LANGUAGE plpgsql; + $$ LANGUAGE plpgsql + SET search_path = ''; \"\"\") """ end @@ -220,6 +228,7 @@ defmodule AshPostgres.MigrationGenerator.AshFunctions do END $$ LANGUAGE PLPGSQL + SET search_path = '' VOLATILE; \"\"\") @@ -230,6 +239,7 @@ defmodule AshPostgres.MigrationGenerator.AshFunctions do SELECT to_timestamp(('x0000' || substr(_uuid::TEXT, 1, 8) || substr(_uuid::TEXT, 10, 4))::BIT(64)::BIGINT::NUMERIC / 1000); $$ LANGUAGE SQL + SET search_path = '' IMMUTABLE PARALLEL SAFE STRICT; \"\"\") """