Version 3.5.25 generates wrong SQL

* ** (Postgrex.Error) ERROR 3F000 (invalid_schema_name) schema "excluded" does not exist

query: INSERT INTO "tokens" AS t0 ("subject","purpose","created_at","expires_at","jti","updated_at") VALUES ($1,$2,$3,$4,$5,$6) ON CONFLICT ("jti") DO UPDATE SET "subject" = EXCLUDED.identifier('subject'), "purpose" = EXCLUDED.identifier('purpose'), "expires_at" = EXCLUDED.identifier('expires_at'), "updated_at" = COALESCE(EXCLUDED.identifier('updated_at'), $7) RETURNING "updated_at","created_at","extra_data","purpose","expires_at","subject","jti"
* ** (Postgrex.Error) ERROR 3F000 (invalid_schema_name) schema "excluded" does not exist

query: INSERT INTO "tokens" AS t0 ("subject","purpose","created_at","expires_at","jti","updated_at") VALUES ($1,$2,$3,$4,$5,$6) ON CONFLICT ("jti") DO UPDATE SET "subject" = EXCLUDED.identifier('subject'), "purpose" = EXCLUDED.identifier('purpose'), "expires_at" = EXCLUDED.identifier('expires_at'), "updated_at" = COALESCE(EXCLUDED.identifier('updated_at'), $7) RETURNING "updated_at","created_at","extra_data","purpose","expires_at","subject","jti"
Just updated to the new version and my tests started to fail
Solution:
updating only ecto causes this issue
Jump to solution
3 Replies
Vahagn
VahagnOP4mo ago
The stack
(ecto_sql 3.12.1) lib/ecto/adapters/sql.ex:1096: Ecto.Adapters.SQL.raise_sql_call_error/1
(ecto_sql 3.12.1) lib/ecto/adapters/sql.ex:967: Ecto.Adapters.SQL.insert_all/9
(ecto 3.13.2) lib/ecto/repo/schema.ex:84: Ecto.Repo.Schema.do_insert_all/7
(ash_postgres 2.6.3) lib/data_layer.ex:1980: AshPostgres.DataLayer.bulk_create/3
(ash_postgres 2.6.3) lib/data_layer.ex:2900: AshPostgres.DataLayer.upsert/4
(ash 3.5.25) lib/ash/actions/create/create.ex:379: anonymous fn/6 in Ash.Actions.Create.commit/3
(ash 3.5.25) lib/ash/changeset/changeset.ex:4653: Ash.Changeset.run_around_actions/2
(ash 3.5.25) lib/ash/changeset/changeset.ex:4331: anonymous fn/2 in Ash.Changeset.transaction_hooks/2
(ash 3.5.25) lib/ash/changeset/changeset.ex:4241: Ash.Changeset.with_hooks/3
(ash 3.5.25) lib/ash/actions/create/create.ex:261: Ash.Actions.Create.commit/3
(ash 3.5.25) lib/ash/actions/create/create.ex:132: Ash.Actions.Create.do_run/4
(ash 3.5.25) lib/ash/actions/create/create.ex:50: Ash.Actions.Create.run/4
(ash_authentication 4.9.0) lib/ash_authentication/token_resource/actions.ex:306: AshAuthentication.TokenResource.Actions.store_token/3
(ash_authentication 4.9.0) lib/ash_authentication/jwt.ex:114: AshAuthentication.Jwt.token_for_user/4
(ash_authentication 4.9.0) lib/ash_authentication/generate_token_change.ex:48: AshAuthentication.GenerateTokenChange.generate_token/4
(ash_authentication 4.9.0) lib/ash_authentication/generate_token_change.ex:19: anonymous fn/4 in AshAuthentication.GenerateTokenChange.change/3
(ash 3.5.25) lib/ash/changeset/changeset.ex:4711: anonymous fn/2 in Ash.Changeset.run_after_actions/3
(elixir 1.18.4) lib/enum.ex:4968: Enumerable.List.reduce/3
(elixir 1.18.4) lib/enum.ex:2600: Enum.reduce_while/3
(ash 3.5.25) lib/ash/changeset/changeset.ex:4189: anonymous fn/3 in Ash.Changeset.with_hooks/3
(ecto_sql 3.12.1) lib/ecto/adapters/sql.ex:1096: Ecto.Adapters.SQL.raise_sql_call_error/1
(ecto_sql 3.12.1) lib/ecto/adapters/sql.ex:967: Ecto.Adapters.SQL.insert_all/9
(ecto 3.13.2) lib/ecto/repo/schema.ex:84: Ecto.Repo.Schema.do_insert_all/7
(ash_postgres 2.6.3) lib/data_layer.ex:1980: AshPostgres.DataLayer.bulk_create/3
(ash_postgres 2.6.3) lib/data_layer.ex:2900: AshPostgres.DataLayer.upsert/4
(ash 3.5.25) lib/ash/actions/create/create.ex:379: anonymous fn/6 in Ash.Actions.Create.commit/3
(ash 3.5.25) lib/ash/changeset/changeset.ex:4653: Ash.Changeset.run_around_actions/2
(ash 3.5.25) lib/ash/changeset/changeset.ex:4331: anonymous fn/2 in Ash.Changeset.transaction_hooks/2
(ash 3.5.25) lib/ash/changeset/changeset.ex:4241: Ash.Changeset.with_hooks/3
(ash 3.5.25) lib/ash/actions/create/create.ex:261: Ash.Actions.Create.commit/3
(ash 3.5.25) lib/ash/actions/create/create.ex:132: Ash.Actions.Create.do_run/4
(ash 3.5.25) lib/ash/actions/create/create.ex:50: Ash.Actions.Create.run/4
(ash_authentication 4.9.0) lib/ash_authentication/token_resource/actions.ex:306: AshAuthentication.TokenResource.Actions.store_token/3
(ash_authentication 4.9.0) lib/ash_authentication/jwt.ex:114: AshAuthentication.Jwt.token_for_user/4
(ash_authentication 4.9.0) lib/ash_authentication/generate_token_change.ex:48: AshAuthentication.GenerateTokenChange.generate_token/4
(ash_authentication 4.9.0) lib/ash_authentication/generate_token_change.ex:19: anonymous fn/4 in AshAuthentication.GenerateTokenChange.change/3
(ash 3.5.25) lib/ash/changeset/changeset.ex:4711: anonymous fn/2 in Ash.Changeset.run_after_actions/3
(elixir 1.18.4) lib/enum.ex:4968: Enumerable.List.reduce/3
(elixir 1.18.4) lib/enum.ex:2600: Enum.reduce_while/3
(ash 3.5.25) lib/ash/changeset/changeset.ex:4189: anonymous fn/3 in Ash.Changeset.with_hooks/3
ZachDaniel
ZachDaniel4mo ago
make sure that you've updated both ecto and ecto_sql
Solution
ZachDaniel
ZachDaniel4mo ago
updating only ecto causes this issue

Did you find this page helpful?