This should be fixed per:
https://github.com/discourse/discourse/commit/015051ecafe24975268a4022c40f17978f54890e
This is a result of new code in Rails 6 that protects access to thread bound variable determining if you can use prepared statements or not.
At Discourse we do not use prepared statements at all, so this patch is not something we need.
See more at:
https://github.com/rails/rails/pull/36949#issuecomment-530698779