pg 1.5.4 → 1.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.appveyor.yml +1 -1
- data/.github/workflows/binary-gems.yml +12 -12
- data/.github/workflows/source-gem.yml +28 -17
- data/Gemfile +6 -0
- data/History.md +41 -4
- data/Rakefile +4 -1
- data/Rakefile.cross +5 -5
- data/certs/kanis@comcard.de.pem +20 -0
- data/certs/larskanis-2024.pem +24 -0
- data/ext/errorcodes.txt +1 -1
- data/ext/extconf.rb +3 -0
- data/ext/pg.c +1 -1
- data/ext/pg_binary_decoder.c +2 -0
- data/ext/pg_binary_encoder.c +1 -1
- data/ext/pg_connection.c +45 -13
- data/ext/pg_copy_coder.c +17 -13
- data/ext/pg_record_coder.c +6 -6
- data/ext/pg_result.c +2 -2
- data/ext/pg_text_decoder.c +4 -1
- data/ext/pg_text_encoder.c +17 -11
- data/lib/pg/basic_type_map_for_queries.rb +8 -4
- data/lib/pg/basic_type_registry.rb +14 -2
- data/lib/pg/connection.rb +56 -34
- data/lib/pg/exceptions.rb +6 -0
- data/lib/pg/text_decoder/date.rb +3 -0
- data/lib/pg/text_decoder/json.rb +3 -0
- data/lib/pg/text_encoder/date.rb +1 -0
- data/lib/pg/text_encoder/inet.rb +3 -0
- data/lib/pg/text_encoder/json.rb +3 -0
- data/lib/pg/version.rb +1 -1
- data/lib/pg.rb +10 -0
- data/pg.gemspec +1 -1
- data.tar.gz.sig +0 -0
- metadata +30 -28
- metadata.gz.sig +0 -0
- data/translation/.po4a-version +0 -7
- data/translation/po/all.pot +0 -936
- data/translation/po/ja.po +0 -1036
- data/translation/po4a.cfg +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af4acb6c7ea394621dc7464296e728a4e245ee83d49bd27ccb06bc3b2f1ac8fd
|
4
|
+
data.tar.gz: 6f15907b13e4d76a2b1cb88a34cc00bc719300ca2b5dc0a6a60a90cd8c14a05a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6a7859212429f25047b10e58a989eeeedd2685cc537be1d3e477fddc02a0a70ebc86b81d77b7bfd46a1439f3558a6e7459d32dc05460e5d739b5a60c065efb4
|
7
|
+
data.tar.gz: d2a4e22dd35c71e3851bb44adfe1b9ccb88e01f689e4718cb099f5da39218d553575ec38d2d866d23998d52256cfa69abfbabd7c9a130a9e25b765eb5ed4b8b9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.appveyor.yml
CHANGED
@@ -9,7 +9,7 @@ on:
|
|
9
9
|
|
10
10
|
jobs:
|
11
11
|
job_build_x64:
|
12
|
-
name:
|
12
|
+
name: Build
|
13
13
|
runs-on: ubuntu-latest
|
14
14
|
strategy:
|
15
15
|
fail-fast: false
|
@@ -19,11 +19,11 @@ jobs:
|
|
19
19
|
- platform: "x64-mingw32"
|
20
20
|
- platform: "x86-mingw32"
|
21
21
|
steps:
|
22
|
-
- uses: actions/checkout@
|
22
|
+
- uses: actions/checkout@v4
|
23
23
|
- name: Set up Ruby
|
24
24
|
uses: ruby/setup-ruby@v1
|
25
25
|
with:
|
26
|
-
ruby-version: "3.
|
26
|
+
ruby-version: "3.3"
|
27
27
|
- run: bundle install
|
28
28
|
|
29
29
|
- name: Create a dummy cert to satisfy the build
|
@@ -37,24 +37,24 @@ jobs:
|
|
37
37
|
run: bundle exec rake gem:windows:${{ matrix.platform }}
|
38
38
|
|
39
39
|
- name: Upload binary gem
|
40
|
-
uses: actions/upload-artifact@
|
40
|
+
uses: actions/upload-artifact@v4
|
41
41
|
with:
|
42
|
-
name: binary-gem
|
42
|
+
name: binary-gem-${{ matrix.platform }}
|
43
43
|
path: pkg/*.gem
|
44
44
|
|
45
45
|
job_test_binary:
|
46
|
-
name: Test
|
46
|
+
name: Test
|
47
47
|
needs: job_build_x64
|
48
48
|
strategy:
|
49
49
|
fail-fast: false
|
50
50
|
matrix:
|
51
51
|
include:
|
52
52
|
- os: windows-latest
|
53
|
-
ruby: "3.
|
53
|
+
ruby: "3.3"
|
54
54
|
platform: "x64-mingw-ucrt"
|
55
|
-
PGVERSION:
|
55
|
+
PGVERSION: 16.0-1-windows-x64
|
56
56
|
- os: windows-latest
|
57
|
-
ruby: "3.1.
|
57
|
+
ruby: "3.1.4-1"
|
58
58
|
platform: "x86-mingw32"
|
59
59
|
PGVERSION: 10.20-1-windows
|
60
60
|
- os: windows-latest
|
@@ -66,7 +66,7 @@ jobs:
|
|
66
66
|
env:
|
67
67
|
PGVERSION: ${{ matrix.PGVERSION }}
|
68
68
|
steps:
|
69
|
-
- uses: actions/checkout@
|
69
|
+
- uses: actions/checkout@v4
|
70
70
|
- name: Set up Ruby
|
71
71
|
if: matrix.platform != 'x86-mingw32'
|
72
72
|
uses: ruby/setup-ruby@v1
|
@@ -85,9 +85,9 @@ jobs:
|
|
85
85
|
echo "C:/msys64/$env:MSYSTEM_PREFIX/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
86
86
|
|
87
87
|
- name: Download gem from build job
|
88
|
-
uses: actions/download-artifact@
|
88
|
+
uses: actions/download-artifact@v4
|
89
89
|
with:
|
90
|
-
name: binary-gem
|
90
|
+
name: binary-gem-${{ matrix.platform }}
|
91
91
|
|
92
92
|
- name: Download PostgreSQL
|
93
93
|
run: |
|
@@ -1,18 +1,26 @@
|
|
1
1
|
name: Source gem
|
2
|
-
|
3
2
|
on:
|
4
|
-
push:
|
5
|
-
pull_request:
|
6
3
|
workflow_dispatch:
|
7
4
|
schedule:
|
8
5
|
- cron: "0 5 * * 3" # At 05:00 on Wednesday # https://crontab.guru/#0_5_*_*_3
|
6
|
+
push:
|
7
|
+
branches:
|
8
|
+
- master
|
9
|
+
tags:
|
10
|
+
- "*.*.*"
|
11
|
+
pull_request:
|
12
|
+
types: [opened, synchronize]
|
13
|
+
branches:
|
14
|
+
- "*"
|
15
|
+
permissions:
|
16
|
+
contents: read
|
9
17
|
|
10
18
|
jobs:
|
11
19
|
job_build_gem:
|
12
|
-
name:
|
20
|
+
name: Build
|
13
21
|
runs-on: ubuntu-latest
|
14
22
|
steps:
|
15
|
-
- uses: actions/checkout@
|
23
|
+
- uses: actions/checkout@v4
|
16
24
|
- name: Set up Ruby
|
17
25
|
uses: ruby/setup-ruby@v1
|
18
26
|
with:
|
@@ -22,13 +30,13 @@ jobs:
|
|
22
30
|
run: gem build pg.gemspec
|
23
31
|
|
24
32
|
- name: Upload source gem
|
25
|
-
uses: actions/upload-artifact@
|
33
|
+
uses: actions/upload-artifact@v4
|
26
34
|
with:
|
27
35
|
name: source-gem
|
28
36
|
path: "*.gem"
|
29
37
|
|
30
38
|
job_test_gem:
|
31
|
-
name: Test
|
39
|
+
name: Test
|
32
40
|
needs: job_build_gem
|
33
41
|
strategy:
|
34
42
|
fail-fast: false
|
@@ -36,19 +44,19 @@ jobs:
|
|
36
44
|
include:
|
37
45
|
- os: windows
|
38
46
|
ruby: "head"
|
39
|
-
PGVERSION:
|
40
|
-
PGVER: "
|
47
|
+
PGVERSION: 16.0-1-windows-x64
|
48
|
+
PGVER: "16"
|
41
49
|
- os: windows
|
42
50
|
ruby: "2.5"
|
43
51
|
PGVERSION: 9.4.26-1-windows-x64
|
44
52
|
PGVER: "9.4"
|
45
53
|
- os: windows
|
46
54
|
ruby: "mswin"
|
47
|
-
PGVERSION:
|
48
|
-
PGVER: "
|
55
|
+
PGVERSION: 16.0-1-windows-x64
|
56
|
+
PGVER: "16"
|
49
57
|
- os: ubuntu
|
50
58
|
ruby: "head"
|
51
|
-
PGVER: "
|
59
|
+
PGVER: "16"
|
52
60
|
- os: ubuntu
|
53
61
|
ruby: "3.2"
|
54
62
|
PGVER: "12"
|
@@ -61,11 +69,11 @@ jobs:
|
|
61
69
|
PGVER: "13"
|
62
70
|
- os: ubuntu
|
63
71
|
ruby: "truffleruby-head"
|
64
|
-
PGVER: "
|
72
|
+
PGVER: "16"
|
65
73
|
- os: macos
|
66
74
|
ruby: "head"
|
67
|
-
PGVERSION:
|
68
|
-
PGVER: "
|
75
|
+
PGVERSION: 16.0-1-osx
|
76
|
+
PGVER: "16"
|
69
77
|
|
70
78
|
runs-on: ${{ matrix.os }}-${{ matrix.os_ver || 'latest' }}
|
71
79
|
env:
|
@@ -74,14 +82,14 @@ jobs:
|
|
74
82
|
MAKE: make -j2 V=1
|
75
83
|
|
76
84
|
steps:
|
77
|
-
- uses: actions/checkout@
|
85
|
+
- uses: actions/checkout@v4
|
78
86
|
- name: Set up Ruby
|
79
87
|
uses: ruby/setup-ruby@v1
|
80
88
|
with:
|
81
89
|
ruby-version: ${{ matrix.ruby }}
|
82
90
|
|
83
91
|
- name: Download gem from build job
|
84
|
-
uses: actions/download-artifact@
|
92
|
+
uses: actions/download-artifact@v4
|
85
93
|
with:
|
86
94
|
name: source-gem
|
87
95
|
|
@@ -120,6 +128,7 @@ jobs:
|
|
120
128
|
wget https://get.enterprisedb.com/postgresql/postgresql-$PGVERSION-binaries.zip && \
|
121
129
|
sudo mkdir -p /Library/PostgreSQL && \
|
122
130
|
sudo unzip postgresql-$PGVERSION-binaries.zip -d /Library/PostgreSQL/$PGVER && \
|
131
|
+
sudo mv /Library/PostgreSQL/$PGVER/pgsql/* /Library/PostgreSQL/$PGVER/ && \
|
123
132
|
echo /Library/PostgreSQL/$PGVER/bin >> $GITHUB_PATH
|
124
133
|
|
125
134
|
- run: gem update --system 3.3.26
|
@@ -130,6 +139,8 @@ jobs:
|
|
130
139
|
- name: Run specs
|
131
140
|
env:
|
132
141
|
PG_DEBUG: 0
|
142
|
+
# Temprary fix only for Truffleruby-24.0.0:
|
143
|
+
TRUFFLERUBYOPT: --experimental-options --keep-handles-alive
|
133
144
|
run: ruby -rpg -S rspec spec/**/*_spec.rb -cfdoc
|
134
145
|
|
135
146
|
- name: Print logs if job failed
|
data/Gemfile
CHANGED
@@ -11,4 +11,10 @@ group :development, :test do
|
|
11
11
|
gem "rake-compiler-dock", "~> 1.0"
|
12
12
|
gem "rdoc", "~> 6.4"
|
13
13
|
gem "rspec", "~> 3.5"
|
14
|
+
gem "ostruct", "~> 0.5" # for Rakefile.cross
|
15
|
+
# "bigdecimal" is a gem on ruby-3.4+ and it's optional for ruby-pg.
|
16
|
+
# Specs should succeed without it, but 4 examples are then excluded.
|
17
|
+
# With bigdecimal commented out here, corresponding tests are omitted on ruby-3.4+ but are executed on ruby < 3.4.
|
18
|
+
# That way we can check both situations in CI.
|
19
|
+
# gem "bigdecimal", "~> 3.0"
|
14
20
|
end
|
data/History.md
CHANGED
@@ -1,9 +1,46 @@
|
|
1
|
+
## v1.5.8 [2024-09-06] Lars Kanis <lars@greiz-reinsdorf.de>
|
2
|
+
|
3
|
+
- Fix host list duplication every time conn.reset is used. [#586](https://github.com/ged/ruby-pg/pull/586)
|
4
|
+
- Add default decoder for anonymous record types to BasicTypeRegistry [#579](https://github.com/ged/ruby-pg/pull/579)
|
5
|
+
- Update Windows fat binary gem to OpenSSL-3.3.2 and PostgreSQL-16.4.
|
6
|
+
|
7
|
+
|
8
|
+
## v1.5.7 [2024-07-28] Lars Kanis <lars@greiz-reinsdorf.de>
|
9
|
+
|
10
|
+
- Remove deprecated use of fptr->fd.[#562](https://github.com/ged/ruby-pg/pull/562)
|
11
|
+
Direct access is disallowed since ruby-3.4.
|
12
|
+
- Make `pgconn_connect_poll` close the socket prior to calling `PQconnectPoll`. [#564](https://github.com/ged/ruby-pg/pull/564)
|
13
|
+
This could result in an exception while connecting when used multi threaded.
|
14
|
+
- Fix several typos and improve spelling in documentation and code. [#566](https://github.com/ged/ruby-pg/pull/566)
|
15
|
+
- Add missing PG::RollbackTransaction as an option to exit conn.transaction. [#560](https://github.com/ged/ruby-pg/pull/560)
|
16
|
+
Usage like in rails: https://api.rubyonrails.org/classes/ActiveRecord/Rollback.html
|
17
|
+
- Don't print a warning when bigdecimal is required on ruby-3.4+ [#574](https://github.com/ged/ruby-pg/pull/574)
|
18
|
+
- Update Windows fat binary gem to OpenSSL-3.3.1 and PostgreSQL-16.3.
|
19
|
+
|
20
|
+
|
21
|
+
## v1.5.6 [2024-03-01] Lars Kanis <lars@greiz-reinsdorf.de>
|
22
|
+
|
23
|
+
- Renew address resolution (DNS) in conn.reset. [#558](https://github.com/ged/ruby-pg/pull/558)
|
24
|
+
This is important, if DNS is used for load balancing, etc.
|
25
|
+
- Make bigdecimal an optional dependency. [#556](https://github.com/ged/ruby-pg/pull/556)
|
26
|
+
It's a gem in ruby-3.4+, so that users shouldn't be forced to use it.
|
27
|
+
|
28
|
+
|
29
|
+
## v1.5.5 [2024-02-15] Lars Kanis <lars@greiz-reinsdorf.de>
|
30
|
+
|
31
|
+
- Explicitly retype timespec fields to int64_t to fix compatibility with 32bit arches. [#547](https://github.com/ged/ruby-pg/pull/547)
|
32
|
+
- Fix possible buffer overflows in PG::BinaryDecoder::CopyRow on 32 bit systems. [#548](https://github.com/ged/ruby-pg/pull/548)
|
33
|
+
- Add binary Windows gems for Ruby 3.3.
|
34
|
+
- Update Windows fat binary gem to OpenSSL-3.2.1 and PostgreSQL-16.2.
|
35
|
+
|
36
|
+
|
1
37
|
## v1.5.4 [2023-09-01] Lars Kanis <lars@greiz-reinsdorf.de>
|
2
38
|
|
3
39
|
- Fix compiling the pg extension with MSVC 2022. [#535](https://github.com/ged/ruby-pg/pull/535)
|
4
40
|
- Set PG::Connection's encoding even if setting client_encoding on connection startup fails. [#541](https://github.com/ged/ruby-pg/pull/541)
|
5
41
|
- Don't set the server's client_encoding if it's unnecessary. [#542](https://github.com/ged/ruby-pg/pull/542)
|
6
42
|
This is important for connection proxies, who disallow configuration settings.
|
43
|
+
- Update Windows fat binary gem to OpenSSL-3.1.2 and PostgreSQL-15.4.
|
7
44
|
|
8
45
|
|
9
46
|
## v1.5.3 [2023-04-28] Lars Kanis <lars@greiz-reinsdorf.de>
|
@@ -75,7 +112,7 @@ Removed:
|
|
75
112
|
Repository:
|
76
113
|
|
77
114
|
- `rake test` tries to find PostgreSQL server commands by pg_config [#503](https://github.com/ged/ruby-pg/pull/503)
|
78
|
-
So there's no need to set the PATH
|
115
|
+
So there's no need to set the PATH manually any longer.
|
79
116
|
|
80
117
|
|
81
118
|
## v1.4.6 [2023-02-26] Lars Kanis <lars@greiz-reinsdorf.de>
|
@@ -144,7 +181,7 @@ Added:
|
|
144
181
|
Bugfixes:
|
145
182
|
|
146
183
|
- Try IPv6 and IPv4 addresses, if DNS resolves to both. [#452](https://github.com/ged/ruby-pg/pull/452)
|
147
|
-
- Re-add block-call semantics to PG::Connection.new
|
184
|
+
- Re-add block-call semantics to PG::Connection.new accidentally removed in pg-1.3.0. [#454](https://github.com/ged/ruby-pg/pull/454)
|
148
185
|
- Handle client error after all data consumed in #copy_data for output. [#455](https://github.com/ged/ruby-pg/pull/455)
|
149
186
|
- Avoid spurious keyword argument warning on Ruby 2.7. [#456](https://github.com/ged/ruby-pg/pull/456)
|
150
187
|
- Change connection setup to respect connect_timeout parameter. [#459](https://github.com/ged/ruby-pg/pull/459)
|
@@ -183,7 +220,7 @@ Bugfixes:
|
|
183
220
|
|
184
221
|
- Don't leak IO in case of connection errors. [#439](https://github.com/ged/ruby-pg/pull/439)
|
185
222
|
Previously it was kept open until the PG::Connection was garbage collected.
|
186
|
-
- Fix a performance
|
223
|
+
- Fix a performance regression in conn.get_result noticed in single row mode. [#442](https://github.com/ged/ruby-pg/pull/442)
|
187
224
|
- Fix occasional error Errno::EBADF (Bad file descriptor) while connecting. [#444](https://github.com/ged/ruby-pg/pull/444)
|
188
225
|
- Fix compatibility of res.stream_each* methods with Fiber.scheduler. [#446](https://github.com/ged/ruby-pg/pull/446)
|
189
226
|
- Remove FL_TEST and FL_SET, which are MRI-internal. [#437](https://github.com/ged/ruby-pg/pull/437)
|
@@ -269,7 +306,7 @@ Type cast enhancements:
|
|
269
306
|
- Add PG::BasicTypeMapForQueries::BinaryData for encoding of bytea columns. [#348](https://github.com/ged/ruby-pg/pull/348)
|
270
307
|
- Reduce time to build coder maps and permit to reuse them for several type maps per PG::BasicTypeRegistry::CoderMapsBundle.new(conn) . [#376](https://github.com/ged/ruby-pg/pull/376)
|
271
308
|
- Make BasicTypeRegistry a class and use a global default instance of it.
|
272
|
-
Now a local type registry can be
|
309
|
+
Now a local type registry can be instantiated and given to the type map, to avoid changing shared global states.
|
273
310
|
- Allow PG::BasicTypeMapForQueries to take a Proc as callback for undefined types.
|
274
311
|
|
275
312
|
Other Enhancements:
|
data/Rakefile
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# -*- rake -*-
|
2
2
|
|
3
|
+
# Enable english error messages, as some specs depend on them
|
4
|
+
ENV["LANG"] = "C"
|
5
|
+
|
3
6
|
require 'rbconfig'
|
4
7
|
require 'pathname'
|
5
8
|
require 'tmpdir'
|
@@ -91,7 +94,7 @@ end
|
|
91
94
|
|
92
95
|
desc "Update list of server error codes"
|
93
96
|
task :update_error_codes do
|
94
|
-
URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=refs/tags/
|
97
|
+
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"
|
95
98
|
|
96
99
|
ERRORCODES_TXT = "ext/errorcodes.txt"
|
97
100
|
sh "wget #{URL_ERRORCODES_TXT.inspect} -O #{ERRORCODES_TXT.inspect} || curl #{URL_ERRORCODES_TXT.inspect} -o #{ERRORCODES_TXT.inspect}"
|
data/Rakefile.cross
CHANGED
@@ -31,8 +31,8 @@ class CrossLibrary < OpenStruct
|
|
31
31
|
self.host_platform = toolchain
|
32
32
|
|
33
33
|
# Cross-compilation constants
|
34
|
-
self.openssl_version = ENV['OPENSSL_VERSION'] || '3.
|
35
|
-
self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '
|
34
|
+
self.openssl_version = ENV['OPENSSL_VERSION'] || '3.3.2'
|
35
|
+
self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '16.4'
|
36
36
|
|
37
37
|
# Check if symlinks work in the current working directory.
|
38
38
|
# This fails, if rake-compiler-dock is running on a Windows box.
|
@@ -52,9 +52,8 @@ class CrossLibrary < OpenStruct
|
|
52
52
|
|
53
53
|
# Static OpenSSL build vars
|
54
54
|
self.static_openssl_builddir = static_builddir + "openssl-#{openssl_version}"
|
55
|
-
|
56
55
|
self.openssl_source_uri =
|
57
|
-
URI( "
|
56
|
+
URI( "https://github.com/openssl/openssl/releases/download/openssl-#{openssl_version}/openssl-#{openssl_version}.tar.gz" )
|
58
57
|
self.openssl_tarball = static_sourcesdir + File.basename( openssl_source_uri.path )
|
59
58
|
self.openssl_makefile = static_openssl_builddir + 'Makefile'
|
60
59
|
|
@@ -184,6 +183,7 @@ class CrossLibrary < OpenStruct
|
|
184
183
|
"--host=#{host_platform}",
|
185
184
|
'--with-openssl',
|
186
185
|
'--without-zlib',
|
186
|
+
'--without-icu',
|
187
187
|
]
|
188
188
|
|
189
189
|
chdir( static_postgresql_builddir ) do
|
@@ -290,7 +290,7 @@ CrossLibraries.each do |xlib|
|
|
290
290
|
RakeCompilerDock.sh <<-EOT, platform: platform
|
291
291
|
(cp build/gem/gem-*.pem ~/.gem/ || true) &&
|
292
292
|
bundle install --local &&
|
293
|
-
rake native:#{platform} pkg/#{$gem_spec.full_name}-#{platform}.gem
|
293
|
+
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
|
294
294
|
EOT
|
295
295
|
end
|
296
296
|
desc "Build the windows binary gems"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIDLjCCAhagAwIBAgIBCz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xWOMtWlqIprq8JZXM9AgMBAAGjOTA3MAkG
|
14
|
+
A1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQ4h1tIyvdUWtMI739xMzTR
|
15
|
+
7EfMFzANBgkqhkiG9w0BAQsFAAOCAYEArBmHSfnUyNWf3R1Fx0mMHloWGdcKn2D2
|
16
|
+
BsqTApXU2nADiyppIqRq4b9e7hw342uzadSLkoQcEFOxThLRhAcijoWfQVBcsbV/
|
17
|
+
ZsCY1qlUTIJuSWxaSyS4efUX+N4eMNyPM9oW/sphlWFo0DgI34Y9WB6HDzH+O71y
|
18
|
+
R7PARke3f4kYnRJf5yRQLPDrH9UYt9KlBQm6l7XMtr5EMnQt0EfcmZEi9H4t/vS2
|
19
|
+
haxvpFMdAKo4H46GBYNO96r6b74t++vgQSBTg/AFVwvRZwNSrPPcBfb4xxeEAhRR
|
20
|
+
x+LU7feIH7lZ//3buiyD03gLAEtHXai0Y+/VfuWIpwYJAl2BO/tU7FS/dtbJq9oc
|
21
|
+
dI36Yyzy+BrCM0WT4oCsagePNb97FaNhl4F6sM5JEPT0ZPxRx0i3G4TNNIYziVos
|
22
|
+
5wFER6XhvvLDFAMh/jMg+s7Wd5SbSHgHNSUaUGVtdWkVPOer6oF0aLdZUR3CETkn
|
23
|
+
5nWXZma/BUd3YgYA/Xumc6QQqIS4p7mr
|
24
|
+
-----END CERTIFICATE-----
|
data/ext/errorcodes.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# errcodes.txt
|
3
3
|
# PostgreSQL error codes
|
4
4
|
#
|
5
|
-
# Copyright (c) 2003-
|
5
|
+
# Copyright (c) 2003-2023, PostgreSQL Global Development Group
|
6
6
|
#
|
7
7
|
# This list serves as the basis for generating source files containing error
|
8
8
|
# codes. It is kept in a common format to make sure all these source files have
|
data/ext/extconf.rb
CHANGED
@@ -9,6 +9,8 @@ if ENV['MAINTAINER_MODE']
|
|
9
9
|
' -ggdb' <<
|
10
10
|
' -DDEBUG' <<
|
11
11
|
' -pedantic'
|
12
|
+
$LDFLAGS <<
|
13
|
+
' -ggdb'
|
12
14
|
end
|
13
15
|
|
14
16
|
if pgdir = with_config( 'pg' )
|
@@ -158,6 +160,7 @@ have_func 'timegm'
|
|
158
160
|
have_func 'rb_gc_adjust_memory_usage' # since ruby-2.4
|
159
161
|
have_func 'rb_gc_mark_movable' # since ruby-2.7
|
160
162
|
have_func 'rb_io_wait' # since ruby-3.0
|
163
|
+
have_func 'rb_io_descriptor' # since ruby-3.1
|
161
164
|
|
162
165
|
# unistd.h confilicts with ruby/win32.h when cross compiling for win32 and ruby 1.9.1
|
163
166
|
have_header 'unistd.h'
|
data/ext/pg.c
CHANGED
@@ -543,7 +543,7 @@ Init_pg_ext(void)
|
|
543
543
|
/* Result#result_error_field argument constant
|
544
544
|
*
|
545
545
|
* The SQLSTATE code for the error.
|
546
|
-
* The SQLSTATE code
|
546
|
+
* The SQLSTATE code identifies the type of error that has occurred; it can be used by front-end applications to perform specific operations (such as error handling) in response to a particular database error.
|
547
547
|
* For a list of the possible SQLSTATE codes, see Appendix A.
|
548
548
|
* This field is not localizable, and is always present.
|
549
549
|
*/
|
data/ext/pg_binary_decoder.c
CHANGED
@@ -233,6 +233,8 @@ j2date(int jd, int *year, int *month, int *day)
|
|
233
233
|
*
|
234
234
|
* This is a decoder class for conversion of PostgreSQL binary date
|
235
235
|
* to Ruby Date objects.
|
236
|
+
*
|
237
|
+
* As soon as this class is used, it requires the ruby standard library 'date'.
|
236
238
|
*/
|
237
239
|
static VALUE
|
238
240
|
pg_bin_dec_date(t_pg_coder *conv, const char *val, int len, int tuple, int field, int enc_idx)
|
data/ext/pg_binary_encoder.c
CHANGED
@@ -185,7 +185,7 @@ pg_bin_enc_timestamp(t_pg_coder *this, VALUE value, char *out, VALUE *intermedia
|
|
185
185
|
ts = rb_time_timespec(*intermediate);
|
186
186
|
/* PostgreSQL's timestamp is based on year 2000 and Ruby's time is based on 1970.
|
187
187
|
* Adjust the 30 years difference. */
|
188
|
-
timestamp = (ts.tv_sec - 10957L * 24L * 3600L) * 1000000 + (ts.tv_nsec / 1000);
|
188
|
+
timestamp = ((int64_t)ts.tv_sec - 10957L * 24L * 3600L) * 1000000 + ((int64_t)ts.tv_nsec / 1000);
|
189
189
|
|
190
190
|
if( this->flags & PG_CODER_TIMESTAMP_DB_LOCAL ) {
|
191
191
|
/* send as local time */
|
data/ext/pg_connection.c
CHANGED
@@ -33,8 +33,8 @@ static VALUE pgconn_async_flush(VALUE self);
|
|
33
33
|
#ifdef __GNUC__
|
34
34
|
__attribute__((format(printf, 3, 4)))
|
35
35
|
#endif
|
36
|
-
static void
|
37
|
-
pg_raise_conn_error( VALUE klass, VALUE self, const char *format, ...)
|
36
|
+
NORETURN( static void
|
37
|
+
pg_raise_conn_error( VALUE klass, VALUE self, const char *format, ...))
|
38
38
|
{
|
39
39
|
VALUE msg, error;
|
40
40
|
va_list ap;
|
@@ -264,6 +264,7 @@ pgconn_s_allocate( VALUE klass )
|
|
264
264
|
RB_OBJ_WRITE(self, &this->decoder_for_get_copy_data, Qnil);
|
265
265
|
RB_OBJ_WRITE(self, &this->trace_stream, Qnil);
|
266
266
|
rb_ivar_set(self, rb_intern("@calls_to_put_copy_data"), INT2FIX(0));
|
267
|
+
rb_ivar_set(self, rb_intern("@iopts_for_reset"), Qnil);
|
267
268
|
|
268
269
|
return self;
|
269
270
|
}
|
@@ -515,9 +516,9 @@ static VALUE
|
|
515
516
|
pgconn_connect_poll(VALUE self)
|
516
517
|
{
|
517
518
|
PostgresPollingStatusType status;
|
518
|
-
status = gvl_PQconnectPoll(pg_get_pgconn(self));
|
519
519
|
|
520
520
|
pgconn_close_socket_io(self);
|
521
|
+
status = gvl_PQconnectPoll(pg_get_pgconn(self));
|
521
522
|
|
522
523
|
return INT2FIX((int)status);
|
523
524
|
}
|
@@ -563,6 +564,27 @@ pgconn_sync_reset( VALUE self )
|
|
563
564
|
return self;
|
564
565
|
}
|
565
566
|
|
567
|
+
static VALUE
|
568
|
+
pgconn_reset_start2( VALUE self, VALUE conninfo )
|
569
|
+
{
|
570
|
+
t_pg_connection *this = pg_get_connection( self );
|
571
|
+
|
572
|
+
/* Close old connection */
|
573
|
+
pgconn_close_socket_io( self );
|
574
|
+
PQfinish( this->pgconn );
|
575
|
+
|
576
|
+
/* Start new connection */
|
577
|
+
this->pgconn = gvl_PQconnectStart( StringValueCStr(conninfo) );
|
578
|
+
|
579
|
+
if( this->pgconn == NULL )
|
580
|
+
rb_raise(rb_ePGerror, "PQconnectStart() unable to allocate PGconn structure");
|
581
|
+
|
582
|
+
if ( PQstatus(this->pgconn) == CONNECTION_BAD )
|
583
|
+
pg_raise_conn_error( rb_eConnectionBad, self, "%s", PQerrorMessage(this->pgconn));
|
584
|
+
|
585
|
+
return Qnil;
|
586
|
+
}
|
587
|
+
|
566
588
|
/*
|
567
589
|
* call-seq:
|
568
590
|
* conn.reset_start() -> nil
|
@@ -594,9 +616,9 @@ static VALUE
|
|
594
616
|
pgconn_reset_poll(VALUE self)
|
595
617
|
{
|
596
618
|
PostgresPollingStatusType status;
|
597
|
-
status = gvl_PQresetPoll(pg_get_pgconn(self));
|
598
619
|
|
599
620
|
pgconn_close_socket_io(self);
|
621
|
+
status = gvl_PQresetPoll(pg_get_pgconn(self));
|
600
622
|
|
601
623
|
return INT2FIX((int)status);
|
602
624
|
}
|
@@ -2245,6 +2267,17 @@ pgconn_notifies(VALUE self)
|
|
2245
2267
|
return hash;
|
2246
2268
|
}
|
2247
2269
|
|
2270
|
+
#ifndef HAVE_RB_IO_DESCRIPTOR
|
2271
|
+
static int
|
2272
|
+
rb_io_descriptor(VALUE io)
|
2273
|
+
{
|
2274
|
+
Check_Type(io, T_FILE);
|
2275
|
+
rb_io_t *fptr = RFILE(io)->fptr;
|
2276
|
+
rb_io_check_closed(fptr);
|
2277
|
+
return fptr->fd;
|
2278
|
+
}
|
2279
|
+
#endif
|
2280
|
+
|
2248
2281
|
#if defined(_WIN32)
|
2249
2282
|
|
2250
2283
|
/* We use a specialized implementation of rb_io_wait() on Windows.
|
@@ -2265,7 +2298,6 @@ int rb_w32_wait_events( HANDLE *events, int num, DWORD timeout );
|
|
2265
2298
|
|
2266
2299
|
static VALUE
|
2267
2300
|
pg_rb_thread_io_wait(VALUE io, VALUE events, VALUE timeout) {
|
2268
|
-
rb_io_t *fptr;
|
2269
2301
|
struct timeval ptimeout;
|
2270
2302
|
|
2271
2303
|
struct timeval aborttime={0,0}, currtime, waittime;
|
@@ -2276,7 +2308,6 @@ pg_rb_thread_io_wait(VALUE io, VALUE events, VALUE timeout) {
|
|
2276
2308
|
long w32_events = 0;
|
2277
2309
|
DWORD wait_ret;
|
2278
2310
|
|
2279
|
-
GetOpenFile((io), fptr);
|
2280
2311
|
if( !NIL_P(timeout) ){
|
2281
2312
|
ptimeout.tv_sec = (time_t)(NUM2DBL(timeout));
|
2282
2313
|
ptimeout.tv_usec = (time_t)((NUM2DBL(timeout) - (double)ptimeout.tv_sec) * 1e6);
|
@@ -2290,7 +2321,7 @@ pg_rb_thread_io_wait(VALUE io, VALUE events, VALUE timeout) {
|
|
2290
2321
|
if(rb_events & PG_RUBY_IO_PRIORITY) w32_events |= FD_OOB;
|
2291
2322
|
|
2292
2323
|
for(;;) {
|
2293
|
-
if ( WSAEventSelect(_get_osfhandle(
|
2324
|
+
if ( WSAEventSelect(_get_osfhandle(rb_io_descriptor(io)), hEvent, w32_events) == SOCKET_ERROR ) {
|
2294
2325
|
WSACloseEvent( hEvent );
|
2295
2326
|
rb_raise( rb_eConnectionBad, "WSAEventSelect socket error: %d", WSAGetLastError() );
|
2296
2327
|
}
|
@@ -2333,7 +2364,7 @@ static VALUE
|
|
2333
2364
|
pg_rb_io_wait(VALUE io, VALUE events, VALUE timeout) {
|
2334
2365
|
#if defined(HAVE_RUBY_FIBER_SCHEDULER_H)
|
2335
2366
|
/* We don't support Fiber.scheduler on Windows ruby-3.0 because there is no fast way to check whether a scheduler is active.
|
2336
|
-
*
|
2367
|
+
* Fortunately ruby-3.1 offers a C-API for it.
|
2337
2368
|
*/
|
2338
2369
|
VALUE scheduler = rb_fiber_scheduler_current();
|
2339
2370
|
|
@@ -2363,16 +2394,14 @@ typedef enum {
|
|
2363
2394
|
|
2364
2395
|
static VALUE
|
2365
2396
|
pg_rb_io_wait(VALUE io, VALUE events, VALUE timeout) {
|
2366
|
-
rb_io_t *fptr;
|
2367
2397
|
struct timeval waittime;
|
2368
2398
|
int res;
|
2369
2399
|
|
2370
|
-
GetOpenFile((io), fptr);
|
2371
2400
|
if( !NIL_P(timeout) ){
|
2372
2401
|
waittime.tv_sec = (time_t)(NUM2DBL(timeout));
|
2373
2402
|
waittime.tv_usec = (time_t)((NUM2DBL(timeout) - (double)waittime.tv_sec) * 1e6);
|
2374
2403
|
}
|
2375
|
-
res = rb_wait_for_single_fd(
|
2404
|
+
res = rb_wait_for_single_fd(rb_io_descriptor(io), NUM2UINT(events), NIL_P(timeout) ? NULL : &waittime);
|
2376
2405
|
|
2377
2406
|
return UINT2NUM(res);
|
2378
2407
|
}
|
@@ -3107,7 +3136,9 @@ pgconn_async_get_last_result(VALUE self)
|
|
3107
3136
|
for(;;) {
|
3108
3137
|
int status;
|
3109
3138
|
|
3110
|
-
/*
|
3139
|
+
/* Wait for input before reading each result.
|
3140
|
+
* That way we support the ruby-3.x IO scheduler and don't block other ruby threads.
|
3141
|
+
*/
|
3111
3142
|
wait_socket_readable(self, NULL, get_result_readable);
|
3112
3143
|
|
3113
3144
|
cur = gvl_PQgetResult(conn);
|
@@ -3141,7 +3172,7 @@ pgconn_async_get_last_result(VALUE self)
|
|
3141
3172
|
* Returns:
|
3142
3173
|
* * +nil+ when the connection is already idle
|
3143
3174
|
* * +true+ when some results have been discarded
|
3144
|
-
* * +false+ when a failure
|
3175
|
+
* * +false+ when a failure occurred and the connection was closed
|
3145
3176
|
*
|
3146
3177
|
*/
|
3147
3178
|
static VALUE
|
@@ -4468,6 +4499,7 @@ init_pg_connection(void)
|
|
4468
4499
|
rb_define_method(rb_cPGconn, "finished?", pgconn_finished_p, 0);
|
4469
4500
|
rb_define_method(rb_cPGconn, "sync_reset", pgconn_sync_reset, 0);
|
4470
4501
|
rb_define_method(rb_cPGconn, "reset_start", pgconn_reset_start, 0);
|
4502
|
+
rb_define_private_method(rb_cPGconn, "reset_start2", pgconn_reset_start2, 1);
|
4471
4503
|
rb_define_method(rb_cPGconn, "reset_poll", pgconn_reset_poll, 0);
|
4472
4504
|
rb_define_alias(rb_cPGconn, "close", "finish");
|
4473
4505
|
|