woylie / flop

Filtering, ordering and pagination for Ecto
MIT License
640 stars 35 forks source link

[Bug] Ecto.Query.CompileError #346

Closed atomkirk closed 1 year ago

atomkirk commented 1 year ago

Summary

I get this when compiling flop:

==> flop
Compiling 13 files (.ex)

== Compilation error in file lib/flop/builder.ex ==
** (Ecto.Query.CompileError) `not (is_nil(field(r, ^var!(field))) == ^var!(value))` is not a valid query expression.

* If you intended to call an Elixir function or introduce a value,
  you need to explicitly interpolate it with ^

* If you intended to call a database function, please check the documentation
  for Ecto.Query.API to see the supported database expressions

* If you intended to extend Ecto's query DSL, make sure that you have required
  the module or imported the relevant function. Note that you need macros to
  extend Ecto's querying capabilities

    (ecto 3.6.2) expanding macro: Ecto.Query.dynamic/2
    lib/flop/builder.ex:196: Flop.Builder.build_op/3
    expanding macro: Flop.Operators.build_dynamic/3
    lib/flop/builder.ex:196: Flop.Builder.build_op/3
could not compile dependency :flop, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile flop", update it with "mix deps.update flop" or clean it with "mix deps.clean flop"

Steps to reproduce

  1. heres my deps:
      {:absinthe_plug, "~> 1.5.5"},
      {:absinthe_relay, "~> 1.5.1"},
      {:absinthe, "~> 1.6.3"},
      {:bamboo_phoenix, "~> 1.0.0"},
      {:bamboo, "~> 2.2.0"},
      {:bcrypt_elixir, "~> 3.0"},
      {:broadway_sqs, "~> 0.6.1"},
      {:csv, "~> 2.3"},
      {:dataloader, "~> 1.0.0"},
      {:decimal, "~> 2.0"},
      {:earmark, "~> 1.4.14"},
      {:ecto_enum, "~> 1.4"},
      {:ecto_sql, "~> 3.6.2"},
      {:ecto, "~> 3.6.2", override: true},
      {:esbuild, "~> 0.3", runtime: Mix.env() == :dev},
      {:ex_aws_lambda, "~> 2.0.1"},
      {:ex_aws_s3, "~> 2.0"},
      {:ex_aws_sns, "~> 2.0"},
      {:ex_aws_sqs, "~> 3.2"},
      {:ex_aws, "~> 2.2.1"},
      {:ex_phone_number, "~> 0.2"},
      {:exq, "~> 0.14.0"},
      {:exvcr, "~> 0.13.0", only: :test},
      {:faker, "~> 0.12", only: [:dev, :test, :prod]},
      {:finch, "~> 0.3"},
      {:floki, ">= 0.30.0", only: :test},
      {:geo_postgis, "~> 3.4"},
      {:geolix_adapter_mmdb2, "~> 0.5.0"},
      {:geolix, "~> 1.0"},
      {:gettext, "~> 0.11"},
      {:goth, "~> 1.3-rc"},
      {:guardian, git: "https://github.com/ueberauth/guardian.git", ref: "9baef5b2880ed23d33f0e7c7c0a0ee58e09fc852"},
      {:hackney, "~> 1.17", override: true},
      {:httpoison, "~> 1.7.0"},
      {:icalendar, "~> 1.1.0"},
      {:ja_serializer, "~> 0.16.0"},
      {:jason, "~> 1.2"},
      {:jaxon, "~> 2.0"},
      {:jsx, "~> 3.0", override: true},
      {:logger_json, "~> 4.3"},
      {:logstash_json, "~> 0.7.4"},
      {:number, "~> 1.0.3"},
      {:petal_components, "~> 1.0"},
      {:petal_framework, "~> 0.4.5", repo: "petal"},
      {:phoenix_ecto, "~> 4.4.0"},
      {:phoenix_html, "~> 3.3.0"},
      {:phoenix_live_reload, "~> 1.4", only: :dev},
      {:phoenix_live_view, "~> 0.19"},
      {:phoenix_pubsub_redis, "~> 3.0.0"},
      {:phoenix_pubsub, "~> 2.1"},
      {:phoenix_view, "~> 2.0"},
      {:phoenix, "~> 1.7.0"},
      {:plug_cowboy, "~> 2.0"},
      {:postgrex, ">= 0.0.0"},
      {:recurring_events, "~> 0.4.0"},
      {:redix, "~> 0.11.1", override: true},
      {:scribe, "~> 0.10"},
      {:sentry, "~> 7.0"},
      {:sweet_xml, "~> 0.6"},
      {:tailwind, "~> 0.1.6", runtime: Mix.env() == :dev},
      {:tesla, "~> 1.5.0"},
      {:timex, "~> 3.7"},
      {:yaml_elixir, "~> 2.7.0"}

Expected behaviour

it compiles

Actual behaviour

error above

Elixir/Erlang version

1.14.2

Flop and Ecto versions

Additional context

No response

woylie commented 1 year ago

Thanks, I could reproduce this with the versions you mentioned. The error goes away after upgrading ecto_sql to 3.7.0. Flop officially requires ecto_sql ~> 3.9, so I'll close this, since this ecto_sql version is unsupported.