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

Fix join table column quoting with SQLite. #34626

Merged
merged 1 commit into from Dec 5, 2018

Conversation

gmcgibbon
Copy link
Member

Summary

Fixes #34622.

Quotes joined columns properly in SQLite.

@@ -13,7 +13,7 @@ def quote_table_name_for_assignment(table, attr)
end

def quote_column_name(name)
@quoted_column_names[name] ||= %Q("#{super.gsub('"', '""')}")
@quoted_column_names[name] ||= %Q("#{super.gsub('"', '""').gsub('.', '"."')}")
Copy link
Member

Choose a reason for hiding this comment

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

For consistency, how about moving the new gsub to quote_table_name?

elsif Symbol === field
connection.quote_table_name(field.to_s)

def quote_table_name(name)
@quoted_table_names[name] ||= super.gsub(".", "`.`").freeze
end

Copy link
Member Author

Choose a reason for hiding this comment

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

Done! Good catch

@kamipo kamipo merged commit b802e08 into rails:master Dec 5, 2018
kamipo added a commit that referenced this pull request Dec 5, 2018
Fix join table column quoting with SQLite.
@gmcgibbon gmcgibbon deleted the sqlite_pluck_quoting branch December 12, 2018 20:57
kamipo added a commit that referenced this pull request Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants