From a465a4cdd26913112c9af3b0375167a62e418ddb Mon Sep 17 00:00:00 2001 From: Jesse Chavez Date: Fri, 2 Aug 2024 07:22:24 +1000 Subject: [PATCH 1/3] Skip postgres serial with trigger test, the issue is in AR 7.1, issue was logged in rails repo - ticket logged in rails repo https://github.com/rails/rails/issues/52485 - this issue is not present is Rails 7.0 or the new beta version 7.2 --- test/db/postgresql/table_name_test.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/db/postgresql/table_name_test.rb b/test/db/postgresql/table_name_test.rb index 0f32d7065..d96fca39b 100644 --- a/test/db/postgresql/table_name_test.rb +++ b/test/db/postgresql/table_name_test.rb @@ -81,16 +81,18 @@ def self.down end end - class SerialWithTrigger < ActiveRecord::Base; + class SerialWithTrigger < ActiveRecord::Base self.table_name = 'serials' self.primary_key = :sid end - test 'serial with trigger' do - sn = SerialWithTrigger.create! :value => 1234567890.to_s + def test_serial_with_trigger + pend "Issue happens in active record 7.1 internals, issue wass logged in rails repo" + # issue link: https://github.com/rails/rails/issues/52485 + + sn = SerialWithTrigger.create!(value: 1_234_567_890.to_s) assert sn.reload SerialWithTrigger.columns end - end From 9c20a72ea907589d91805d092322a0c2ecdccf0b Mon Sep 17 00:00:00 2001 From: Jesse Chavez Date: Fri, 2 Aug 2024 07:53:37 +1000 Subject: [PATCH 2/3] Fix boot up rails tests, use Postgres 11 since rails test schema has incompatible code to postgres 10 ActiveRecord::JDBCError: org.postgresql.util.PSQLException: ERROR: syntax error at or near "FUNCTION" Position: 140 execute at arjdbc/jdbc/RubyJdbcConnection.java:775 --- .github/workflows/ruby.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index f7d282c1c..940d80469 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -84,7 +84,7 @@ jobs: services: postgres: - image: postgres:10 + image: postgres:11 env: POSTGRES_PASSWORD: postgres POSTGRES_HOST_AUTH_METHOD: trust @@ -211,7 +211,7 @@ jobs: services: postgres: - image: postgres:10 + image: postgres:11 env: POSTGRES_PASSWORD: postgres POSTGRES_HOST_AUTH_METHOD: trust From afca8f75adb035007145093966f9022e98c671f8 Mon Sep 17 00:00:00 2001 From: Jesse Chavez Date: Fri, 2 Aug 2024 08:02:06 +1000 Subject: [PATCH 3/3] Fix boot up postgres rails tests, add undefined method `supports_identity_columns?' NoMethodError: undefined method `supports_identity_columns?' for # method_missing at /home/jessec/bryk/vendor_gems/rails/activerecord/lib/active_record/migration.rb:1047 say_with_time at /home/jessec/bryk/vendor_gems/rails/activerecord/lib/active_record/migration.rb:1017 --- lib/arjdbc/postgresql/adapter.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/arjdbc/postgresql/adapter.rb b/lib/arjdbc/postgresql/adapter.rb index 6e1d42aab..61ad5ef07 100644 --- a/lib/arjdbc/postgresql/adapter.rb +++ b/lib/arjdbc/postgresql/adapter.rb @@ -232,6 +232,10 @@ def supports_insert_on_conflict? alias supports_insert_on_duplicate_update? supports_insert_on_conflict? alias supports_insert_conflict_target? supports_insert_on_conflict? + def supports_identity_columns? # :nodoc: + database_version >= 10_00_00 # >= 10.0 + end + def index_algorithms { concurrently: 'CONCURRENTLY' } end