Describe the bug
Attempting to use the latest Ash 3.0.7 support for where clauses in identities:
# in the identities block
identity :name, [:name] do
nils_distinct? false
where expr(is_nil(archived_at))
end
# and in the postgres block
identity_wheres_to_sql name: "archived_at is null"
The migration generated for this, when run throws this error:
** (Postgrex.Error) ERROR 42601 (syntax_error) syntax error at or near "NULLS"
query: CREATE UNIQUE INDEX "pipeline_defns_name_index" ON "pipeline_defns" (name) NULLS NOT DISTINCT WHERE archived_at is null
Upon removing the nils_distinct? false line and regenerating the migration then running it gives:
Indeed, the migration up function just does a create unique_index(...) and does not attempt to alter the index or delete and recreate it.
To Reproduce
See above for reproduction.
Expected behavior
The SQL for NULLS NOT DISTINCT should be correct, but postgresql doesn't like it.
The migration generated should alter or recreate the index, not attempt to create an already-extant index.
Runtime
Elixir version 1.16.2
Erlang version 26
OS Ubuntu 22.04
Ash version 3.0.7
any related extension versions
Postgresql is version 14.11
Describe the bug Attempting to use the latest Ash 3.0.7 support for where clauses in identities:
The migration generated for this, when run throws this error:
Upon removing the
nils_distinct? false
line and regenerating the migration then running it gives:Indeed, the migration
up
function just does acreate unique_index(...)
and does not attempt to alter the index or delete and recreate it.To Reproduce See above for reproduction.
Expected behavior The SQL for NULLS NOT DISTINCT should be correct, but postgresql doesn't like it. The migration generated should alter or recreate the index, not attempt to create an already-extant index.
Runtime