Proposal: Bump the minimum supported PostgreSQL version from 9.3 to 10

PostgreSQL 18 (scheduled for release around September/October 2025) changes the format of the cancel request key, which causes the following test to fail on Rails main.

This change was introduced in PostgreSQL core via

The issue is already addressed in Add support for new query cancel functions of PostgreSQL-17 by larskanis · Pull Request #614 · ged/ruby-pg · GitHub, and the fix is included in the upcoming pg gem version v1.6.0 (currently released as v1.6.0.rc1).

The pg gem v1.6.0 raises its minimum required PostgreSQL version to 10 via

Rails main currently claims support for PostgreSQL 9.3+, which is incompatible with PostgreSQL 18 unless we raise the minimum supported version to 10.

I propose updating Rails main to require PostgreSQL 10 or newer, to ensure compatibility with PostgreSQL 18 and future releases.

Although Rails is not strictly tied to PostgreSQL’s official support schedule, it’s worth noting that PostgreSQL 9.3 reached end-of-life on November 8, 2018. At this point, prioritizing compatibility with newer PostgreSQL versions — including version 18 — seems more valuable than continuing to support a version that is no longer maintained upstream.

  • PostgreSQL 18 Beta 1
$ psql -d postgres
psql (18beta1)
Type "help" for help.

postgres=# select version();
                              version                               
--------------------------------------------------------------------
 PostgreSQL 18beta1 on x86_64-linux, compiled by gcc-15.1.1, 64-bit
(1 row)

postgres=# 
  • With pg 1.5.9 ActiveRecord::PostgresqlTransactionTest#test_raises_Interrupt_when_canceling_statement_via_interrupt fails
$ bundle info pg
  * pg (1.5.9)
    Summary: Pg is the Ruby interface to the PostgreSQL RDBMS
    Homepage: https://github.com/ged/ruby-pg
    Documentation: http://deveiate.org/code/pg
    Source Code: https://github.com/ged/ruby-pg
    Changelog: https://github.com/ged/ruby-pg/blob/master/History.md
    Path: /home/yahonda/.local/share/mise/installs/ruby/3.4.4/lib/ruby/gems/3.4.0/gems/pg-1.5.9
    Reverse Dependencies: 
        queue_classic (4.0.0) depends on pg (>= 1.1, < 2.0)
$
$ ARCONN=postgresql bin/test test/cases/adapters/postgresql/transaction_test.rb -n test_raises_Interrupt_when_canceling_statement_via_interrupt
Using postgresql
Run options: -n test_raises_Interrupt_when_canceling_statement_via_interrupt --seed 17678

# Running:

F

Failure:
ActiveRecord::PostgresqlTransactionTest#test_raises_Interrupt_when_canceling_statement_via_interrupt [test/cases/adapters/postgresql/transaction_test.rb:199]:
Expected 10.014372003 to be < 5.


bin/test test/cases/adapters/postgresql/transaction_test.rb:183



Finished in 10.067954s, 0.0993 runs/s, 0.1987 assertions/s.
1 runs, 2 assertions, 1 failures, 0 errors, 0 skips
  • With pg 1.6.0.rc1 ActiveRecord::PostgresqlTransactionTest#test_raises_Interrupt_when_canceling_statement_via_interrupt passes
$ git diff
diff --git a/Gemfile b/Gemfile
index 6512ce889c..003e7f3318 100644
--- a/Gemfile
+++ b/Gemfile
@@ -157,7 +157,7 @@ platforms :ruby, :windows do
   gem "sqlite3", ">= 2.1"
 
   group :db do
-    gem "pg", "~> 1.3"
+    gem "pg", "~> 1.6.0.rc1"
     gem "mysql2", "~> 0.5"
     gem "trilogy", ">= 2.7.0"
   end
diff --git a/Gemfile.lock b/Gemfile.lock
index 19c5676b09..4eb1f935d9 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -438,7 +438,7 @@ GEM
       ast (~> 2.4.1)
       racc
     path_expander (1.1.3)
-    pg (1.5.9)
+    pg (1.6.0.rc1)
     prism (1.3.0)
     propshaft (1.1.0)
       actionpack (>= 7.0.0)
@@ -766,7 +766,7 @@ DEPENDENCIES
   msgpack (>= 1.7.0)
   mysql2 (~> 0.5)
   nokogiri (>= 1.8.1, != 1.11.0)
-  pg (~> 1.3)
+  pg (~> 1.6.0.rc1)
   prism
   propshaft (>= 0.1.7, != 1.0.1)
   puma (>= 5.0.3)
$ bundle info pg
  * pg (1.6.0.rc1)
  Summary: Pg is the Ruby interface to the PostgreSQL RDBMS
  Homepage: https://github.com/ged/ruby-pg
  Documentation: http://deveiate.org/code/pg
  Source Code: https://github.com/ged/ruby-pg
  Changelog: https://github.com/ged/ruby-pg/blob/master/History.md
  Path: /home/yahonda/.local/share/mise/installs/ruby/3.4.4/lib/ruby/gems/3.4.0/gems/pg-1.6.0.rc1
  Reverse Dependencies: 
    queue_classic (4.0.0) depends on pg (>= 1.1, < 2.0)
$ ARCONN=postgresql bin/test test/cases/adapters/postgresql/transaction_test.rb -n test_raises_Interrupt_when_canceling_statement_via_interrupt
Using postgresql
Run options: -n test_raises_Interrupt_when_canceling_statement_via_interrupt --seed 32415

# Running:

.

Finished in 0.584908s, 1.7097 runs/s, 3.4193 assertions/s.
1 runs, 2 assertions, 0 failures, 0 errors, 0 skips
$ 
4 Likes

i think this makes a lot of sense

1 Like

I thik it’s acceptable, go ahead.

1 Like

Thank you for supporting my proposal. Opened Bump required PostgreSQL version to 10.0 by yahonda · Pull Request #55282 · rails/rails · GitHub