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
Arel table alias breaks insert, update, and delete statements #48775
Comments
I locate the issue as being that rails/activerecord/lib/arel/visitors/to_sql.rb Lines 51 to 53 in 0ccde29
which ends up calling: rails/activerecord/lib/arel/visitors/to_sql.rb Lines 577 to 579 in 0ccde29
Perhaps |
Yes, the tests are currently testing the failure. Would you prefer a version of the tests that properly fail? |
Thanks for clarifying! Nope, I now have your tests failing with my fix :) |
…tom set a table alias. It then accounts for the SQL needed for this in the AST. It addresses rails#48775.
…tom set a table alias. It then accounts for the SQL needed for this in the AST. It addresses rails#48775.
Steps to reproduce
Expected behavior
The table alias is valid on SELECTs, but not on INSERT, UPDATE, or DELETE statements.
The example is with sqlite, but MySQL has similar rules where it specifically asks for a table name.
I would expect Arel to NOT use the alias on insert, update, and delete statements
System configuration
Rails version:
6.1.7.4
Ruby version:
3.2.2
MySQL:
MySQL 5.7, using the mysql2 0.5.5 gem
The text was updated successfully, but these errors were encountered: