cockroachdb / activerecord-cockroachdb-adapter

CockroachDB adapter for ActiveRecord.
Apache License 2.0
103 stars 52 forks source link

The activerecord-cockroachdb-adapter v7.1.0 throws an error when `use_follower_reads_for_type_introspection` is set to `true` #320

Closed dheeraj-crl closed 6 months ago

dheeraj-crl commented 8 months ago

Your ruby gem activerecord-cockroachdb-adapter had a recent release to support rails 7.1. When using it, and the setting use_follower_reads_for_type_introspection = true, the error: "PG::FeatureNotSupported: ERROR: inconsistent AS OF SYSTEM TIME timestamp; expected: 1708547400.494068015,0, got: 1708547390.502956628,0 HINT: try SET TRANSACTION AS OF SYSTEM TIME" is raised from this line: https://github.com/cockroachdb/activerecord-cockroachdb-adapter/blob/9506aa79785e7e945ae86bc6579ce7330e38635e/lib/active_record/connection_adapters/cockroachdb_adapter.rb#L592

No application queries can execute, the error is triggered before they can run.

When setting use_follower_reads_for_type_introspection = false, there isn't any error.

More info: The error doesn't occur locally, it occurs using our qa cluster. And it appears the method that triggers it is create_or_find_by! I think the error doesn't occur locally because its not a multi-region db, and it has different table localities.

I confirmed the error behavior in another application of ours too.

Weird thing is, not all rails models trigger it when calling create_or_find_by!. My guess is that a unique index or foreign key might have something to do with which models trigger it? Hard to discern a pattern.

One other note: if the error doesn't occur first (isn't the first query run) it doesn't occur at all. Meaning, if I run some other query, then the offending create_or_find_by!, it doesn't throw an error.

Conversely, when the error does occur, all other subsequent queries will trigger an error. This error is different:

/home/code/vendor/bundle/ruby/3.2.0/gems/pg-1.5.5/lib/pg/result.rb:17:in `type_map=': wrong argument type nil (expected PG::TypeMap) (TypeError)

self.type_map = type_map
BuonOmo commented 8 months ago

@dheeraj-crl thanks for reporting, this seems quite important. It might be that one of the active-record tests we are ignoring is covering that (we don't have full active-record test suite coverage yet). If you could find a way to generate an example using the rails bug report template this would improve considerably the time to find the bug origin. Maybe if you can run a console in one of your failing QA clusters and isolate a specific part of your schema ?

I'll look into it soon as well!

grantpaulson6 commented 8 months ago

hey @BuonOmo this was discovered by me, cockroachdb support created the issue. I'll take a look at the link for the bug report template and see if I can expedite your ability to reproduce

grantpaulson6 commented 8 months ago

@BuonOmo do you know if there is a template with crdb setup already? Maybe I just branch off this repo?

grantpaulson6 commented 8 months ago

ah actually, this might be impossible to produce in a test environment. I think it might only occur when connected to a real cluster. Like you said, need to run in a console in the QA cluster, and can use that template as a guide

BuonOmo commented 8 months ago

I guess you found a way to adapt the template. Otherwise I'm always using the bin/console script as a basis for my tests, it may help you as well.

Those errors only in prod env are a pain... And without your context I might have a really hard time to reproduce! I'll see (hopefully next week) if I can get access to clusters for testing. Your help is still very appreciated though!

grantpaulson6 commented 8 months ago

Ok was able to reproduce with something similar to the template. Here is what I ran:

Rails.logger.level = 0
ActiveRecord::Base.establish_connection(:cockroachdb)
ActiveRecord::Schema.define do
  create_table :posts, force: true do |t|
    t.string :other_id
  end
end

class Post < CockroachDbApplicationRecord
end

Post.create_or_find_by!(other_id: '123')

this is what my CockraochDbApplicationRecord looks like:

class CockroachDbApplicationRecord < ActiveRecord::Base
  self.abstract_class = true
  self.implicit_order_column = :created_at

  connects_to database: { writing: :cockroachdb, reading: :cockroachdb }
end

and this is what my database.yml looks like (notable is use_follower_reads_for_type_introspection is true):

production:
  cockroachdb:
    adapter: cockroachdb
    username: ***
    password: ***
    host: ***
    port: ***
    encoding: utf8
    strict: true
    migrations_paths: db/cockroachdb_migrate
    sslrootcert: ***
    use_follower_reads_for_type_introspection: true
    schema_cache_path: db/cockroachdb_schema_cache.yml
    lifetime: 1800
    hijack:
      namer: AfCrdb::DbNamer
    database: ***

Table locality must not matter cuz its clearly the default from the script that creates the posts table

BuonOmo commented 8 months ago

Based on what you said I tried this script locally:

require "active_record"

ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.configurations = {
  "cockroachdb" => {
    adapter: "cockroachdb",
    host: "localhost",
    port: 26257,
    user: "root",
    database: "ar_crdb_console",
    use_follower_reads_for_type_introspection: true
  }
}
ActiveRecord::Base.establish_connection(:cockroachdb)

ActiveRecord::Schema.define do
  create_table :posts, force: true do |t|
    t.string :other_id
  end
end

class CockroachDbApplicationRecord < ActiveRecord::Base
  self.abstract_class = true
  self.implicit_order_column = :created_at

  connects_to database: { writing: :cockroachdb, reading: :cockroachdb }
end

class Post < CockroachDbApplicationRecord
end

Post.create_or_find_by!(other_id: '123')

It doesn't reproduce any error for me. Could you try it in your environment and if it works describe me your crdb setup?

Note that to run this script you must have active_record and this adapter in your Gemfile and run it with bundle exec

grantpaulson6 commented 8 months ago

You have to run it against an actual cluster, the error doesn't occur locally.

I also don't get an error when running your script locally, but do get it when running against a cluster

BuonOmo commented 8 months ago

You have to run it against an actual cluster, the error doesn't occur locally.

Could you inform me more about your cluster setting?

grantpaulson6 commented 7 months ago

plan_type: Dedicated standard cloud: aws capacity: 9 nodes, 4 vCPUs, 35 GiB disk regions: us-east-1, us-east-2, us-west-2 Version: v23.1.15

BuonOmo commented 7 months ago

Hi @grantpaulson6,

We've been working on the issue recently. Unfortunately, even in a cluster there is still no reproduction on my side. The cluster is fairly similar to yours, so the error is more likely to hide in configurations or machine state. FYI, here's our cluster configuration:

plan_type: Dedicated standard
cloud: aws
capacity: 9 nodes, 2 vCPUs, 15 GiB disk
regions: us-east-1, us-east-2, us-west-2
Version: v23.1.14

With that said, I've updated the script to generate the list of raw queries. Could you run the new script and paste the output of the sql-trace file (there should be no need of redacting anything, but I'd advise to check just in case)? We could compare that with the output I had and see if there is a difference at that level

Script with logging ```ruby require "active_record" require "active_record/connection_adapters/abstract_adapter" require "active_record/connection_adapters/postgresql_adapter" class ActiveRecord::ConnectionAdapters::CockroachDBAdapter < ActiveRecord::ConnectionAdapters::PostgreSQLAdapter def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil, async: false, &block) l = caller_locations(3,1).first File.open("sql-trace", "a") { |f| f.puts "------ #{name&.chomp || "anonymous query"} ------\n-- #{l}\n#{sql.chomp};\n\n" } super end end ActiveRecord::Base.logger = Logger.new(STDOUT) ActiveRecord::Base.logger.level = Logger::DEBUG ActiveRecord::Base.configurations = { "cockroachdb" => { adapter: "cockroachdb", host: ENV.fetch("COCKROACH_HOST", "localhost"), port: 26257, user: ENV.fetch("COCKROACH_USER", "root"), password: ENV["COCKROACH_PASSWORD"], database: ENV.fetch("COCKROACH_DATABASE", "ar_crdb_console"), encoding: "utf8", strict: true, use_follower_reads_for_type_introspection: true, sslrootcert: ENV["COCKROACH_SSL"] } } ActiveRecord::Base.establish_connection(:cockroachdb) ActiveRecord::Schema.define do create_table :posts, force: true do |t| t.string :other_id end end class CockroachDbApplicationRecord < ActiveRecord::Base self.abstract_class = true self.implicit_order_column = :created_at connects_to database: { writing: :cockroachdb, reading: :cockroachdb } end class Post < CockroachDbApplicationRecord end Post.create_or_find_by!(other_id: '123') ```

I'll also compare the output of that script with both the current adapter version (7.1) and 7.0 to see if we can spot an important change.

grantpaulson6 commented 7 months ago
the log output from your logging change that comes from the `create_or_find_by!` line ``` ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql/schema_statements.rb:245:in `client_min_messages=' SET client_min_messages TO 'warning'; ------ TRANSACTION ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:101:in `begin_db_transaction' BEGIN; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql_adapter.rb:410:in `set_standard_conforming_strings' SET standard_conforming_strings = on; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql_adapter.rb:1019:in `configure_connection' SET intervalstyle = iso_8601; ------ anonymous query ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/database_statements.rb:131:in `execute' USE "paymentsmerchant_grantmerchant"; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/af_crdb-1.11.0/lib/af_crdb/active_record_extensions/cockroach_db_adapter_extensions.rb:19:in `execute_and_clear' SELECT t.oid, t.typname FROM pg_type as t AS OF SYSTEM TIME '-10s' WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'numeric', 'bool', 'timestamp', 'timestamptz'); ------ TRANSACTION ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:116:in `exec_rollback_db_transaction' ROLLBACK; /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql_adapter.rb:894:in `exec_params': PG::FeatureNotSupported: ERROR: inconsistent AS OF SYSTEM TIME timestamp; expected: 1709073484.841855378,0, got: 1709073474.850723202,0 (ActiveRecord::StatementInvalid) HINT: try SET TRANSACTION AS OF SYSTEM TIME /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql_adapter.rb:894:in `exec_params': ERROR: inconsistent AS OF SYSTEM TIME timestamp; expected: 1709073484.841855378,0, got: 1709073474.850723202,0 (PG::FeatureNotSupported) HINT: try SET TRANSACTION AS OF SYSTEM TIME ```

the cockroach_db_adapter_extensions that is the line in question is a monkey patch that we use to set our target db name. it looks like this:

      def execute_and_clear(sql, *args, **opts)
        @hijacker&.hijack_connection

        super
      end

where line 19 is the super

Adding a couple more lines to the printout for that particular caller shows this ``` /home/code/vendor/bundle/ruby/3.2.0/gems/af_crdb-1.11.0/lib/af_crdb/active_record_extensions/cockroach_db_adapter_extensions.rb:19:in `execute_and_clear' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.1.0/lib/active_record/connection_adapters/cockroachdb_adapter.rb:592:in `add_pg_decoders' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql_adapter.rb:1033:in `configure_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/af_crdb-1.11.0/lib/af_crdb/active_record_extensions/cockroach_db_adapter_extensions.rb:49:in `configure_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:781:in `block in verify!' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/concurrency/null_lock.rb:9:in `synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:777:in `verify!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:795:in `connect!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:1001:in `block in with_raw_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/concurrency/null_lock.rb:9:in `synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:1000:in `with_raw_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql/quoting.rb:75:in `quote_string' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/quoting.rb:15:in `quote' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql/quoting.rb:69:in `quote' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.1.0/lib/active_record/connection_adapters/cockroachdb/quoting.rb:34:in `quote' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.1.0/lib/active_record/connection_adapters/cockroachdb_adapter.rb:439:in `column_definitions' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:109:in `columns' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:346:in `block in columns' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:345:in `fetch' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:345:in `columns' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:354:in `block in columns_hash' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:353:in `fetch' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:353:in `columns_hash' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:58:in `columns_hash' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:188:in `columns_hash' ```

Which shows that line 592 invoking the method add_pg_decoders is the originator of the SQL that triggers the error

grantpaulson6 commented 7 months ago

I was able to reproduce by running those raw SQL commands in the cockroachdb sql client connected to the cluster

grantpaulson6 commented 7 months ago
When I do the script on the older version of the adapter, the output looks like this ``` ------ anonymous query ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/af_runtime-25.10.0/lib/af_runtime/db/hijacker_base.rb:101:in `execute_use_database_sql' USE "ach_achgrant"; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/schema_statements.rb:243:in `client_min_messages=' SET client_min_messages TO 'warning'; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:373:in `set_standard_conforming_strings' SET standard_conforming_strings = on; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.0.3/lib/active_record/connection_adapters/cockroachdb_adapter.rb:404:in `configure_connection' SET TIME ZONE 'UTC'; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/af_crdb-1.10.0/lib/af_crdb/active_record_extensions/cockroach_db_adapter_extensions.rb:19:in `execute_and_clear' SELECT t.oid, t.typname FROM pg_type as t AS OF SYSTEM TIME '-10s' WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'numeric', 'bool', 'timestamp', 'timestamptz'); ------ anonymous query ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/af_runtime-25.10.0/lib/af_runtime/db/hijacker_base.rb:101:in `execute_use_database_sql' USE "ach_achgrant"; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/schema_statements.rb:243:in `client_min_messages=' SET client_min_messages TO 'warning'; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:373:in `set_standard_conforming_strings' SET standard_conforming_strings = on; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.0.3/lib/active_record/connection_adapters/cockroachdb_adapter.rb:404:in `configure_connection' SET TIME ZONE 'UTC'; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/af_crdb-1.10.0/lib/af_crdb/active_record_extensions/cockroach_db_adapter_extensions.rb:19:in `execute_and_clear' SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype FROM pg_type as t LEFT JOIN pg_range as r ON oid = rngtypid AS OF SYSTEM TIME '-10s' WHERE t.typname IN ('geography', 'geometry', 'geometry_collection', 'line_string', 'multi_line_string', 'multi_point', 'multi_polygon', 'st_point', 'st_polygon', 'int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'text', 'varchar', 'char', 'name', 'bpchar', 'bool', 'bit', 'varbit', 'date', 'money', 'bytea', 'point', 'hstore', 'json', 'jsonb', 'cidr', 'inet', 'uuid', 'xml', 'tsvector', 'macaddr', 'citext', 'ltree', 'line', 'lseg', 'box', 'path', 'polygon', 'circle', 'time', 'timestamp', 'timestamptz', 'numeric', 'interval') OR t.typtype IN ('r', 'e', 'd') OR (t.typarray = 0 AND t.typcategory='A') OR t.typelem != 0; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:296:in `initialize' SHOW TIME ZONE; ------ anonymous query ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.0.3/lib/active_record/connection_adapters/cockroachdb_adapter.rb:248:in `initialize' SHOW crdb_version; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.0.3/lib/active_record/connection_adapters/cockroachdb_adapter.rb:288:in `initialize' SET intervalstyle_enabled = true; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.0.3/lib/active_record/connection_adapters/cockroachdb_adapter.rb:289:in `initialize' SET intervalstyle = iso_8601; ------ TRANSACTION ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:106:in `begin_db_transaction' BEGIN; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:117:in `columns' SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod, c.collname, NULL AS comment, attgenerated as attgenerated, NULL as is_hidden FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum LEFT JOIN pg_type t ON a.atttypid = t.oid LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation WHERE a.attrelid = '"posts"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.0.3/lib/active_record/connection_adapters/cockroachdb_adapter.rb:516:in `column_definitions' SELECT c.column_name, c.column_comment, c.crdb_sql_type, c.is_hidden::BOOLEAN FROM information_schema.columns c WHERE c.table_name = 'posts'; ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:45:in `data_source_exists?' SELECT c.relname FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE n.nspname = ANY (current_schemas(false)) AND c.relname = 'posts' AND c.relkind IN ('r','v','m','p','f'); ------ SCHEMA ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/schema_statements.rb:357:in `primary_keys' SELECT a.attname FROM ( SELECT indrelid, indkey, generate_subscripts(indkey, 1) idx FROM pg_index WHERE indrelid = '"posts"'::regclass AND indisprimary ) i JOIN pg_attribute a ON a.attrelid = i.indrelid AND a.attnum = i.indkey[i.idx] ORDER BY i.idx; ------ TRANSACTION ------ -- /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:121:in `exec_rollback_db_transaction' ROLLBACK; /home/code/vendor/bundle/ruby/3.2.0/gems/activemodel-7.0.8/lib/active_model/attribute_methods.rb:450:in `method_missing': undefined method `lock_version' for # (NoMethodError) ```

The main difference I see is that in the new version the transaction is started before we do the pg_type queries

BuonOmo commented 7 months ago

@grantpaulson6 you're absolutely right, and it seems to be the culprit as well. You have a transaction in which there are both aost and non-aost queries. One great thing would be to have the full stacktrace for the begin call in the latest code version. BTW what is the precise commit of the adapter you're working with? (and commit of rails)

grantpaulson6 commented 7 months ago

activerecord-cockroachdb-adapter (7.1.0) rails (7.1.2)

Begin invocation caller stack trace for 7.1 ``` ------ TRANSACTION ------ -- BEGIN; /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:53:in `raw_execute' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/database_statements.rb:521:in `internal_execute' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:101:in `begin_db_transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/transaction.rb:373:in `materialize!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/transaction.rb:493:in `block (2 levels) in materialize_transactions' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/transaction.rb:493:in `each' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/transaction.rb:493:in `block in materialize_transactions' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/concurrency/null_lock.rb:9:in `synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/transaction.rb:490:in `materialize_transactions' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/database_statements.rb:352:in `materialize_transactions' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:1003:in `block in with_raw_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/concurrency/null_lock.rb:9:in `synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:1000:in `with_raw_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:54:in `block in raw_execute' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/notifications/instrumenter.rb:58:in `instrument' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:1143:in `log' (irb):17:in `log' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:53:in `raw_execute' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/database_statements.rb:521:in `internal_execute' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql/schema_statements.rb:245:in `client_min_messages=' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql_adapter.rb:1001:in `configure_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/af_crdb-1.11.0/lib/af_crdb/active_record_extensions/cockroach_db_adapter_extensions.rb:49:in `configure_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:781:in `block in verify!' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/concurrency/null_lock.rb:9:in `synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:777:in `verify!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:795:in `connect!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:1001:in `block in with_raw_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/concurrency/null_lock.rb:9:in `synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:1000:in `with_raw_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql/quoting.rb:75:in `quote_string' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/quoting.rb:15:in `quote' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql/quoting.rb:69:in `quote' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.1.0/lib/active_record/connection_adapters/cockroachdb/quoting.rb:34:in `quote' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.1.0/lib/active_record/connection_adapters/cockroachdb_adapter.rb:439:in `column_definitions' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:109:in `columns' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:346:in `block in columns' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:345:in `fetch' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:345:in `columns' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:354:in `block in columns_hash' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:353:in `fetch' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:353:in `columns_hash' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:58:in `columns_hash' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:188:in `columns_hash' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/model_schema.rb:618:in `load_schema!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/attributes.rb:264:in `load_schema!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/encryption/encryptable_record.rb:127:in `load_schema!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/model_schema.rb:563:in `block in load_schema' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/model_schema.rb:560:in `synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/model_schema.rb:560:in `load_schema' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/model_schema.rb:441:in `attribute_types' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/attribute_methods.rb:256:in `_has_attribute?' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/inheritance.rb:61:in `new' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/persistence.rb:54:in `create!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:903:in `_create!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:118:in `block in create!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:914:in `_scoping' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:452:in `scoping' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:118:in `create!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:229:in `block in create_or_find_by!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/transaction.rb:535:in `block in within_new_transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/concurrency/null_lock.rb:9:in `synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/transaction.rb:532:in `within_new_transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.1.0/lib/active_record/connection_adapters/cockroachdb/transaction_manager.rb:12:in `within_new_transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/database_statements.rb:344:in `transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/af_job-40.1.0/lib/af_job/models/queue_txn_hook.rb:9:in `transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/transactions.rb:212:in `transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation/delegation.rb:122:in `public_send' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation/delegation.rb:122:in `block in method_missing' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:914:in `_scoping' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:452:in `scoping' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation/delegation.rb:122:in `method_missing' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:229:in `create_or_find_by!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/querying.rb:23:in `create_or_find_by!' ```
Begin invocation caller stack trace for 7.0 ``` ------ TRANSACTION ------ -- BEGIN; /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `execute' /home/code/vendor/bundle/ruby/3.2.0/gems/af_crdb-1.10.0/lib/af_crdb/active_record_extensions/cockroach_db_adapter_extensions.rb:13:in `execute' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:106:in `begin_db_transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/transaction.rb:207:in `materialize!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/transaction.rb:285:in `block (2 levels) in materialize_transactions' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/transaction.rb:285:in `each' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/transaction.rb:285:in `block in materialize_transactions' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/transaction.rb:282:in `materialize_transactions' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/database_statements.rb:324:in `materialize_transactions' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:14:in `query' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.0.3/lib/active_record/connection_adapters/cockroachdb_adapter.rb:501:in `column_definitions' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:117:in `columns' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/schema_cache.rb:117:in `block in columns' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/schema_cache.rb:116:in `fetch' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/schema_cache.rb:116:in `columns' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/schema_cache.rb:125:in `block in columns_hash' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/schema_cache.rb:124:in `fetch' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/schema_cache.rb:124:in `columns_hash' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/model_schema.rb:580:in `load_schema!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/attributes.rb:264:in `load_schema!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/encryption/encryptable_record.rb:122:in `load_schema!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/model_schema.rb:566:in `block in load_schema' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/model_schema.rb:563:in `synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/model_schema.rb:563:in `load_schema' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/model_schema.rb:429:in `attribute_types' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/attribute_methods.rb:187:in `_has_attribute?' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/inheritance.rb:60:in `new' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/persistence.rb:54:in `create!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation.rb:870:in `_create!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation.rb:115:in `block in create!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation.rb:881:in `_scoping' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation.rb:428:in `scoping' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation.rb:115:in `create!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation.rb:219:in `block in create_or_find_by!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.0.3/lib/active_record/connection_adapters/cockroachdb/transaction_manager.rb:12:in `within_new_transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/af_job-39.7.2/lib/af_job/models/queue_txn_hook.rb:9:in `transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/transactions.rb:209:in `transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/delegation.rb:108:in `public_send' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/delegation.rb:108:in `block in method_missing' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation.rb:881:in `_scoping' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation.rb:428:in `scoping' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/delegation.rb:108:in `method_missing' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation.rb:219:in `create_or_find_by!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/querying.rb:22:in `create_or_find_by!' ```
First pg_type select query invocation caller stack trace for 7.1 ``` ------ SCHEMA ------ -- SELECT t.oid, t.typname FROM pg_type as t AS OF SYSTEM TIME '-10s' WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'numeric', 'bool', 'timestamp', 'timestamptz'); /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql_adapter.rb:892:in `exec_no_cache' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql_adapter.rb:872:in `execute_and_clear' /home/code/vendor/bundle/ruby/3.2.0/gems/af_crdb-1.11.0/lib/af_crdb/active_record_extensions/cockroach_db_adapter_extensions.rb:19:in `execute_and_clear' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.1.0/lib/active_record/connection_adapters/cockroachdb_adapter.rb:592:in `add_pg_decoders' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql_adapter.rb:1033:in `configure_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/af_crdb-1.11.0/lib/af_crdb/active_record_extensions/cockroach_db_adapter_extensions.rb:49:in `configure_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:781:in `block in verify!' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/concurrency/null_lock.rb:9:in `synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:777:in `verify!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:795:in `connect!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:1001:in `block in with_raw_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/concurrency/null_lock.rb:9:in `synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:1000:in `with_raw_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql/quoting.rb:75:in `quote_string' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/quoting.rb:15:in `quote' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/postgresql/quoting.rb:69:in `quote' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.1.0/lib/active_record/connection_adapters/cockroachdb/quoting.rb:34:in `quote' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.1.0/lib/active_record/connection_adapters/cockroachdb_adapter.rb:439:in `column_definitions' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:109:in `columns' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:346:in `block in columns' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:345:in `fetch' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:345:in `columns' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:354:in `block in columns_hash' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:353:in `fetch' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:353:in `columns_hash' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:58:in `columns_hash' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/schema_cache.rb:188:in `columns_hash' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/model_schema.rb:618:in `load_schema!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/attributes.rb:264:in `load_schema!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/encryption/encryptable_record.rb:127:in `load_schema!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/model_schema.rb:563:in `block in load_schema' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/model_schema.rb:560:in `synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/model_schema.rb:560:in `load_schema' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/model_schema.rb:441:in `attribute_types' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/attribute_methods.rb:256:in `_has_attribute?' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/inheritance.rb:61:in `new' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/persistence.rb:54:in `create!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:903:in `_create!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:118:in `block in create!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:914:in `_scoping' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:452:in `scoping' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:118:in `create!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:229:in `block in create_or_find_by!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/transaction.rb:535:in `block in within_new_transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/concurrency/null_lock.rb:9:in `synchronize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/transaction.rb:532:in `within_new_transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.1.0/lib/active_record/connection_adapters/cockroachdb/transaction_manager.rb:12:in `within_new_transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/database_statements.rb:344:in `transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/af_job-40.1.0/lib/af_job/models/queue_txn_hook.rb:9:in `transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/transactions.rb:212:in `transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation/delegation.rb:122:in `public_send' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation/delegation.rb:122:in `block in method_missing' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:914:in `_scoping' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:452:in `scoping' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation/delegation.rb:122:in `method_missing' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/relation.rb:229:in `create_or_find_by!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/querying.rb:23:in `create_or_find_by!' ```
First pg_type select query invocation caller stack trace for 7.0 ``` ------ SCHEMA ------ -- SELECT t.oid, t.typname FROM pg_type as t AS OF SYSTEM TIME '-10s' WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'numeric', 'bool', 'timestamp', 'timestamptz'); /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:766:in `exec_no_cache' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:745:in `execute_and_clear' /home/code/vendor/bundle/ruby/3.2.0/gems/af_crdb-1.10.0/lib/af_crdb/active_record_extensions/cockroach_db_adapter_extensions.rb:19:in `execute_and_clear' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.0.3/lib/active_record/connection_adapters/cockroachdb_adapter.rb:652:in `add_pg_decoders' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:292:in `initialize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.0.3/lib/active_record/connection_adapters/cockroachdb_adapter.rb:242:in `initialize' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.0.3/lib/active_record/connection_adapters/cockroachdb_adapter.rb:46:in `new' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-cockroachdb-adapter-7.0.3/lib/active_record/connection_adapters/cockroachdb_adapter.rb:46:in `cockroachdb_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:656:in `public_send' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:656:in `new_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:700:in `checkout_new_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:679:in `try_to_checkout_new_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:640:in `acquire_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:341:in `checkout' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:181:in `connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_handler.rb:211:in `retrieve_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_handling.rb:313:in `retrieve_connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_handling.rb:280:in `connection' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/transactions.rb:209:in `transaction' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/delegation.rb:108:in `public_send' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/delegation.rb:108:in `block in method_missing' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation.rb:881:in `_scoping' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation.rb:428:in `scoping' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/delegation.rb:108:in `method_missing' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation.rb:219:in `create_or_find_by!' /home/code/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/querying.rb:22:in `create_or_find_by!' ```

Note: some of the stack traces may differ because i've run these on different applications, instead of continually changing deployed code. But both app's have identically reproducible issues when on 7.1

What is the function of adding materialize_transactions: false here? maybe thats related

BuonOmo commented 7 months ago

There is still some af_crdb code in the stack trace. I'd be curious of what is in the #configure_connection method over there. (/home/code/vendor/bundle/ruby/3.2.0/gems/af_crdb-1.11.0/lib/af_crdb/active_record_extensions/cockroach_db_adapter_extensions.rb:49)

Also I think the culprit of creating the transaction is af_job (/home/code/vendor/bundle/ruby/3.2.0/gems/af_job-40.1.0/lib/af_job/models/queue_txn_hook.rb:9:in `transaction'). Which actually makes sense.

For your own database, I would advise doing the setup work beforehand. (usually before forking processes or threads). This should actually solve the issue here as it seems to be that the setup is done within a transaction, where it shouldn't be.

So you early guess was right:

Weird thing is, not all rails models trigger it when calling create_or_find_by!. My guess is that a unique index or foreign key might have something to do with which models trigger it? Hard to discern a pattern.

With all that said, even though I think refactoring this bit of your codebase would be for the best (better response time, more memory efficient). I'd still agree that it is a pain we have an error here.

Trying to work out a reproduction, but I still cannot have the same error as you, even if I try to run everything within a transaction, there is still no failure... I'm more and more thinking that there is one of your af_ extensions that is somehow generating a transaction, running a query that doesn't contain AOST, and calling the type loading (which does contain AOST and in turn causes an issue). Is there a way I could access to those files ? (maybe by email, buonomo dot ulysse at gmail dot com)

The materialize_transaction: false is what's in the original rails method. I try to stick to rails behaviour as much as possible. As to why it was changed in rails, it comes from this commit, and from my understanding, we use this to have the queries retryable (without having to retry a full transaction) in case of failure. Could you run a branch without these clauses to see if this is were the error come from maybe?

There are still some unattended questions:


In the mean time, I think a hotfix for you would be to overwrite the two methods that are using an aost query:

module AOSTHotfix
  %i(load_additional_types add_pg_decoders).each do |method_name|
    define_method(method_name) do |*args, **kwargs|
      if @config[:use_follower_reads_for_type_introspection] && transaction_open?
        execute("SET TRANSACTION AS OF SYSTEM TIME '-10s'")
        method(method_name).super_method.super_method.call(*args, **kwargs)
      else
        super
      end
    end
  end
end
ActiveRecord::ConnectionAdapters::CockroachDBAdapter.prepend AOSTHotfix

Unfortunately, as I still do not have a reproduction, I couldn't try this hotfix. But it should work !

BuonOmo commented 7 months ago

Sorry for the doubloon, I think the stacktraces you sent are not full, could it be ? (the root is always create_or_find_by! and I don't see the parent script. How did you generate those ?

grantpaulson6 commented 7 months ago

I'll get back to you soon, have had other stuff going on

grantpaulson6 commented 7 months ago

I'm also happy to zoom/pair on this if you're up for it

grantpaulson6 commented 7 months ago

I think the stacktraces you sent are not full, could it be ?

you're correct, I dropped a bit of the stack trace, it had stuff like kernel that didn't seem useful

I'd be curious of what is in the #configure_connection method

configure_connection in af_crdb is below. The line in the stack trace is the super call, so I don't think its responsible.

  def configure_connection
    @hijacker = AfRuntime::Db::HijackerBase.create(connection: self, config: @config)
    super
  end

FYI the HijackerBase is responsible for ultimately calling USE <database name> with the correct database name.

Also I think the culprit of creating the transaction is af_job

I don't think af_job is the responsible either, that class in the stacktrace is just setting a Thread variable. The line in the trace is the super call. And there is no difference in this code between 7.0 and 7.1

I would advise doing the setup work beforehand

We already have a schema cache setup, which already has all table/column info already loaded into memory, so its unclear to me why this pg_type query is occurring in the first place.

Is there a way I could access to those files?

I think pairing together on this would be the easiest and fastest way to share more detailed information

I see you have a branch I'll test it on that.

grantpaulson6 commented 7 months ago

well, I now think I was wrong about needing to be connected to an actual cluster. The reason it wasn't triggering the error locally is the transaction wasn't beginning before the as of system time query like it is in QA env. So for whatever reason, our QA environment config on rails 7.1 is causing that transaction to begin early.

BuonOmo commented 7 months ago

@grantpaulson6

I'm also happy to zoom/pair on this if you're up for it

Email me to see when, this may be way more efficient indeed...

grantpaulson6 commented 6 months ago

bit of a breakthrough: I just discovered that the transaction starts early when using a standalone mysql database as well (and using the same steps as the script to reproduce). So its not that cockroachdb is causing the transaction to start early, the rails 7.1 ugrade changed that behavior. Its just that the timestamp consistency feature of cockroach db errors out, while mysql doesn't have that and doesn't care.

BuonOmo commented 6 months ago

@grantpaulson6 nice ! There are still two important points for me here:

grantpaulson6 commented 6 months ago

@BuonOmo its not anything to do with our codebase. Just create a vanilla rails app. I reproduced with the following steps:

rails new repoducebugpg --database=postgresql
rails db:create

then from the rails console:

Rails.logger.level = 0
ActiveRecord::Base.establish_connection(:primary)
ActiveRecord::Schema.define do
  create_table :posts, force: true do |t|
    t.string :other_id
  end
end

class Post < ApplicationRecord
end

class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
  def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil, async: false, &block)
    puts "------ #{name&.chomp || "anonymous query"} ------\n-- \n#{sql.chomp};\n\n"
    lines = caller_locations
    lines.each { |line| puts line }
    super
  end
end

Post.create_or_find_by!(other_id: '123')

And you can observe that the Transaction starts before the type introspection query

log output ``` ------ TRANSACTION ------ -- BEGIN; /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `execute' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:106:in `begin_db_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:207:in `materialize!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:285:in `block (2 levels) in materialize_transactions' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:285:in `each' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:285:in `block in materialize_transactions' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:282:in `materialize_transactions' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/database_statements.rb:324:in `materialize_transactions' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:14:in `query' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql_adapter.rb:916:in `column_definitions' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:117:in `columns' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:117:in `block in columns' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:116:in `fetch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:116:in `columns' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:125:in `block in columns_hash' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:124:in `fetch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:124:in `columns_hash' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/model_schema.rb:580:in `load_schema!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/attributes.rb:264:in `load_schema!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/encryption/encryptable_record.rb:122:in `load_schema!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/model_schema.rb:566:in `block in load_schema' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/model_schema.rb:563:in `synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/model_schema.rb:563:in `load_schema' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/model_schema.rb:429:in `attribute_types' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/attribute_methods.rb:187:in `_has_attribute?' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/inheritance.rb:60:in `new' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/persistence.rb:54:in `create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:870:in `_create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:115:in `block in create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:881:in `_scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:428:in `scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:115:in `create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:219:in `block in create_or_find_by!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/transactions.rb:209:in `transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `public_send' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `block in method_missing' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:881:in `_scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:428:in `scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `method_missing' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:219:in `create_or_find_by!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/querying.rb:22:in `create_or_find_by!' (irb):24:in `
' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/workspace.rb:117:in `eval' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/workspace.rb:117:in `evaluate' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/context.rb:609:in `evaluate' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1012:in `block (2 levels) in eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1323:in `signal_status' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1005:in `block in eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1085:in `block in each_top_level_statement' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1082:in `loop' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1082:in `each_top_level_statement' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1004:in `eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:988:in `block in run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:987:in `catch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:987:in `run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:884:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:74:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:19:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:106:in `perform' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/command/base.rb:87:in `perform' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/command.rb:48:in `invoke' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands.rb:18:in `
' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' bin/rails:4:in `
' TRANSACTION (0.3ms) BEGIN ------ SCHEMA ------ -- SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod, c.collname, col_description(a.attrelid, a.attnum) AS comment, attgenerated as attgenerated FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum LEFT JOIN pg_type t ON a.atttypid = t.oid LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation WHERE a.attrelid = '"posts"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum; /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:17:in `query' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql_adapter.rb:916:in `column_definitions' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:117:in `columns' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:117:in `block in columns' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:116:in `fetch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:116:in `columns' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:125:in `block in columns_hash' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:124:in `fetch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:124:in `columns_hash' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/model_schema.rb:580:in `load_schema!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/attributes.rb:264:in `load_schema!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/encryption/encryptable_record.rb:122:in `load_schema!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/model_schema.rb:566:in `block in load_schema' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/model_schema.rb:563:in `synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/model_schema.rb:563:in `load_schema' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/model_schema.rb:429:in `attribute_types' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/attribute_methods.rb:187:in `_has_attribute?' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/inheritance.rb:60:in `new' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/persistence.rb:54:in `create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:870:in `_create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:115:in `block in create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:881:in `_scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:428:in `scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:115:in `create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:219:in `block in create_or_find_by!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/transactions.rb:209:in `transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `public_send' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `block in method_missing' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:881:in `_scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:428:in `scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `method_missing' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:219:in `create_or_find_by!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/querying.rb:22:in `create_or_find_by!' (irb):24:in `
' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/workspace.rb:117:in `eval' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/workspace.rb:117:in `evaluate' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/context.rb:609:in `evaluate' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1012:in `block (2 levels) in eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1323:in `signal_status' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1005:in `block in eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1085:in `block in each_top_level_statement' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1082:in `loop' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1082:in `each_top_level_statement' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1004:in `eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:988:in `block in run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:987:in `catch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:987:in `run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:884:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:74:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:19:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:106:in `perform' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/command/base.rb:87:in `perform' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/command.rb:48:in `invoke' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands.rb:18:in `
' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' bin/rails:4:in `
' ------ SCHEMA ------ -- SHOW max_identifier_length; /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:17:in `query' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/database_statements.rb:95:in `query_value' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql_adapter.rb:491:in `max_identifier_length' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql/schema_statements.rb:706:in `sequence_name_from_parts' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql/schema_statements.rb:677:in `new_column_from_field' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:118:in `block in columns' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:117:in `map' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:117:in `columns' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:117:in `block in columns' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:116:in `fetch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:116:in `columns' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:125:in `block in columns_hash' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:124:in `fetch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:124:in `columns_hash' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/model_schema.rb:580:in `load_schema!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/attributes.rb:264:in `load_schema!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/encryption/encryptable_record.rb:122:in `load_schema!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/model_schema.rb:566:in `block in load_schema' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/model_schema.rb:563:in `synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/model_schema.rb:563:in `load_schema' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/model_schema.rb:429:in `attribute_types' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/attribute_methods.rb:187:in `_has_attribute?' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/inheritance.rb:60:in `new' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/persistence.rb:54:in `create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:870:in `_create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:115:in `block in create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:881:in `_scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:428:in `scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:115:in `create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:219:in `block in create_or_find_by!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/transactions.rb:209:in `transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `public_send' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `block in method_missing' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:881:in `_scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:428:in `scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `method_missing' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:219:in `create_or_find_by!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/querying.rb:22:in `create_or_find_by!' (irb):24:in `
' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/workspace.rb:117:in `eval' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/workspace.rb:117:in `evaluate' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/context.rb:609:in `evaluate' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1012:in `block (2 levels) in eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1323:in `signal_status' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1005:in `block in eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1085:in `block in each_top_level_statement' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1082:in `loop' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1082:in `each_top_level_statement' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1004:in `eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:988:in `block in run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:987:in `catch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:987:in `run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:884:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:74:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:19:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:106:in `perform' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/command/base.rb:87:in `perform' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/command.rb:48:in `invoke' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands.rb:18:in `
' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' bin/rails:4:in `
' ------ SCHEMA ------ -- SELECT a.attname FROM ( SELECT indrelid, indkey, generate_subscripts(indkey, 1) idx FROM pg_index WHERE indrelid = '"posts"'::regclass AND indisprimary ) i JOIN pg_attribute a ON a.attrelid = i.indrelid AND a.attnum = i.indkey[i.idx] ORDER BY i.idx; /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:17:in `query' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/database_statements.rb:99:in `query_values' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql/schema_statements.rb:357:in `primary_keys' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:153:in `primary_key' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:82:in `block in primary_keys' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:80:in `fetch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/schema_cache.rb:80:in `primary_keys' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/attribute_methods/primary_key.rb:96:in `get_primary_key' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/attribute_methods/primary_key.rb:83:in `reset_primary_key' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/attribute_methods/primary_key.rb:71:in `primary_key' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/core.rb:761:in `init_internals' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/associations.rb:323:in `init_internals' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/core.rb:465:in `initialize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/inheritance.rb:75:in `new' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/inheritance.rb:75:in `new' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/persistence.rb:54:in `create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:870:in `_create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:115:in `block in create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:881:in `_scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:428:in `scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:115:in `create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:219:in `block in create_or_find_by!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/transactions.rb:209:in `transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `public_send' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `block in method_missing' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:881:in `_scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:428:in `scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `method_missing' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:219:in `create_or_find_by!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/querying.rb:22:in `create_or_find_by!' (irb):24:in `
' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/workspace.rb:117:in `eval' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/workspace.rb:117:in `evaluate' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/context.rb:609:in `evaluate' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1012:in `block (2 levels) in eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1323:in `signal_status' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1005:in `block in eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1085:in `block in each_top_level_statement' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1082:in `loop' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1082:in `each_top_level_statement' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1004:in `eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:988:in `block in run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:987:in `catch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:987:in `run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:884:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:74:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:19:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:106:in `perform' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/command/base.rb:87:in `perform' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/command.rb:48:in `invoke' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands.rb:18:in `
' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' bin/rails:4:in `
' ------ Post Create ------ -- INSERT INTO "posts" ("other_id") VALUES ($1) RETURNING "id"; /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql_adapter.rb:766:in `exec_no_cache' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql_adapter.rb:745:in `execute_and_clear' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:54:in `exec_query' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/database_statements.rb:132:in `exec_insert' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:88:in `exec_insert' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/database_statements.rb:167:in `insert' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/query_cache.rb:22:in `insert' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/persistence.rb:496:in `_insert_record' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/persistence.rb:1098:in `_create_record' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/counter_cache.rb:166:in `_create_record' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/locking/optimistic.rb:84:in `_create_record' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/attribute_methods/dirty.rb:222:in `_create_record' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/callbacks.rb:459:in `block in _create_record' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/callbacks.rb:99:in `run_callbacks' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/callbacks.rb:929:in `_run_create_callbacks' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/callbacks.rb:459:in `_create_record' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/timestamp.rb:108:in `_create_record' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/persistence.rb:1069:in `create_or_update' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/callbacks.rb:455:in `block in create_or_update' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/callbacks.rb:99:in `run_callbacks' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/callbacks.rb:929:in `_run_save_callbacks' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/callbacks.rb:455:in `create_or_update' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/timestamp.rb:126:in `create_or_update' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/persistence.rb:648:in `save!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/validations.rb:53:in `save!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/transactions.rb:302:in `block in save!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/transactions.rb:354:in `block in with_transaction_returning_status' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/database_statements.rb:314:in `transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/transactions.rb:350:in `with_transaction_returning_status' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/transactions.rb:302:in `save!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/suppressor.rb:54:in `save!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/persistence.rb:55:in `create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:870:in `_create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:115:in `block in create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:881:in `_scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:428:in `scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:115:in `create!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:219:in `block in create_or_find_by!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/transactions.rb:209:in `transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `public_send' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `block in method_missing' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:881:in `_scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:428:in `scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `method_missing' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:219:in `create_or_find_by!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/querying.rb:22:in `create_or_find_by!' (irb):24:in `
' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/workspace.rb:117:in `eval' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/workspace.rb:117:in `evaluate' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/context.rb:609:in `evaluate' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1012:in `block (2 levels) in eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1323:in `signal_status' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1005:in `block in eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1085:in `block in each_top_level_statement' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1082:in `loop' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1082:in `each_top_level_statement' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1004:in `eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:988:in `block in run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:987:in `catch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:987:in `run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:884:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:74:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:19:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:106:in `perform' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/command/base.rb:87:in `perform' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/command.rb:48:in `invoke' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands.rb:18:in `
' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' bin/rails:4:in `
' Post Create (0.8ms) INSERT INTO "posts" ("other_id") VALUES ($1) RETURNING "id" [["other_id", "123"]] ------ TRANSACTION ------ -- COMMIT; /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `execute' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:116:in `commit_db_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:219:in `commit' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:303:in `block in commit_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:294:in `commit_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:345:in `block in within_new_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/transactions.rb:209:in `transaction' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `public_send' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `block in method_missing' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:881:in `_scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:428:in `scoping' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation/delegation.rb:108:in `method_missing' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/relation.rb:219:in `create_or_find_by!' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.8.1/lib/active_record/querying.rb:22:in `create_or_find_by!' (irb):24:in `
' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/workspace.rb:117:in `eval' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/workspace.rb:117:in `evaluate' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb/context.rb:609:in `evaluate' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1012:in `block (2 levels) in eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1323:in `signal_status' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1005:in `block in eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1085:in `block in each_top_level_statement' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1082:in `loop' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1082:in `each_top_level_statement' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:1004:in `eval_input' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:988:in `block in run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:987:in `catch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:987:in `run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.12.0/lib/irb.rb:884:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:74:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:19:in `start' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands/console/console_command.rb:106:in `perform' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/command/base.rb:87:in `perform' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/command.rb:48:in `invoke' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/railties-7.0.8.1/lib/rails/commands.rb:18:in `
' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' /Users/grant.paulson/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' bin/rails:4:in `
' TRANSACTION (0.3ms) COMMIT ```
BuonOmo commented 6 months ago

@grantpaulson6 I still do not reproduce... For me all of the queries that have an aost are ran before the transaction.

rails new repoducebugpg --database=postgresql
# change pg for activerecord-cockroachdb-adapter in gemfile
# change database.yml's default section (see below)
bundle
bin/rails db:create
bin/rails console 
# paste and run

And the database.yml:

default: &default
  adapter: cockroachdb
  port: 26257
  host: localhost
  user: root
  encoding: unicode
  use_follower_reads_for_type_introspection: true
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

Even in a cluster configuration:

default: &default
  adapter: cockroachdb
  port: 26257
  host: <%= ENV.fetch("COCKROACH_HOST") { "localhost" } %>
  user: <%= ENV.fetch("COCKROACH_USER") { "root" } %>
  password: <%= ENV.fetch("COCKROACH_PASSWORD") { "" } %>
  encoding: unicode
  use_follower_reads_for_type_introspection: true
  # For details on connection pooling, see Rails configuration guide
  # https://guides.rubyonrails.org/configuring.html#database-pooling
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  sslrootcert: <%= ENV.fetch("COCKROACH_SSL") { "" } %>

development:
  <<: *default
  database: <%= ENV.fetch("COCKROACH_DATABASE") { "repoducebugpg_development" } %>

I still do not reproduce the issue...

Also your logs show ruby 2.7 and rails 7.0, is it normal ?

grantpaulson6 commented 6 months ago

I'm running with rails 7.1 now and actually connecting to a crdb cluster for a vanilla rails app. Question though, how are you loading the CockroachDBAdapter? It appears that it isn't loaded automatically by the gem. Our in-house gem af_crdb explicitly required it require 'active_record/connection_adapters/cockroachdb_adapter'. But as I'm trying to boot up a vanilla rails app, just adding the crdb gem doesn't actually load the adapter class. And then when I add in that require statement, the adapter used is still PostgreSQLAdapter not CockroachDBAdapter

Also if you could share your logs for your tests too that would be helpful

grantpaulson6 commented 6 months ago

scratch that; it was a config issue on my end. I used the key url in the db config to set most of the important bits for connections to our qa cluster, and it was overriding my adapter name.

Anyways, I was able to reproduce the issue with a vanilla rails app on rails 7.1 connected to a cluster. I'm going to create a repo and share it with you so you can use it to reproduce

grantpaulson6 commented 6 months ago

@BuonOmo this is the repo to reproduce, check out the README. I've added you as a collaborator on the repo.

BuonOmo commented 6 months ago

@grantpaulson6 thank you, I finally reproduce ! I don't know the difference with the repo I made yet, but I'll find it. Now that I have a local reproduction, that should not be so hard to fix!

BuonOmo commented 6 months ago

🔝

@grantpaulson6 this should be it ! It passes your reproduction :)

If you'd be able to try it on your real case it'd be nice

grantpaulson6 commented 6 months ago

the fix worked! 🎉