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

Support non-string prefix #4497

Merged

Conversation

JesseStimpson
Copy link
Contributor

Discussed in #4496

These changes allow an adapter to support a :prefix and @schema_prefix of any type, rather than being restricted to String.t().

  1. At compile time, from and join query portions still require either string literal or interpolated value. The interpolated value can be anything. Additional literals can be supported here if desired. (from.ex:87 and join.ex:146)
  2. Happy to add more tests, let me know if you see gaps
  3. I also verified ecto_sql's tests still pass

Thanks!

@josevalim
Copy link
Member

We should probably send a PR to ecto_sql that validates the string to be a prefix (or nil) on that side with a clear error message. :)

@greg-rychlewski
Copy link
Member

At compile time, from and join query portions still require either string literal

If we are saying adapters control the prefix then what would be the issue with from p in Post, prefix: 123

@josevalim
Copy link
Member

We can probably allow it to be "any literal" but I think it is ok to be a bit more conservative when relaxing those rules. WDYT?

@JesseStimpson
Copy link
Contributor Author

JesseStimpson commented Aug 23, 2024 via email

@greg-rychlewski greg-rychlewski merged commit 61ca67a into elixir-ecto:master Aug 23, 2024
6 checks passed
@greg-rychlewski
Copy link
Member

Thanks for the change. I understand wanting to be conservative about the literals for now.

@JesseStimpson
Copy link
Contributor Author

Thank you @josevalim and @greg-rychlewski !

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