-
Notifications
You must be signed in to change notification settings - Fork 3
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
Allow table aliases in JOIN queries #3
Comments
And you're sure this shouldn't be a regular |
It already is a regular SQL::Abstract feature if you enable the ExtraClauses plugin on version 2. See https://p3rl.org/SQL::Abstract::Plugin::ExtraClauses#join |
@kraih Yes, to a reasonable degree, because the processing of the array syntax of JOIN happens in SQL::Abstract::Pg. EDIT: I'm referring to whether aliasing should happen in ::Pg rather than SQLA, not where the array syntax itself should happen. |
It appears passing more stuff down to SQLA to get access to part of the SQLA2 handling effectively for free is a one-line change that I don't think will cause any regressions in SQLA1 using deployments.
is sufficient to make this work:
For Mojo::Pg I'd expect
should do the trick to enable it. Edit: I AM AN IDIOT. @akarelas just rightly point outed the HASH(...) thing in my example because $name is getting interpolated again later. |
It's not possible to create table aliases in generated SQL queries. This would be useful for generating queries where a table is JOINed to itself. Especially useful if someone wants to create an ORM based on Mojo::Pg.
A suggestion would be to allow the following syntax:
The text was updated successfully, but these errors were encountered: