Closed simpers closed 1 year ago
Alight @simpers I've pushed something up to ash_postgres to at least fix this partially. Can you try that out and see how it goes? Thanks for your patience with me, I'm wrapping up my vacation and getting back on top of everything :)
You'd want to try out ash_postgres main
Will give this a go at some point today, @zachdaniel! :)
Sorry for the late report. I tried it on the day but I wanted to run some tests with the old version as well to compare the error messages, but I haven't had enough time to reproduce the different results. This is however the error I get now on both master
and v1.1.3 of AshPostgres
I seem to be getting this now:
1) test createEvent mutation a user can create a basic event (LpeWeb.Gql.CreateEventTest)
test/lpe_web/gql/mutations/create_event_test.exs:40
** (RuntimeError) Error while building reference: accepted_host_invites.state
stacktrace:
(ash_postgres 1.1.3) lib/expr.ex:779: AshPostgres.Expr.do_dynamic_expr/5
(ash_postgres 1.1.3) lib/expr.ex:391: AshPostgres.Expr.do_dynamic_expr/5
(ash_postgres 1.1.3) lib/join.ex:179: AshPostgres.Join.do_relationship_filter/6
(ash_postgres 1.1.3) lib/join.ex:140: AshPostgres.Join.maybe_get_resource_query/5
(ash_postgres 1.1.3) lib/join.ex:560: AshPostgres.Join.do_join_relationship/6
(ash_postgres 1.1.3) lib/join.ex:66: anonymous fn/5 in AshPostgres.Join.join_all_relationships/5
(elixir 1.14.1) lib/enum.ex:4751: Enumerable.List.reduce/3
(elixir 1.14.1) lib/enum.ex:2514: Enum.reduce_while/3
(ash_postgres 1.1.3) lib/aggregate.ex:45: anonymous fn/4 in AshPostgres.Aggregate.add_aggregates/4
(elixir 1.14.1) lib/enum.ex:4751: Enumerable.List.reduce/3
(elixir 1.14.1) lib/enum.ex:2514: Enum.reduce_while/3
(ash_postgres 1.1.3) lib/aggregate.ex:15: AshPostgres.Aggregate.add_aggregates/4
(ash 2.4.18) lib/ash/query/aggregate.ex:342: anonymous fn/6 in Ash.Query.Aggregate.value_request/8
(ash 2.4.18) lib/ash/engine/engine.ex:460: anonymous fn/2 in Ash.Engine.run_iteration/1
(ash 2.4.18) lib/ash/engine/engine.ex:480: anonymous fn/3 in Ash.Engine.async/2
(elixir 1.14.1) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
(elixir 1.14.1) lib/task/supervised.ex:34: Task.Supervised.reply/4
(stdlib 4.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Got it reproduced, thanks :)
On Fri, Dec 02, 2022 at 4:06 AM, Simon Bergström < @.*** > wrote:
Sorry for the late report. I tried it on the day but I wanted to run some tests with the old version as well to compare the error messages, but I haven't had enough time to reproduce the different results. This is however the error I get now on both master and v1.1.3 of AshPostgres
I seem to be getting this now:
1) test createEvent mutation a user can create a basic event (LpeWeb.Gql.CreateEventTest)
test/lpe_web/gql/mutations/create_event_test.exs:40 ** (RuntimeError) Error while building reference: accepted_host_invites.state stacktrace: (ash_postgres 1.1.3) lib/expr.ex:779: AshPostgres.Expr.do_dynamic_expr/5 (ash_postgres 1.1.3) lib/expr.ex:391: AshPostgres.Expr.do_dynamic_expr/5
(ash_postgres 1.1.3) lib/join.ex:179: AshPostgres.Join.do_relationship_filter/6 (ash_postgres 1.1.3) lib/join.ex:140: AshPostgres.Join.maybe_get_resource_query/5
(ash_postgres 1.1.3) lib/join.ex:560: AshPostgres.Join.do_join_relationship/6 (ash_postgres 1.1.3) lib/join.ex:66: anonymous fn/5 in AshPostgres.Join.join_all_relationships/5 (elixir 1.14.1) lib/enum.ex:4751: Enumerable.List.reduce/3 (elixir 1.14.1) lib/enum.ex:2514: Enum.reduce_while/3 (ash_postgres 1.1.3) lib/aggregate.ex:45: anonymous fn/4 in AshPostgres.Aggregate.add_aggregates/4 (elixir 1.14.1) lib/enum.ex:4751: Enumerable.List.reduce/3 (elixir 1.14.1) lib/enum.ex:2514: Enum.reduce_while/3 (ash_postgres 1.1.3) lib/aggregate.ex:15: AshPostgres.Aggregate.add_aggregates/4 (ash 2.4.18) lib/ash/query/aggregate.ex:342: anonymous fn/6 in Ash.Query.Aggregate.value_request/8 (ash 2.4.18) lib/ash/engine/engine.ex:460: anonymous fn/2 in Ash.Engine.run_iteration/1 (ash 2.4.18) lib/ash/engine/engine.ex:480: anonymous fn/3 in Ash.Engine.async/2 (elixir 1.14.1) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2 (elixir 1.14.1) lib/task/supervised.ex:34: Task.Supervised.reply/4 (stdlib 4.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
— Reply to this email directly, view it on GitHub ( https://github.com/ash-project/ash/issues/446#issuecomment-1334955696 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/ABLVBY2NPO73WEMXOB7MRK3WLG33DANCNFSM6AAAAAAR4LIMR4 ). You are receiving this because you were mentioned. Message ID: <ash-project/ash/issues/446/1334955696 @ github. com>
This one was tough! My reproduction test now passes, so if you don't mind trying out ash_postgres
main and ash main (need them both), that would be great 🥳
Perfect! I have just now cleared my repo out a little so that the next time I sat down I'd be able to get a simple git diff of what I add so I can myself keep track of what's what hah. It's so early in on this project that I just keep making these huges changes haha.
Testing this first thing tomorrow. Making a Todoist for it too! 🥳
It seems my test has passed now, so I'll just make sure to double check that my test is sane hhaha
But so far, so good! 👍🏽 🌟
🎉🎉🎉
Describe the bug I want to make it possible to filter a many_to_many by the
through
resource's values, as it is not just a simple composite key. It also has some state. After discussing on Discord we arrived at the solution below that ought to have worked, but I am getting some bugs.@zachdaniel thinks there are several bugs involved in this.
To Reproduce After discussing on the Discord I have arrived at the following code to easily produce filtered versions of a many_to_many relationship:
If the lines are commented – as above – then it doesn't compile. The
many_to_many
requires it:With the lines, I get:
Temporarily commented out the loading of those aggregates and tried again, and then I got:
Expected behavior It shouldn't crash and depending on the conclusion of # 1 in the first section of this issue, it should or shouldn't be necessary to declare the source and destination attributes.
Runtime