aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorMartin Schuster <schuster@schul-logistik.de>2019-06-04 15:47:21 +0200
committerMartin Schuster <schuster@schul-logistik.de>2019-06-04 15:47:21 +0200
commit86d3f251c802575fa1414a10f2981566002c19d4 (patch)
treecb1b288f76e81e2cb983eb14d66c6049cd57b3d6 /activerecord/lib/active_record
parent0244a10b7f05105bc4e476c2f28e4febb769307c (diff)
downloadrails-86d3f251c802575fa1414a10f2981566002c19d4.tar.gz
rails-86d3f251c802575fa1414a10f2981566002c19d4.tar.bz2
rails-86d3f251c802575fa1414a10f2981566002c19d4.zip
Fix sqlite3 collation parsing when using decimal columns.
If an sqlite3 table contains a decimal column behind columns with a collation definition, then parsing the collation of all preceeding columns will fail -- the collation will be missed without notice.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
index 7f3f32162e..9fc5ee3ab4 100644
--- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
@@ -477,9 +477,9 @@ module ActiveRecord
result = exec_query(sql, "SCHEMA").first
if result
- # Splitting with left parentheses and picking up last will return all
+ # Splitting with left parentheses and discarding the first part will return all
# columns separated with comma(,).
- columns_string = result["sql"].split("(").last
+ columns_string = result["sql"].split("(", 2).last
columns_string.split(",").each do |column_string|
# This regex will match the column name and collation type and will save