Skip to content
New issue

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

Compile error #102

Open
char0n opened this issue Feb 17, 2020 · 2 comments
Open

Compile error #102

char0n opened this issue Feb 17, 2020 · 2 comments

Comments

@char0n
Copy link

char0n commented Feb 17, 2020

While documentation says this should be possible, I'm getting query compilation errors here.

iex(1)> import Ecto.Query                                
Ecto.Query
iex(2)> from(v in Videos, where: v.visibility == :public)
** (Ecto.Query.CompileError) `:public` is not a valid query expression
    (ecto 3.3.2) expanding macro: Ecto.Query.where/3
    iex:2: (file)
    (ecto 3.3.2) expanding macro: Ecto.Query.from/2
    iex:2: (file)

There are multiple workaround for this, but does anybody have a clue why this happens?

Thank you

@nicklayb
Copy link

nicklayb commented Mar 17, 2020

This is not related to ecto_enum. You must pin the value you want to use in from/2.

Doing the following should work:

iex(1)> import Ecto.Query                                
Ecto.Query
iex(2)> from(v in Videos, where: v.visibility == ^:public)

(notice the caret before :public)

@char0n
Copy link
Author

char0n commented Mar 17, 2020

Thanks for explanation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants