Ash FrameworkAF
Ash Framework5mo ago
6 replies
bhelms

Type error from ash_postgres for `{:array, :map}`

I have this resource attribute:
actions do
  defaults [:read, create: :*, update: :*]
end

attributes do
  attribute :things, {:array, :map} do
    default []
    public? true
    allow_nil? false
  end
end


When attempting to update the resource with resource |> Ash.Changeset.for_update(:update, %{things: [%{key: "value"}]}) |> Ash.update! I get this error:
Unknown Error

* ** (Postgrex.Error) ERROR 42804 (datatype_mismatch) column "things" is of type jsonb[] but expression is of type text[]


I found this article https://elixirforum.com/t/ash-resource-update-error-postgrex-error-error-42804-datatype-mismatch-column-roles-is-of-type-jsonb/62136, but I'm on latest ash_postgres 2.6.17.
Any insight into why I'm getting this would be great. It works fine when using an Ecto Schema and Changeset.
Was this page helpful?