From 86367c6a2e8ca28daee066417ee37a8b9b7edcc9 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Thu, 24 Oct 2024 21:08:49 +0200 Subject: [PATCH 1/5] Update error codes by `rake update_error_codes` --- Rakefile | 2 +- ext/errorcodes.def | 9 ++++----- ext/errorcodes.txt | 7 ++----- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Rakefile b/Rakefile index be95343d7..6b44a2f83 100644 --- a/Rakefile +++ b/Rakefile @@ -94,7 +94,7 @@ end desc "Update list of server error codes" task :update_error_codes do - URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=refs/tags/REL_16_0" + URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=refs/tags/REL_17_0" ERRORCODES_TXT = "ext/errorcodes.txt" sh "wget #{URL_ERRORCODES_TXT.inspect} -O #{ERRORCODES_TXT.inspect} || curl #{URL_ERRORCODES_TXT.inspect} -o #{ERRORCODES_TXT.inspect}" diff --git a/ext/errorcodes.def b/ext/errorcodes.def index 5c501d790..ca0af630f 100644 --- a/ext/errorcodes.def +++ b/ext/errorcodes.def @@ -453,6 +453,10 @@ VALUE klass = define_error_class( "IdleInTransactionSessionTimeout", "25" ); register_error_class( "25P03", klass ); } +{ + VALUE klass = define_error_class( "TransactionTimeout", "25" ); + register_error_class( "25P04", klass ); +} { VALUE klass = define_error_class( "InvalidSqlStatementName", NULL ); register_error_class( "26000", klass ); @@ -885,11 +889,6 @@ VALUE klass = define_error_class( "DuplicateFile", "58" ); register_error_class( "58P02", klass ); } -{ - VALUE klass = define_error_class( "SnapshotTooOld", NULL ); - register_error_class( "72000", klass ); - register_error_class( "72", klass ); -} { VALUE klass = define_error_class( "ConfigFileError", NULL ); register_error_class( "F0000", klass ); diff --git a/ext/errorcodes.txt b/ext/errorcodes.txt index 3d244af13..3250d539e 100644 --- a/ext/errorcodes.txt +++ b/ext/errorcodes.txt @@ -2,7 +2,7 @@ # errcodes.txt # PostgreSQL error codes # -# Copyright (c) 2003-2023, PostgreSQL Global Development Group +# Copyright (c) 2003-2024, PostgreSQL Global Development Group # # This list serves as the basis for generating source files containing error # codes. It is kept in a common format to make sure all these source files have @@ -252,6 +252,7 @@ Section: Class 25 - Invalid Transaction State 25P01 E ERRCODE_NO_ACTIVE_SQL_TRANSACTION no_active_sql_transaction 25P02 E ERRCODE_IN_FAILED_SQL_TRANSACTION in_failed_sql_transaction 25P03 E ERRCODE_IDLE_IN_TRANSACTION_SESSION_TIMEOUT idle_in_transaction_session_timeout +25P04 E ERRCODE_TRANSACTION_TIMEOUT transaction_timeout Section: Class 26 - Invalid SQL Statement Name @@ -439,10 +440,6 @@ Section: Class 58 - System Error (errors external to PostgreSQL itself) 58P01 E ERRCODE_UNDEFINED_FILE undefined_file 58P02 E ERRCODE_DUPLICATE_FILE duplicate_file -Section: Class 72 - Snapshot Failure -# (class borrowed from Oracle) -72000 E ERRCODE_SNAPSHOT_TOO_OLD snapshot_too_old - Section: Class F0 - Configuration File Error # (PostgreSQL-specific error class) From d8c3753b8b9919bb8f78b57bde44252f7dfc523b Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Thu, 24 Oct 2024 21:10:12 +0200 Subject: [PATCH 2/5] Update to postgresql-17.0 and openssl-3.4.0 for Windows binary gems --- Rakefile.cross | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Rakefile.cross b/Rakefile.cross index c01b77b5f..9ba2aee89 100644 --- a/Rakefile.cross +++ b/Rakefile.cross @@ -31,8 +31,8 @@ class CrossLibrary < OpenStruct self.host_platform = toolchain # Cross-compilation constants - self.openssl_version = ENV['OPENSSL_VERSION'] || '3.3.2' - self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '16.4' + self.openssl_version = ENV['OPENSSL_VERSION'] || '3.4.0' + self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '17.0' # Check if symlinks work in the current working directory. # This fails, if rake-compiler-dock is running on a Windows box. @@ -289,6 +289,7 @@ CrossLibraries.each do |xlib| task "gem:windows:#{platform}" => ['gem:windows:prepare', xlib.openssl_tarball, xlib.postgresql_tarball] do RakeCompilerDock.sh <<-EOT, platform: platform (cp build/gem/gem-*.pem ~/.gem/ || true) && + sudo apt-get update && sudo apt-get install -y bison flex && bundle install --local && rake native:#{platform} pkg/#{$gem_spec.full_name}-#{platform}.gem MAKEOPTS=-j`nproc` RUBY_CC_VERSION=3.3.0:3.2.0:3.1.0:3.0.0:2.7.0:2.6.0:2.5.0 EOT From 4a52437a836737723c8cd73eb9e780a3b69f56ee Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Thu, 24 Oct 2024 21:14:08 +0200 Subject: [PATCH 3/5] CI: Update jobs to postgresql-1.7.0 --- .github/workflows/binary-gems.yml | 2 +- .github/workflows/source-gem.yml | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/binary-gems.yml b/.github/workflows/binary-gems.yml index d475a4543..8067c131a 100644 --- a/.github/workflows/binary-gems.yml +++ b/.github/workflows/binary-gems.yml @@ -52,7 +52,7 @@ jobs: - os: windows-latest ruby: "3.3" platform: "x64-mingw-ucrt" - PGVERSION: 16.0-1-windows-x64 + PGVERSION: 17.0-1-windows-x64 - os: windows-latest ruby: "3.1.4-1" platform: "x86-mingw32" diff --git a/.github/workflows/source-gem.yml b/.github/workflows/source-gem.yml index c1e4cd461..2f37bf59e 100644 --- a/.github/workflows/source-gem.yml +++ b/.github/workflows/source-gem.yml @@ -44,19 +44,19 @@ jobs: include: - os: windows ruby: "head" - PGVERSION: 16.0-1-windows-x64 - PGVER: "16" + PGVERSION: 17.0-1-windows-x64 + PGVER: "17" - os: windows ruby: "2.5" PGVERSION: 9.4.26-1-windows-x64 PGVER: "9.4" - os: windows ruby: "mswin" - PGVERSION: 16.0-1-windows-x64 - PGVER: "16" + PGVERSION: 17.0-1-windows-x64 + PGVER: "17" - os: ubuntu ruby: "head" - PGVER: "16" + PGVER: "17" - os: ubuntu ruby: "3.2" PGVER: "12" @@ -69,11 +69,11 @@ jobs: PGVER: "13" - os: ubuntu ruby: "truffleruby-head" - PGVER: "16" + PGVER: "17" - os: macos ruby: "head" - PGVERSION: 16.0-1-osx - PGVER: "16" + PGVERSION: 17.0-1-osx + PGVER: "17" runs-on: ${{ matrix.os }}-${{ matrix.os_ver || 'latest' }} env: From 70c02eae56d521061061c4d8be067061664994ed Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Thu, 24 Oct 2024 21:46:22 +0200 Subject: [PATCH 4/5] Work around missing dependency to errorcodes.h in PostgreSQL-17.0 --- Rakefile.cross | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Rakefile.cross b/Rakefile.cross index 9ba2aee89..bb832e706 100644 --- a/Rakefile.cross +++ b/Rakefile.cross @@ -206,6 +206,10 @@ class CrossLibrary < OpenStruct chdir( static_postgresql_srcdir + "common" ) do sh 'make', "-j#{NUM_CPUS}" end + # Work around missing dependency to errorcodes.h in PostgreSQL-17.0 + chdir( static_postgresql_srcdir + "backend" + "utils" ) do + sh 'make', "-j#{NUM_CPUS}" + end chdir( static_postgresql_srcdir + "port" ) do sh 'make', "-j#{NUM_CPUS}" end From ca8e69cca0964ec3de8ee045bf45ecbca3ac6566 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Thu, 24 Oct 2024 21:50:44 +0200 Subject: [PATCH 5/5] Remove skip on Windows since the issue is fixed by commit 716221a95b2194fa0d3e777d5b71aea9e7724ca7 --- spec/pg/connection_spec.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/pg/connection_spec.rb b/spec/pg/connection_spec.rb index 3f3244abc..0f2148638 100644 --- a/spec/pg/connection_spec.rb +++ b/spec/pg/connection_spec.rb @@ -588,8 +588,6 @@ end it "doesn't notify the wrong thread about closed socket (Bug #564)" do - skip "this spec crashs silently on Windows for some reason (pending investigation)" if RUBY_PLATFORM=~/mingw|mswin/i - 10.times do 10.times.map do Thread.new do