We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug Considering a map actor , the following code throws an exception:
aggregates do first :current_user_reaction, :reactions, :name do filter expr(author.id == ^actor([:staff, :id])) end end
(where reactions and author are associations from the current record)
** (exit) an exception was raised: ** (FunctionClauseError) no function clause matching in anonymous fn/2 in Ash.Actions.Read.Relationships.attach_related_records/2 (ash 2.21.6) lib/ash/actions/read/relationships.ex:28: anonymous fn({:__exception__, %RuntimeError{message: "Unsupported expression in AshPostgres query: {:_actor, [:staff, :id]}"}, [{AshPostgres.Expr, :do_dynamic_expr, 6, [file: ~c"lib/expr.ex", line: 1751, error_info: %{module: Exception}]}, {AshPostgres.Expr, :do_dynamic_expr, 6, [file: ~c"lib/expr.ex", line: 893]}, {AshPostgres.DataLayer, :"-add_filter_expression/2-fun-0-", 2, [file: ~c"lib/data_layer.ex", line: 3196]}, {Enum, :"-reduce/3-lists^foldl/2-0-", 3, [file: ~c"lib/enum.ex", line: 2528]}, {AshPostgres.DataLayer, :filter, 4, [file: ~c"lib/data_layer.ex", line: 3108]}, {AshPostgres.Aggregate, :"-maybe_filter_subquery/6-fun-0-", 5, [file: ~c"lib/aggregate.ex", line: 703]}, {Enumerable.List, :reduce, 3, [file: ~c"lib/enum.ex", line: 4842]}, {Enum, :reduce_while, 3, [file: ~c"lib/enum.ex", line: 2582]}, {AshPostgres.Aggregate, :"-add_aggregates/6-fun-7-", 9, [file: ~c"lib/aggregate.ex", line: 299]}, {AshPostgres.Join, :related_subquery, 3, [file: ~c"lib/join.ex", line: 244]}, {AshPostgres.Aggregate, :"-add_aggregates/6-fun-9-", 6, [file: ~c"lib/aggregate.ex", line: 151]}, {Enumerable.List, :reduce, 3, [file: ~c"lib/enum.ex", line: 4842]}, {Enum, :reduce_while, 3, [file: ~c"lib/enum.ex", line: 2582]}, {AshPostgres.Aggregate, :add_aggregates, 6, [file: ~c"lib/aggregate.ex", line: 80]}, {Ash.Query, :data_layer_query, 2, [file: ~c"lib/ash/query/query.ex", line: 2719]}, {Ash.Actions.Read, :"-do_read/4-fun-0-", 5, [file: ~c"lib/ash/actions/read/read.ex", line: 405]}, {Ash.Engine, :"-async/2-fun-2-", 4, [file: ~c"lib/ash/engine/engine.ex", line: 514]}, {Task.Supervised, :invoke_mfa, 2, [file: ~c"lib/task/supervised.ex", line: 101]}, {Task.Supervised, :reply, 4, [file: ~c"lib/task/supervised.ex", line: 36]}, {Ash.Engine, :async, 2, [file: ~c"lib/ash/engine/engine.ex", line: 508]}, {Ash.Engine, :async, 2, [file: ~c"lib/ash/engine/engine.ex", line: 508]}, {Ash.Actions.Read.AsyncLimiter, :async_or_inline, 3, [file: ~c"lib/ash/actions/read/async_limiter.ex", line: 36]}, {Enum, :"-map/2-fun-0-", 3, [file: ~c"lib/enum.ex", line: 1708]}, {Enum, :"-map/2-anonymous-3-", 3, [file: ~c"lib/enum.ex", line: 4399]}, {Enumerable.Stream, :"-reduce/3-fun-0-", 3, [file: ~c"lib/stream.ex", line: 1816]}, {Enumerable.List, :reduce, 3, [file: ~c"lib/enum.ex", line: 4842]}, {Enumerable.Stream, :do_each, 4, [file: ~c"lib/stream.ex", line: 1828]}, {Enum, :map, 2, [file: ~c"lib/enum.ex", line: 4399]}, {Ash.Actions.Read.Relationships, :fetch_related_records, 2, [file: ~c"lib/ash/actions/read/relationships.ex", line: 39]}, {Ash.Actions.Read.Relationships, :load, 3, [file: ~c"lib/ash/actions/read/relationships.ex", line: 23]}, {Ash.Actions.Read, :do_run, 3, [file: ~c"lib/ash/actions/read/read.ex", line: 248]}, {Ash.Actions.Read, :"-run/3-fun-2-", 3, [file: ~c"lib/ash/actions/read/read.ex", line: 50]}, {Ash.Actions.Read, :run, 3, [file: ~c"lib/ash/actions/read/read.ex", line: 49]}, {Ash.Api, :read_one, 3, [file: ~c"lib/ash/api/api.ex", line: 2612]}, {Students, :read_one, 2, [file: ~c"lib/.../students.ex", line: 1]}, {, :by_id, 3, [file: ~c"deps/ash/lib/ash/code_interface.ex", line: 512]}, {NotesDetailLive, :fetch_note, 2, [file: ~c"lib/.../notes_detail_live.ex", line: 142]}, {NotesDetailLive, :mount, 3, [file: ~c"lib/.../detail_live.ex", line: 47]}, {Phoenix.LiveView.Utils, :"-maybe_call_live_view_mount!/5-fun-0-", 6, [file: ~c"lib/phoenix_live_view/utils.ex", line: 354]}]}, {:ok, [#Note<>, __meta__: #Ecto.Schema.Metadata<:loaded, "notes">, id: "9572eefb-84a5-4f42-9dc6-8f75b710361b", ...>]}) in Ash.Actions.Read.Relationships.attach_related_records/2 (elixir 1.16.0) lib/enum.ex:4842: Enumerable.List.reduce/3 (elixir 1.16.0) lib/enum.ex:2582: Enum.reduce_while/3 (ash 2.21.6) lib/ash/actions/read/read.ex:248: Ash.Actions.Read.do_run/3 (ash 2.21.6) lib/ash/actions/read/read.ex:50: anonymous fn/3 in Ash.Actions.Read.run/3 (ash 2.21.6) lib/ash/actions/read/read.ex:49: Ash.Actions.Read.run/3 (ash 2.21.6) lib/ash/api/api.ex:2612: Ash.Api.read_one/3
%Ash.Error.Invalid{ errors: [ %Ash.Error.Query.NoSuchFunction{ name: :actor, arity: nil, changeset: nil, query: nil, error_context: ["Loading aggregate: :current_user_reaction for query: #Ash.Query, sort: [inserted_at: :asc]>>}>"], vars: [], path: [:content, :aggregates, :filter], stacktrace: #Stacktrace<>, class: :invalid } ], changeset: nil, query: nil, error_context: [nil], vars: [], path: [], stacktrace: #Stacktrace<>, class: :invalid }
Expected behavior It should return the correct matching reaction name if it exists.
Runtime
The text was updated successfully, but these errors were encountered:
This should be fixed in 3.0
Sorry, something went wrong.
No branches or pull requests
Describe the bug
Considering a map actor , the following code throws an exception:
(where reactions and author are associations from the current record)
Exception
And if the actor is not pinned:
Expected behavior
It should return the correct matching reaction name if it exists.
Runtime
The text was updated successfully, but these errors were encountered: