diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-06-10 06:21:23 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-06-10 06:21:23 +0900 |
commit | 6607ecb2a1ccc9b43cfb8db2d06dc5301a5320ba (patch) | |
tree | c44a96d57dd48f62b994a239cc815903a4a5ff8a /activerecord/lib/active_record/connection_adapters | |
parent | 1340498d2102423665cc5cfe7be7cdba32c72928 (diff) | |
download | rails-6607ecb2a1ccc9b43cfb8db2d06dc5301a5320ba.tar.gz rails-6607ecb2a1ccc9b43cfb8db2d06dc5301a5320ba.tar.bz2 rails-6607ecb2a1ccc9b43cfb8db2d06dc5301a5320ba.zip |
Allow `column_name AS alias` as safe SQL string
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
4 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb index a1b91c22de..e34f4f745f 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb @@ -159,6 +159,7 @@ module ActiveRecord \A ( (?:\w+\.)?\w+ + (?:(?:\s+AS)?\s+\w+)? ) (?:\s*,\s*\g<1>)* \z diff --git a/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb b/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb index 740832d6b8..a0829b1115 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb @@ -44,6 +44,7 @@ module ActiveRecord \A ( (?:\w+\.|`\w+`\.)?(?:\w+|`\w+`) + (?:(?:\s+AS)?\s+(?:\w+|`\w+`))? ) (?:\s*,\s*\g<1>)* \z diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb index 095429dd89..d18c5c5c12 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb @@ -90,6 +90,7 @@ module ActiveRecord \A ( (?:\w+\.|"\w+"\.)?(?:\w+|"\w+")(?:::\w+)? + (?:(?:\s+AS)?\s+(?:\w+|"\w+"))? ) (?:\s*,\s*\g<1>)* \z diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb index 88a16599f7..5d6932e4ca 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb @@ -57,6 +57,7 @@ module ActiveRecord \A ( (?:\w+\.|"\w+"\.)?(?:\w+|"\w+") + (?:(?:\s+AS)?\s+(?:\w+|"\w+"))? ) (?:\s*,\s*\g<1>)* \z |