I have a query looking up postgres -tables inside a thread in jruby.
Although there is no difference two me, active record does not terminate with some of the queries in concern of some tables, although it does terminate with some other tables.
I checked if it depends on indezes of these tables, or their structure, but it does not, or I couldn't find it, restricted to all the structure I could differentiate.
So I coded the same algorithm using raw-sql and it worked.
Hence there must be a bug with gem 'activerecord-jdbcpostgresql-adapter', '>= 61.0-java'.
I use 'rails', '~> 6.1.0' and jruby-9.2.14.0.
It worked as follows:
Thread.new { query = <<~SQL [...] SQL ActiveRecord::Base.connection.execute(query) }
It only works with some tables, but not with all:
Thread.new { Table.where(p1: s1) }
Sadly I cannot give you a hint how to reproduce it so far, as I don't catch the difference of the tables. Ask me, if you have any background-inspired guess.