# `AshPostgres.Extensions.ImmutableRaiseError`
[🔗](https://github.com/ash-project/ash_postgres/blob/v2.8.0/lib/extensions/immutable_raise_error.ex#L5)

An extension that installs an immutable version of ash_raise_error.

This can be used to improve compatibility with Postgres sharding extensions like Citus,
which requires functions used in CASE or COALESCE expressions to be immutable.

The new `ash_raise_error_immutable` functions add an additional row-dependent argument to ensure
the planner doesn't constant-fold error expressions.

To install, add this module to your repo's `installed_extensions` list:

```elixir
def installed_extensions do
  ["ash-functions", AshPostgres.Extensions.ImmutableRaiseError]
end
```

And run `mix ash_postgres.generate_migrations` to generate the migrations.

Once installed, you can control whether the immutable function is used by adding this to your
repo:

```elixir
def immutable_expr_error?, do: true
```

# `extension`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
