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

Raise if user tries to query embedded schema #4364

Merged
merged 2 commits into from
Feb 4, 2024

Conversation

greg-rychlewski
Copy link
Member

There are some edge cases around embedded schemas that I think can be cleaned up a little. This one happens when you try to query an embedded schema. Currently, you'll get an error like this:

(Postgrex.Error) ERROR 42P01 (undefined_table) relation "nil" does not exist

With this change you'll get this

** (Protocol.UndefinedError) protocol Ecto.Queryable not implemented for Ecto.Integration.Item of type Atom, the given module is an embedded schema. This protocol is implemented for the following type(s): Atom, BitString, Ecto.Query, Ecto.SubQuery, Tuple

@greg-rychlewski
Copy link
Member Author

I think this makes sense, but I might be missing something. Like if there is a special case for MongoDB or something like that.

Copy link
Member

@v0idpwn v0idpwn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful

@v0idpwn
Copy link
Member

v0idpwn commented Feb 3, 2024

I don't think there's any case you could use this before. But I may also be missing something 🤔

@greg-rychlewski greg-rychlewski merged commit 9a76a54 into elixir-ecto:master Feb 4, 2024
6 checks passed
@greg-rychlewski greg-rychlewski deleted the embeds branch February 4, 2024 11:20
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

Successfully merging this pull request may close these issues.

3 participants