diff options
author | Edouard CHIN <edouard.chin@shopify.com> | 2017-12-11 13:53:23 -0500 |
---|---|---|
committer | Edouard CHIN <edouard.chin@shopify.com> | 2017-12-11 17:25:54 -0500 |
commit | 2d78c66cd918b2cfde0308c0e4327943c30894f8 (patch) | |
tree | bfd162e29bfa3521fde6c20f8ffe88f3aaa24af8 /activerecord/test/.gitignore | |
parent | a80f81af055f02bf4625c90470aa90441cf6fc24 (diff) | |
download | rails-2d78c66cd918b2cfde0308c0e4327943c30894f8.tar.gz rails-2d78c66cd918b2cfde0308c0e4327943c30894f8.tar.bz2 rails-2d78c66cd918b2cfde0308c0e4327943c30894f8.zip |
Quote colum_names when building select:
- #30980 introcuded a change to not use `Arel.star` when model have ignored columns, a query used to look like `SELECT *. FROM developers` whereas now it would like `SELECT column1, column2 FROM developers`
- If a column has the same name has a reserved database specific keyword (such as key, where ...) then the query would fail because the names aren't quoted
- Quoting almost always happen unless we use a `from` clause in the query https://github.com/rails/rails/blob/9965b98dc0d58a86e10b4343bb6e15e01661a8c3/activerecord/lib/active_record/relation/query_methods.rb#L1052
- This PR cast all columns name to symbols in order for the quoting logic to be picked up https://github.com/rails/rails/blob/9965b98dc0d58a86e10b4343bb6e15e01661a8c3/activerecord/lib/active_record/relation/query_methods.rb#L1054-L1055
- A reproduction script can be found here https://gist.github.com/Edouard-chin/f56d464a0adcb76962afc1a9134a1536
Diffstat (limited to 'activerecord/test/.gitignore')
0 files changed, 0 insertions, 0 deletions