Hello community,

here is the log from the commit of package rubygem-activerecord-6.0 for 
openSUSE:Factory checked in at 2019-11-13 13:25:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-activerecord-6.0 (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-activerecord-6.0.new.2990 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-activerecord-6.0"

Wed Nov 13 13:25:19 2019 rev:2 rq:747688 version:6.0.1

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/rubygem-activerecord-6.0/rubygem-activerecord-6.0.changes
        2019-08-19 21:40:46.476297694 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-activerecord-6.0.new.2990/rubygem-activerecord-6.0.changes
      2019-11-13 13:25:22.267512929 +0100
@@ -1,0 +2,75 @@
+Tue Nov 12 13:32:40 UTC 2019 - Manuel Schnitzer <[email protected]>
+
+- updated to version 6.0.1
+
+  *    Common Table Expressions are allowed on read-only connections.
+
+       *Chris Morris*
+
+  *    New record instantiation respects `unscope`.
+
+       *Ryuta Kamizono*
+
+  *    Fixed a case where `find_in_batches` could halt too early.
+
+       *Takayuki Nakata*
+
+  *    Autosaved associations always perform validations when a custom 
validation
+       context is used.
+
+       *Tekin Suleyman*
+
+  *    `sql.active_record` notifications now include the `:connection` in
+       their payloads.
+
+       *Eugene Kenny*
+
+  *    A rollback encountered in an `after_commit` callback does not reset
+       previously-committed record state.
+
+       *Ryuta Kamizono*
+
+  *    Fixed that join order was lost when eager-loading.
+
+       *Ryuta Kamizono*
+
+  *   `DESCRIBE` queries are allowed on read-only connections.
+
+      *Dylan Thacker-Smith*
+
+  *   Fixed that records that had been `inspect`ed could not be marshaled.
+
+      *Eugene Kenny*
+
+  *   The connection pool reaper thread is respawned in forked processes. This
+      fixes that idle connections in forked processes wouldn't be reaped.
+
+      *John Hawthorn*
+
+  *   The memoized result of `ActiveRecord::Relation#take` is properly cleared
+      when `ActiveRecord::Relation#reset` or `ActiveRecord::Relation#reload`
+      is called.
+
+      *Anmol Arora*
+
+  *   Fixed the performance regression for `primary_keys` introduced MySQL 8.0.
+
+      *Hiroyuki Ishii*
+
+  *   `insert`, `insert_all`, `upsert`, and `upsert_all` now clear the query 
cache.
+
+      *Eugene Kenny*
+
+  *   Call `while_preventing_writes` directly from `connected_to`.
+
+      In some cases application authors want to use the database switching 
middleware and make explicit calls with `connected_to`. It's possible for an 
app to turn off writes and not turn them back on by the time we call 
`connected_to(role: :writing)`.
+
+      This change allows apps to fix this by assuming if a role is writing we 
want to allow writes, except in the case it's explicitly turned off.
+
+      *Eileen M. Uchitelle*
+
+  *   Improve detection of ActiveRecord::StatementTimeout with mysql2 adapter 
in the edge case when the query is terminated during filesort.
+
+      *Kir Shatrov*
+
+-------------------------------------------------------------------

Old:
----
  activerecord-6.0.0.gem

New:
----
  activerecord-6.0.1.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-activerecord-6.0.spec ++++++
--- /var/tmp/diff_new_pack.jt3MOS/_old  2019-11-13 13:25:22.799513482 +0100
+++ /var/tmp/diff_new_pack.jt3MOS/_new  2019-11-13 13:25:22.803513486 +0100
@@ -12,7 +12,7 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-activerecord-6.0
-Version:        6.0.0
+Version:        6.0.1
 Release:        0
 %define mod_name activerecord
 %define mod_full_name %{mod_name}-%{version}
@@ -36,10 +36,10 @@
 %endif
 # /MANUAL
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-BuildRequires:  ruby-macros >= 5
 BuildRequires:  %{ruby >= 2.5.0}
 BuildRequires:  %{rubygem gem2rpm}
 BuildRequires:  %{rubygem rdoc > 3.10}
+BuildRequires:  ruby-macros >= 5
 Url:            https://rubyonrails.org
 Source:         https://rubygems.org/gems/%{mod_full_name}.gem
 Source1:        gem2rpm.yml

++++++ activerecord-6.0.0.gem -> activerecord-6.0.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2019-08-16 19:58:52.000000000 +0200
+++ new/CHANGELOG.md    2019-11-05 15:37:41.000000000 +0100
@@ -1,3 +1,76 @@
+## Rails 6.0.1 (November 5, 2019) ##
+
+*    Common Table Expressions are allowed on read-only connections.
+
+     *Chris Morris*
+
+*    New record instantiation respects `unscope`.
+
+     *Ryuta Kamizono*
+
+*    Fixed a case where `find_in_batches` could halt too early.
+
+     *Takayuki Nakata*
+
+*    Autosaved associations always perform validations when a custom validation
+     context is used.
+
+     *Tekin Suleyman*
+
+*    `sql.active_record` notifications now include the `:connection` in
+     their payloads.
+
+     *Eugene Kenny*
+
+*    A rollback encountered in an `after_commit` callback does not reset
+     previously-committed record state.
+
+     *Ryuta Kamizono*
+
+*    Fixed that join order was lost when eager-loading.
+
+     *Ryuta Kamizono*
+
+*   `DESCRIBE` queries are allowed on read-only connections.
+
+    *Dylan Thacker-Smith*
+
+*   Fixed that records that had been `inspect`ed could not be marshaled.
+
+    *Eugene Kenny*
+
+*   The connection pool reaper thread is respawned in forked processes. This
+    fixes that idle connections in forked processes wouldn't be reaped.
+
+    *John Hawthorn*
+
+*   The memoized result of `ActiveRecord::Relation#take` is properly cleared
+    when `ActiveRecord::Relation#reset` or `ActiveRecord::Relation#reload`
+    is called.
+
+    *Anmol Arora*
+
+*   Fixed the performance regression for `primary_keys` introduced MySQL 8.0.
+
+    *Hiroyuki Ishii*
+
+*   `insert`, `insert_all`, `upsert`, and `upsert_all` now clear the query 
cache.
+
+    *Eugene Kenny*
+
+*   Call `while_preventing_writes` directly from `connected_to`.
+
+    In some cases application authors want to use the database switching 
middleware and make explicit calls with `connected_to`. It's possible for an 
app to turn off writes and not turn them back on by the time we call 
`connected_to(role: :writing)`.
+
+    This change allows apps to fix this by assuming if a role is writing we 
want to allow writes, except in the case it's explicitly turned off.
+
+    *Eileen M. Uchitelle*
+
+*   Improve detection of ActiveRecord::StatementTimeout with mysql2 adapter in 
the edge case when the query is terminated during filesort.
+
+    *Kir Shatrov*
+
+
 ## Rails 6.0.0 (August 16, 2019) ##
 
 *   Preserve user supplied joins order as much as possible.
@@ -478,7 +551,7 @@
 
     *Rafael Mendonça França*
 
-*   Deprecate `config.activerecord.sqlite3.represent_boolean_as_integer`.
+*   Deprecate `config.active_record.sqlite3.represent_boolean_as_integer`.
 
     *Rafael Mendonça França*
 
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/association_relation.rb 
new/lib/active_record/association_relation.rb
--- old/lib/active_record/association_relation.rb       2019-08-16 
19:58:52.000000000 +0200
+++ new/lib/active_record/association_relation.rb       2019-11-05 
15:37:41.000000000 +0100
@@ -15,17 +15,26 @@
       other == records
     end
 
-    def build(*args, &block)
-      scoping { @association.build(*args, &block) }
+    def build(attributes = nil, &block)
+      block = _deprecated_scope_block("new", &block)
+      @association.scoping(self) do
+        @association.build(attributes, &block)
+      end
     end
     alias new build
 
-    def create(*args, &block)
-      scoping { @association.create(*args, &block) }
+    def create(attributes = nil, &block)
+      block = _deprecated_scope_block("create", &block)
+      @association.scoping(self) do
+        @association.create(attributes, &block)
+      end
     end
 
-    def create!(*args, &block)
-      scoping { @association.create!(*args, &block) }
+    def create!(attributes = nil, &block)
+      block = _deprecated_scope_block("create!", &block)
+      @association.scoping(self) do
+        @association.create!(attributes, &block)
+      end
     end
 
     private
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/associations/association.rb 
new/lib/active_record/associations/association.rb
--- old/lib/active_record/associations/association.rb   2019-08-16 
19:58:52.000000000 +0200
+++ new/lib/active_record/associations/association.rb   2019-11-05 
15:37:41.000000000 +0100
@@ -43,6 +43,7 @@
         reflection.check_validity!
 
         @owner, @reflection = owner, reflection
+        @_scope = nil
 
         reset
         reset_scope
@@ -95,7 +96,7 @@
       end
 
       def scope
-        target_scope.merge!(association_scope)
+        @_scope&.spawn || target_scope.merge!(association_scope)
       end
 
       def reset_scope
@@ -195,6 +196,13 @@
         _create_record(attributes, true, &block)
       end
 
+      def scoping(relation, &block)
+        @_scope = relation
+        relation.scoping(&block)
+      ensure
+        @_scope = nil
+      end
+
       private
         def find_target
           scope = self.scope
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/associations/join_dependency/join_association.rb 
new/lib/active_record/associations/join_dependency/join_association.rb
--- old/lib/active_record/associations/join_dependency/join_association.rb      
2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/associations/join_dependency/join_association.rb      
2019-11-05 15:37:41.000000000 +0100
@@ -37,7 +37,7 @@
             nodes = arel.constraints.first
 
             others = nodes.children.extract! do |node|
-              Arel.fetch_attribute(node) { |attr| attr.relation.name != 
table.name }
+              !Arel.fetch_attribute(node) { |attr| attr.relation.name == 
table.name }
             end
 
             joins << table.create_join(table, table.create_on(nodes), 
join_type)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/associations/join_dependency.rb 
new/lib/active_record/associations/join_dependency.rb
--- old/lib/active_record/associations/join_dependency.rb       2019-08-16 
19:58:52.000000000 +0200
+++ new/lib/active_record/associations/join_dependency.rb       2019-11-05 
15:37:41.000000000 +0100
@@ -70,6 +70,10 @@
         @join_type = join_type
       end
 
+      def base_klass
+        join_root.base_klass
+      end
+
       def reflections
         join_root.drop(1).map!(&:reflection)
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/associations/preloader.rb 
new/lib/active_record/associations/preloader.rb
--- old/lib/active_record/associations/preloader.rb     2019-08-16 
19:58:52.000000000 +0200
+++ new/lib/active_record/associations/preloader.rb     2019-11-05 
15:37:41.000000000 +0100
@@ -112,7 +112,7 @@
           association.flat_map { |parent, child|
             grouped_records(parent, records, polymorphic_parent).flat_map do 
|reflection, reflection_records|
               loaders = preloaders_for_reflection(reflection, 
reflection_records, scope)
-              recs = loaders.flat_map(&:preloaded_records)
+              recs = loaders.flat_map(&:preloaded_records).uniq
               child_polymorphic_parent = reflection && 
reflection.options[:polymorphic]
               loaders.concat Array.wrap(child).flat_map { |assoc|
                 preloaders_on assoc, recs, scope, child_polymorphic_parent
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/associations.rb 
new/lib/active_record/associations.rb
--- old/lib/active_record/associations.rb       2019-08-16 19:58:52.000000000 
+0200
+++ new/lib/active_record/associations.rb       2019-11-05 15:37:41.000000000 
+0100
@@ -92,7 +92,7 @@
         through_reflection      = reflection.through_reflection
         source_reflection_names = reflection.source_reflection_names
         source_associations     = 
reflection.through_reflection.klass._reflections.keys
-        super("Could not find the source association(s) 
#{source_reflection_names.collect(&:inspect).to_sentence(two_words_connector: ' 
or ', last_word_connector: ', or ', locale: :en)} in model 
#{through_reflection.klass}. Try 'has_many #{reflection.name.inspect}, :through 
=> #{through_reflection.name.inspect}, :source => <name>'. Is it one of 
#{source_associations.to_sentence(two_words_connector: ' or ', 
last_word_connector: ', or ', locale: :en)}?")
+        super("Could not find the source association(s) 
#{source_reflection_names.collect(&:inspect).to_sentence(two_words_connector: ' 
or ', last_word_connector: ', or ')} in model #{through_reflection.klass}. Try 
'has_many #{reflection.name.inspect}, :through => 
#{through_reflection.name.inspect}, :source => <name>'. Is it one of 
#{source_associations.to_sentence(two_words_connector: ' or ', 
last_word_connector: ', or ')}?")
       else
         super("Could not find the source association(s).")
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/autosave_association.rb 
new/lib/active_record/autosave_association.rb
--- old/lib/active_record/autosave_association.rb       2019-08-16 
19:58:52.000000000 +0200
+++ new/lib/active_record/autosave_association.rb       2019-11-05 
15:37:41.000000000 +0100
@@ -272,7 +272,7 @@
       # or saved. If +autosave+ is +false+ only new records will be returned,
       # unless the parent is/was a new record itself.
       def associated_records_to_validate_or_save(association, new_record, 
autosave)
-        if new_record
+        if new_record || custom_validation_context?
           association && association.target
         elsif autosave
           association.target.find_all(&:changed_for_autosave?)
@@ -304,7 +304,7 @@
       def validate_single_association(reflection)
         association = association_instance_get(reflection.name)
         record      = association && association.reader
-        association_valid?(reflection, record) if record && 
record.changed_for_autosave?
+        association_valid?(reflection, record) if record && 
(record.changed_for_autosave? || custom_validation_context?)
       end
 
       # Validate the associated records if <tt>:validate</tt> or
@@ -324,7 +324,7 @@
       def association_valid?(reflection, record, index = nil)
         return true if record.destroyed? || (reflection.options[:autosave] && 
record.marked_for_destruction?)
 
-        context = validation_context unless [:create, 
:update].include?(validation_context)
+        context = validation_context if custom_validation_context?
 
         unless valid = record.valid?(context)
           if reflection.options[:autosave]
@@ -499,6 +499,10 @@
         end
       end
 
+      def custom_validation_context?
+        validation_context && [:create, :update].exclude?(validation_context)
+      end
+
       def _ensure_no_duplicate_errors
         errors.messages.each_key do |attribute|
           errors[attribute].uniq!
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/abstract/connection_pool.rb 
new/lib/active_record/connection_adapters/abstract/connection_pool.rb
--- old/lib/active_record/connection_adapters/abstract/connection_pool.rb       
2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/abstract/connection_pool.rb       
2019-11-05 15:37:41.000000000 +0100
@@ -317,14 +317,15 @@
 
         @mutex = Mutex.new
         @pools = {}
+        @threads = {}
 
         class << self
           def register_pool(pool, frequency) # :nodoc:
             @mutex.synchronize do
-              unless @pools.key?(frequency)
-                @pools[frequency] = []
-                spawn_thread(frequency)
+              unless @threads[frequency]&.alive?
+                @threads[frequency] = spawn_thread(frequency)
               end
+              @pools[frequency] ||= []
               @pools[frequency] << WeakRef.new(pool)
             end
           end
@@ -333,7 +334,8 @@
 
             def spawn_thread(frequency)
               Thread.new(frequency) do |t|
-                loop do
+                running = true
+                while running
                   sleep t
                   @mutex.synchronize do
                     @pools[frequency].select!(&:weakref_alive?)
@@ -342,6 +344,12 @@
                       p.flush
                     rescue WeakRef::RefError
                     end
+
+                    if @pools[frequency].empty?
+                      @pools.delete(frequency)
+                      @threads.delete(frequency)
+                      running = false
+                    end
                   end
                 end
               end
@@ -642,6 +650,7 @@
       # or a thread dies unexpectedly.
       def reap
         stale_connections = synchronize do
+          return unless @connections
           @connections.select do |conn|
             conn.in_use? && !conn.owner.alive?
           end.each do |conn|
@@ -666,6 +675,7 @@
         return if minimum_idle.nil?
 
         idle_connections = synchronize do
+          return unless @connections
           @connections.select do |conn|
             !conn.in_use? && conn.seconds_idle >= minimum_idle
           end.each do |conn|
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/abstract/database_statements.rb 
new/lib/active_record/connection_adapters/abstract/database_statements.rb
--- old/lib/active_record/connection_adapters/abstract/database_statements.rb   
2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/abstract/database_statements.rb   
2019-11-05 15:37:41.000000000 +0100
@@ -149,6 +149,10 @@
         exec_query(sql, name, binds)
       end
 
+      def exec_insert_all(sql, name) # :nodoc:
+        exec_query(sql, name)
+      end
+
       # Executes an INSERT query and returns the new record's ID
       #
       # +id_value+ will be returned unless the value is +nil+, in
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/abstract/query_cache.rb 
new/lib/active_record/connection_adapters/abstract/query_cache.rb
--- old/lib/active_record/connection_adapters/abstract/query_cache.rb   
2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/abstract/query_cache.rb   
2019-11-05 15:37:41.000000000 +0100
@@ -8,7 +8,7 @@
       class << self
         def included(base) #:nodoc:
           dirties_query_cache base, :insert, :update, :delete, :truncate, 
:truncate_tables,
-            :rollback_to_savepoint, :rollback_db_transaction
+            :rollback_to_savepoint, :rollback_db_transaction, :exec_insert_all
 
           base.set_callback :checkout, :after, :configure_query_cache!
           base.set_callback :checkin, :after, :disable_query_cache!
@@ -135,6 +135,7 @@
             type_casted_binds: -> { type_casted_binds(binds) },
             name: name,
             connection_id: object_id,
+            connection: self,
             cached: true
           }
         end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/abstract_adapter.rb 
new/lib/active_record/connection_adapters/abstract_adapter.rb
--- old/lib/active_record/connection_adapters/abstract_adapter.rb       
2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/abstract_adapter.rb       
2019-11-05 15:37:41.000000000 +0100
@@ -1,5 +1,6 @@
 # frozen_string_literal: true
 
+require "set"
 require "active_record/connection_adapters/determine_if_preparable_visitor"
 require "active_record/connection_adapters/schema_cache"
 require "active_record/connection_adapters/sql_type_metadata"
@@ -11,7 +12,6 @@
 require "arel/collectors/composite"
 require "arel/collectors/sql_string"
 require "arel/collectors/substitute_binds"
-require "concurrent/atomic/thread_local_var"
 
 module ActiveRecord
   module ConnectionAdapters # :nodoc:
@@ -130,10 +130,10 @@
         @lock = ActiveSupport::Concurrency::LoadInterlockAwareMonitor.new
 
         if 
self.class.type_cast_config_to_boolean(config.fetch(:prepared_statements) { 
true })
-          @prepared_statement_status = Concurrent::ThreadLocalVar.new(true)
+          @prepared_statements = true
           @visitor.extend(DetermineIfPreparableVisitor)
         else
-          @prepared_statement_status = Concurrent::ThreadLocalVar.new(false)
+          @prepared_statements = false
         end
 
         @advisory_locks_enabled = self.class.type_cast_config_to_boolean(
@@ -177,7 +177,11 @@
       end
 
       def prepared_statements
-        @prepared_statement_status.value
+        @prepared_statements && 
!prepared_statements_disabled_cache.include?(object_id)
+      end
+
+      def prepared_statements_disabled_cache # :nodoc:
+        Thread.current[:ar_prepared_statements_disabled_cache] ||= Set.new
       end
 
       class Version
@@ -264,7 +268,10 @@
       end
 
       def unprepared_statement
-        @prepared_statement_status.bind(false) { yield }
+        cache = prepared_statements_disabled_cache.add(object_id) if 
@prepared_statements
+        yield
+      ensure
+        cache&.delete(object_id)
       end
 
       # Returns the human-readable name of the adapter. Use mixed case - one
@@ -409,6 +416,10 @@
         false
       end
 
+      def supports_common_table_expressions?
+        false
+      end
+
       def supports_lazy_transactions?
         false
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/abstract_mysql_adapter.rb 
new/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
--- old/lib/active_record/connection_adapters/abstract_mysql_adapter.rb 
2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/abstract_mysql_adapter.rb 
2019-11-05 15:37:41.000000000 +0100
@@ -110,6 +110,14 @@
         !mariadb? && database_version >= "5.7.7"
       end
 
+      def supports_common_table_expressions?
+        if mariadb?
+          database_version >= "10.2.1"
+        else
+          database_version >= "8.0.1"
+        end
+      end
+
       def supports_advisory_locks?
         true
       end
@@ -440,11 +448,11 @@
 
         query_values(<<~SQL, "SCHEMA")
           SELECT column_name
-          FROM information_schema.key_column_usage
-          WHERE constraint_name = 'PRIMARY'
+          FROM information_schema.statistics
+          WHERE index_name = 'PRIMARY'
             AND table_schema = #{scope[:schema]}
             AND table_name = #{scope[:name]}
-          ORDER BY ordinal_position
+          ORDER BY seq_in_index
         SQL
       end
 
@@ -581,6 +589,7 @@
         end
 
         # See 
https://dev.mysql.com/doc/refman/5.7/en/error-messages-server.html
+        ER_FILSORT_ABORT        = 1028
         ER_DUP_ENTRY            = 1062
         ER_NOT_NULL_VIOLATION   = 1048
         ER_NO_REFERENCED_ROW    = 1216
@@ -622,7 +631,7 @@
             Deadlocked.new(message, sql: sql, binds: binds)
           when ER_LOCK_WAIT_TIMEOUT
             LockWaitTimeout.new(message, sql: sql, binds: binds)
-          when ER_QUERY_TIMEOUT
+          when ER_QUERY_TIMEOUT, ER_FILSORT_ABORT
             StatementTimeout.new(message, sql: sql, binds: binds)
           when ER_QUERY_INTERRUPTED
             QueryCanceled.new(message, sql: sql, binds: binds)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/connection_specification.rb 
new/lib/active_record/connection_adapters/connection_specification.rb
--- old/lib/active_record/connection_adapters/connection_specification.rb       
2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/connection_specification.rb       
2019-11-05 15:37:41.000000000 +0100
@@ -186,7 +186,7 @@
           adapter_method = "#{spec[:adapter]}_connection"
 
           unless ActiveRecord::Base.respond_to?(adapter_method)
-            raise AdapterNotFound, "database configuration specifies 
nonexistent #{spec.config[:adapter]} adapter"
+            raise AdapterNotFound, "database configuration specifies 
nonexistent #{spec[:adapter]} adapter"
           end
 
           ConnectionSpecification.new(spec.delete(:name) || "primary", spec, 
adapter_method)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/mysql/database_statements.rb 
new/lib/active_record/connection_adapters/mysql/database_statements.rb
--- old/lib/active_record/connection_adapters/mysql/database_statements.rb      
2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/mysql/database_statements.rb      
2019-11-05 15:37:41.000000000 +0100
@@ -19,7 +19,9 @@
           execute(sql, name).to_a
         end
 
-        READ_QUERY = 
ActiveRecord::ConnectionAdapters::AbstractAdapter.build_read_query_regexp(:begin,
 :commit, :explain, :select, :set, :show, :release, :savepoint, :rollback) # 
:nodoc:
+        READ_QUERY = 
ActiveRecord::ConnectionAdapters::AbstractAdapter.build_read_query_regexp(
+          :begin, :commit, :explain, :select, :set, :show, :release, 
:savepoint, :rollback, :describe, :desc, :with
+        ) # :nodoc:
         private_constant :READ_QUERY
 
         def write_query?(sql) # :nodoc:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/postgresql/database_statements.rb 
new/lib/active_record/connection_adapters/postgresql/database_statements.rb
--- old/lib/active_record/connection_adapters/postgresql/database_statements.rb 
2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/postgresql/database_statements.rb 
2019-11-05 15:37:41.000000000 +0100
@@ -67,7 +67,9 @@
           end
         end
 
-        READ_QUERY = 
ActiveRecord::ConnectionAdapters::AbstractAdapter.build_read_query_regexp(:begin,
 :commit, :explain, :select, :set, :show, :release, :savepoint, :rollback) # 
:nodoc:
+        READ_QUERY = 
ActiveRecord::ConnectionAdapters::AbstractAdapter.build_read_query_regexp(
+          :begin, :commit, :explain, :select, :set, :show, :release, 
:savepoint, :rollback, :with
+        ) # :nodoc:
         private_constant :READ_QUERY
 
         def write_query?(sql) # :nodoc:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/postgresql_adapter.rb 
new/lib/active_record/connection_adapters/postgresql_adapter.rb
--- old/lib/active_record/connection_adapters/postgresql_adapter.rb     
2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/postgresql_adapter.rb     
2019-11-05 15:37:41.000000000 +0100
@@ -361,6 +361,10 @@
         @has_pg_hint_plan
       end
 
+      def supports_common_table_expressions?
+        true
+      end
+
       def supports_lazy_transactions?
         true
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/sqlite3/database_statements.rb 
new/lib/active_record/connection_adapters/sqlite3/database_statements.rb
--- old/lib/active_record/connection_adapters/sqlite3/database_statements.rb    
2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/sqlite3/database_statements.rb    
2019-11-05 15:37:41.000000000 +0100
@@ -4,7 +4,9 @@
   module ConnectionAdapters
     module SQLite3
       module DatabaseStatements
-        READ_QUERY = 
ActiveRecord::ConnectionAdapters::AbstractAdapter.build_read_query_regexp(:begin,
 :commit, :explain, :select, :pragma, :release, :savepoint, :rollback) # :nodoc:
+        READ_QUERY = 
ActiveRecord::ConnectionAdapters::AbstractAdapter.build_read_query_regexp(
+          :begin, :commit, :explain, :select, :pragma, :release, :savepoint, 
:rollback, :with
+        ) # :nodoc:
         private_constant :READ_QUERY
 
         def write_query?(sql) # :nodoc:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/sqlite3_adapter.rb 
new/lib/active_record/connection_adapters/sqlite3_adapter.rb
--- old/lib/active_record/connection_adapters/sqlite3_adapter.rb        
2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/sqlite3_adapter.rb        
2019-11-05 15:37:41.000000000 +0100
@@ -144,6 +144,10 @@
         true
       end
 
+      def supports_common_table_expressions?
+        database_version >= "3.8.3"
+      end
+
       def supports_insert_on_conflict?
         database_version >= "3.24.0"
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/connection_handling.rb 
new/lib/active_record/connection_handling.rb
--- old/lib/active_record/connection_handling.rb        2019-08-16 
19:58:52.000000000 +0200
+++ new/lib/active_record/connection_handling.rb        2019-11-05 
15:37:41.000000000 +0100
@@ -113,8 +113,9 @@
     #     Dog.run_a_long_query
     #   end
     #
-    # When using the database key a new connection will be established every 
time.
-    def connected_to(database: nil, role: nil, &blk)
+    # When using the database key a new connection will be established every 
time. It is not
+    # recommended to use this outside of one-off scripts.
+    def connected_to(database: nil, role: nil, prevent_writes: false, &blk)
       if database && role
         raise ArgumentError, "connected_to can only accept a `database` or a 
`role` argument, but not both arguments."
       elsif database
@@ -130,7 +131,13 @@
 
         with_handler(role, &blk)
       elsif role
-        with_handler(role.to_sym, &blk)
+        if role == writing_role
+          with_handler(role.to_sym) do
+            connection_handler.while_preventing_writes(prevent_writes, &blk)
+          end
+        else
+          with_handler(role.to_sym, &blk)
+        end
       else
         raise ArgumentError, "must provide a `database` or a `role`."
       end
@@ -204,7 +211,7 @@
     # Return the specification name from the current class or its parent.
     def connection_specification_name
       if !defined?(@connection_specification_name) || 
@connection_specification_name.nil?
-        return primary_class? ? "primary" : 
superclass.connection_specification_name
+        return self == Base ? "primary" : 
superclass.connection_specification_name
       end
       @connection_specification_name
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/core.rb 
new/lib/active_record/core.rb
--- old/lib/active_record/core.rb       2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/core.rb       2019-11-05 15:37:41.000000000 +0100
@@ -586,12 +586,16 @@
         self.class.instance_method(:inspect).owner != 
ActiveRecord::Base.instance_method(:inspect).owner
       end
 
+      class InspectionMask < DelegateClass(::String)
+        def pretty_print(pp)
+          pp.text __getobj__
+        end
+      end
+      private_constant :InspectionMask
+
       def inspection_filter
         @inspection_filter ||= begin
-          mask = 
DelegateClass(::String).new(ActiveSupport::ParameterFilter::FILTERED)
-          def mask.pretty_print(pp)
-            pp.text __getobj__
-          end
+          mask = InspectionMask.new(ActiveSupport::ParameterFilter::FILTERED)
           ActiveSupport::ParameterFilter.new(self.class.filter_attributes, 
mask: mask)
         end
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/gem_version.rb 
new/lib/active_record/gem_version.rb
--- old/lib/active_record/gem_version.rb        2019-08-16 19:58:52.000000000 
+0200
+++ new/lib/active_record/gem_version.rb        2019-11-05 15:37:41.000000000 
+0100
@@ -9,7 +9,7 @@
   module VERSION
     MAJOR = 6
     MINOR = 0
-    TINY  = 0
+    TINY  = 1
     PRE   = nil
 
     STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/insert_all.rb 
new/lib/active_record/insert_all.rb
--- old/lib/active_record/insert_all.rb 2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/insert_all.rb 2019-11-05 15:37:41.000000000 +0100
@@ -24,7 +24,7 @@
       message = +"#{model} "
       message << "Bulk " if inserts.many?
       message << (on_duplicate == :update ? "Upsert" : "Insert")
-      connection.exec_query to_sql, message
+      connection.exec_insert_all to_sql, message
     end
 
     def updatable_columns
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/middleware/database_selector/resolver.rb 
new/lib/active_record/middleware/database_selector/resolver.rb
--- old/lib/active_record/middleware/database_selector/resolver.rb      
2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/middleware/database_selector/resolver.rb      
2019-11-05 15:37:41.000000000 +0100
@@ -46,11 +46,9 @@
         private
 
           def read_from_primary(&blk)
-            ActiveRecord::Base.connected_to(role: 
ActiveRecord::Base.writing_role) do
-              
ActiveRecord::Base.connection_handler.while_preventing_writes(true) do
-                
instrumenter.instrument("database_selector.active_record.read_from_primary") do
-                  yield
-                end
+            ActiveRecord::Base.connected_to(role: 
ActiveRecord::Base.writing_role, prevent_writes: true) do
+              
instrumenter.instrument("database_selector.active_record.read_from_primary") do
+                yield
               end
             end
           end
@@ -64,13 +62,11 @@
           end
 
           def write_to_primary(&blk)
-            ActiveRecord::Base.connected_to(role: 
ActiveRecord::Base.writing_role) do
-              
ActiveRecord::Base.connection_handler.while_preventing_writes(false) do
-                
instrumenter.instrument("database_selector.active_record.wrote_to_primary") do
-                  yield
-                ensure
-                  context.update_last_write_timestamp
-                end
+            ActiveRecord::Base.connected_to(role: 
ActiveRecord::Base.writing_role, prevent_writes: false) do
+              
instrumenter.instrument("database_selector.active_record.wrote_to_primary") do
+                yield
+              ensure
+                context.update_last_write_timestamp
               end
             end
           end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/model_schema.rb 
new/lib/active_record/model_schema.rb
--- old/lib/active_record/model_schema.rb       2019-08-16 19:58:52.000000000 
+0200
+++ new/lib/active_record/model_schema.rb       2019-11-05 15:37:41.000000000 
+0100
@@ -480,6 +480,9 @@
             load_schema!
 
             @schema_loaded = true
+          rescue
+            reload_schema_from_cache # If the schema loading failed half way 
through, we must reset the state.
+            raise
           end
         end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/relation/finder_methods.rb 
new/lib/active_record/relation/finder_methods.rb
--- old/lib/active_record/relation/finder_methods.rb    2019-08-16 
19:58:52.000000000 +0200
+++ new/lib/active_record/relation/finder_methods.rb    2019-11-05 
15:37:41.000000000 +0100
@@ -376,7 +376,16 @@
         )
         relation = except(:includes, :eager_load, 
:preload).joins!(join_dependency)
 
-        if eager_loading && 
!using_limitable_reflections?(join_dependency.reflections)
+        if eager_loading && !(
+            using_limitable_reflections?(join_dependency.reflections) &&
+            using_limitable_reflections?(
+              construct_join_dependency(
+                select_association_list(joins_values).concat(
+                  select_association_list(left_outer_joins_values)
+                ), nil
+              ).reflections
+            )
+        )
           if has_limit_or_offset?
             limited_ids = limited_ids_for(relation)
             limited_ids.empty? ? relation.none! : relation.where!(primary_key 
=> limited_ids)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/relation/query_methods.rb 
new/lib/active_record/relation/query_methods.rb
--- old/lib/active_record/relation/query_methods.rb     2019-08-16 
19:58:52.000000000 +0200
+++ new/lib/active_record/relation/query_methods.rb     2019-11-05 
15:37:41.000000000 +0100
@@ -1083,15 +1083,23 @@
         end
       end
 
-      def valid_association_list(associations)
+      def select_association_list(associations)
+        result = []
         associations.each do |association|
           case association
           when Hash, Symbol, Array
-            # valid
+            result << association
           else
-            raise ArgumentError, "only Hash, Symbol and Array are allowed"
+            yield if block_given?
           end
         end
+        result
+      end
+
+      def valid_association_list(associations)
+        select_association_list(associations) do
+          raise ArgumentError, "only Hash, Symbol and Array are allowed"
+        end
       end
 
       def build_left_outer_joins(manager, outer_joins, aliases)
@@ -1108,6 +1116,10 @@
           buckets[:stashed_join] << construct_join_dependency(left_joins, 
Arel::Nodes::OuterJoin)
         end
 
+        if joins.last.is_a?(ActiveRecord::Associations::JoinDependency)
+          buckets[:stashed_join] << joins.pop if joins.last.base_klass == klass
+        end
+
         joins.map! do |join|
           if join.is_a?(String)
             table.create_string_join(Arel.sql(join.strip)) unless join.blank?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/relation.rb 
new/lib/active_record/relation.rb
--- old/lib/active_record/relation.rb   2019-08-16 19:58:52.000000000 +0200
+++ new/lib/active_record/relation.rb   2019-11-05 15:37:41.000000000 +0100
@@ -629,6 +629,7 @@
       @to_sql = @arel = @loaded = @should_eager_load = nil
       @records = [].freeze
       @offsets = {}
+      @take = nil
       self
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/transactions.rb 
new/lib/active_record/transactions.rb
--- old/lib/active_record/transactions.rb       2019-08-16 19:58:52.000000000 
+0200
+++ new/lib/active_record/transactions.rb       2019-11-05 15:37:41.000000000 
+0100
@@ -333,6 +333,7 @@
     # Ensure that it is not called if the object was never persisted (failed 
create),
     # but call it after the commit of a destroyed object.
     def committed!(should_run_callbacks: true) #:nodoc:
+      force_clear_transaction_record_state
       if should_run_callbacks
         @_committed_already_called = true
         _run_commit_without_transaction_enrollment_callbacks
@@ -340,7 +341,6 @@
       end
     ensure
       @_committed_already_called = false
-      force_clear_transaction_record_state
     end
 
     # Call the #after_rollback callbacks. The +force_restore_state+ argument 
indicates if the record
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel.rb new/lib/arel.rb
--- old/lib/arel.rb     2019-08-16 19:58:52.000000000 +0200
+++ new/lib/arel.rb     2019-11-05 15:37:41.000000000 +0100
@@ -24,22 +24,29 @@
 require "arel/delete_manager"
 require "arel/nodes"
 
-module Arel # :nodoc: all
+module Arel
   VERSION = "10.0.0"
 
+  # Wrap a known-safe SQL string for passing to query methods, e.g.
+  #
+  #   Post.order(Arel.sql("length(title)")).last
+  #
+  # Great caution should be taken to avoid SQL injection vulnerabilities.
+  # This method should not be used with unsafe values such as request
+  # parameters or model attributes.
   def self.sql(raw_sql)
     Arel::Nodes::SqlLiteral.new raw_sql
   end
 
-  def self.star
+  def self.star # :nodoc:
     sql "*"
   end
 
-  def self.arel_node?(value)
+  def self.arel_node?(value) # :nodoc:
     value.is_a?(Arel::Node) || value.is_a?(Arel::Attribute) || 
value.is_a?(Arel::Nodes::SqlLiteral)
   end
 
-  def self.fetch_attribute(value)
+  def self.fetch_attribute(value) # :nodoc:
     case value
     when Arel::Nodes::Between, Arel::Nodes::In, Arel::Nodes::NotIn, 
Arel::Nodes::Equality, Arel::Nodes::NotEqual, Arel::Nodes::LessThan, 
Arel::Nodes::LessThanOrEqual, Arel::Nodes::GreaterThan, 
Arel::Nodes::GreaterThanOrEqual
       yield value.left.is_a?(Arel::Attributes::Attribute) ? value.left : 
value.right
@@ -47,5 +54,5 @@
   end
 
   ## Convenience Alias
-  Node = Arel::Nodes::Node
+  Node = Arel::Nodes::Node # :nodoc:
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2019-08-16 19:58:52.000000000 +0200
+++ new/metadata        2019-11-05 15:37:41.000000000 +0100
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: activerecord
 version: !ruby/object:Gem::Version
-  version: 6.0.0
+  version: 6.0.1
 platform: ruby
 authors:
 - David Heinemeier Hansson
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2019-08-16 00:00:00.000000000 Z
+date: 2019-11-05 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: activesupport
@@ -16,28 +16,28 @@
     requirements:
     - - '='
       - !ruby/object:Gem::Version
-        version: 6.0.0
+        version: 6.0.1
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - '='
       - !ruby/object:Gem::Version
-        version: 6.0.0
+        version: 6.0.1
 - !ruby/object:Gem::Dependency
   name: activemodel
   requirement: !ruby/object:Gem::Requirement
     requirements:
     - - '='
       - !ruby/object:Gem::Version
-        version: 6.0.0
+        version: 6.0.1
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - '='
       - !ruby/object:Gem::Version
-        version: 6.0.0
+        version: 6.0.1
 description: Databases on Rails. Build a persistent domain model by mapping 
database
   tables to Ruby classes. Strong conventions for associations, validations, 
aggregations,
   migrations, and testing come baked-in.
@@ -389,8 +389,11 @@
 licenses:
 - MIT
 metadata:
-  source_code_uri: https://github.com/rails/rails/tree/v6.0.0/activerecord
-  changelog_uri: 
https://github.com/rails/rails/blob/v6.0.0/activerecord/CHANGELOG.md
+  bug_tracker_uri: https://github.com/rails/rails/issues
+  changelog_uri: 
https://github.com/rails/rails/blob/v6.0.1/activerecord/CHANGELOG.md
+  documentation_uri: https://api.rubyonrails.org/v6.0.1/
+  mailing_list_uri: https://groups.google.com/forum/#!forum/rubyonrails-talk
+  source_code_uri: https://github.com/rails/rails/tree/v6.0.1/activerecord
 post_install_message: 
 rdoc_options:
 - "--main"
@@ -408,7 +411,7 @@
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
-rubygems_version: 3.0.1
+rubygems_version: 3.0.3
 signing_key: 
 specification_version: 4
 summary: Object-relational mapper framework (part of Rails).


Reply via email to