BryanJBryce
Ash Postgres id column error on update
I’ve got an app with multitenency and I’m trying to do a basic update on on resource via GraphQL using the default update action and I’m getting this error:
POST /gql
“superhotel.hotellite.local”
[debug] Processing with Absinthe.Plug
Parameters: %{“operationName” => “UpdateLodgingItem”, “query” => “mutation UpdateLodgingItem($updateLodgingItemId: ID!, $input: UpdateLodgingItemInput) {\n updateLodgingItem(id: $updateLodgingItemId, input: $input) {\n errors {\n code\n fields\n message\n shortMessage\n vars\n }\n result {\n checkInDate\n checkOutDate\n id\n name\n quantity\n rate\n subtotal\n tax\n taxRate\n total\n }\n }\n}”, “variables” => %{“input” => %{“checkInDate” => “2024-05-31”, “checkOutDate” => “2024-06-01”, “name” => “”, “paymentId” => “c252365d-b5c0-4b28-ad17-ccfb70b3d102”, “rate” => “100.0”, “taxRate” => “0.067”}, “updateLodgingItemId” => “0405f3b0-fe49-433d-8b7f-cc7c10b889bb”}}
Pipelines: [:graphql]
“Set tenant to superhotel”
[debug] ABSINTHE schema=App.GraphqlSchema variables=%{“input” => %{“checkInDate” => “2024-05-31”, “checkOutDate” => “2024-06-01”, “name” => “”, “paymentId” => “c252365d-b5c0-4b28-ad17-ccfb70b3d102”, “rate” => “100.0”, “taxRate” => “0.067”}, “updateLodgingItemId” => “0405f3b0-fe49-433d-8b7f-cc7c10b889bb”}
mutation UpdateLodgingItem($updateLodgingItemId: ID!, $input: UpdateLodgingItemInput) {
updateLodgingItem(id: $updateLodgingItemId, input: $input) {
errors {
code
fields
message
shortMessage
vars
}
result {
checkInDate
checkOutDate
id
name
quantity
rate
subtotal
tax
taxRate
total
}
}
}
[debug] QUERY ERROR source=“lodging_items” db=0.0ms queue=2.3ms idle=81.0ms
UPDATE “superhotel”.“lodging_items” AS l0 SET “payment_id” = s1.“payment_id”, “check_out_date” = s1.“check_out_date”, “check_in_date” = s1.“check_in_date”, “rate” = s1.“rate”, “tax_rate” = s1.“tax_rate”, “name” = s1.“name” FROM (SELECT $1::uuid AS “payment_id”, $2::date AS “check_out_date”, $3::date AS “check_in_date”, $4::decimal AS “rate”, $5::decimal AS “tax_rate”, $6::text AS “name” FROM “superhotel”.“lodging_items” AS sl0 WHERE (sl0.“id”::uuid = $7::uuid) LIMIT $8) AS s1 WHERE (l0.“id” = s1.“id”) RETURNING l0.“id”, l0.“name”, l0.“rate”, l0.“check_in_date”, l0.“check_out_date”, l0.“tax_rate”, l0.“payment_id” [“c252365d-b5c0-4b28-ad17-ccfb70b3d102”, ~D[2024-06-01], ~D[2024-05-31], Decimal.new(“100.0”), Decimal.new(“0.067”), nil, “0405f3b0-fe49-433d-8b7f-cc7c10b889bb”, 1]
↳ AshPostgres.DataLayer.update_query/4, at: lib/data_layer.ex:1411
[error] a85087ec-5abb-42a7-86d2-df0f5485f23d: Exception raised while resolving query.
** (Postgrex.Error) ERROR 42703 (undefined_column) column s1.id does not exist
query: UPDATE "superhotel"."lodging_items" AS l0 SET "payment_id" = s1."payment_id", "check_out_date" = s1."check_out_date", "check_in_date" = s1."check_in_date", "rate" = s1."rate", "tax_rate" = s1."tax_rate", "name" = s1."name" FROM (SELECT $1::uuid AS "payment_id", $2::date AS "check_out_date", $3::date AS "check_in_date", $4::decimal AS "rate", $5::decimal AS "tax_rate", $6::text AS "name" FROM "superhotel"."lodging_items" AS sl0 WHERE (sl0."id"::uuid = $7::uuid) LIMIT $8) AS s1 WHERE (l0."id" = s1."id") RETURNING l0."id", l0."name", l0."rate", l0."check_in_date", l0."check_out_date", l0."tax_rate", l0."payment_id"
hint: Perhaps you meant to reference the column "l0.id".
(ecto_sql 3.11.2) lib/ecto/adapters/sql.ex:1054: Ecto.Adapters.SQL.raise_sql_call_error/1
(ecto_sql 3.11.2) lib/ecto/adapters/sql.ex:952: Ecto.Adapters.SQL.execute/6
(ecto 3.11.2) lib/ecto/repo/queryable.ex:232: Ecto.Repo.Queryable.execute/4
(ash_postgres 2.0.6) lib/data_layer.ex:1411: AshPostgres.DataLayer.update_query/4
(ash 3.0.8) lib/ash/actions/update/bulk.ex:442: Ash.Actions.Update.Bulk.do_atomic_update/5
(ash 3.0.8) lib/ash/actions/update/bulk.ex:231: Ash.Actions.Update.Bulk.run/6
(ash_graphql 1.0.1) lib/graphql/resolver.ex:1224: AshGraphql.Graphql.Resolver.mutate/2
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:234: Absinthe.Phase.Document.Execution.Resolution.reduce_resolution/1
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:189: Absinthe.Phase.Document.Execution.Resolution.do_resolve_field/3
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:174: Absinthe.Phase.Document.Execution.Resolution.do_resolve_fields/6
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:145: Absinthe.Phase.Document.Execution.Resolution.resolve_fields/4
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:88: Absinthe.Phase.Document.Execution.Resolution.walk_result/5
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:67: Absinthe.Phase.Document.Execution.Resolution.perform_resolution/3
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:24: Absinthe.Phase.Document.Execution.Resolution.resolve_current/3
(absinthe 1.7.6) lib/absinthe/pipeline.ex:408: Absinthe.Pipeline.run_phase/3
(absinthe_plug 1.5.8) lib/absinthe/plug.ex:536: Absinthe.Plug.run_query/4
(absinthe_plug 1.5.8) lib/absinthe/plug.ex:290: Absinthe.Plug.call/2
(phoenix 1.7.12) lib/phoenix/router/route.ex:42: Phoenix.Router.Route.call/2
(phoenix 1.7.12) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5
(app 0.1.0) lib/app_web/endpoint.ex:1: AppWeb.Endpoint.plug_builder_call/2
Marked As Solved
zachdaniel
Creator of Ash
Also Liked
zachdaniel
Creator of Ash
okay in that case please open an issue in ash_postgres and I will look into it as soon as I am able ![]()
1
Last Post!
BryanJBryce
Popular in Questions
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
Hi guys, i’m new in the Elixir world, and i have to say, that i love it!
i’m having some problem to understand anonymous functions with ...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
Other popular topics
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
New
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
New
What learn first? Rust or Elixir
Hi Elixir community!
I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










