pg 1.3.0.rc3 → 1.3.2
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 +3 -2
- data/.github/workflows/source-gem.yml +3 -2
- data/History.rdoc +36 -3
- data/Rakefile.cross +1 -1
- data/certs/ged.pem +12 -12
- data/certs/larskanis-2022.pem +26 -0
- data/ext/extconf.rb +10 -6
- data/ext/pg_connection.c +100 -2
- data/ext/pg_record_coder.c +1 -1
- data/ext/pg_type_map_all_strings.c +1 -0
- data/ext/pg_type_map_by_column.c +2 -0
- data/lib/pg/connection.rb +4 -3
- data/lib/pg/version.rb +1 -1
- data/lib/pg.rb +7 -5
- data.tar.gz.sig +0 -0
- metadata +28 -27
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a0eaae99ad4fc07def8a363e6e2443ee34cf24074e70308107e76a105c31dc30
|
|
4
|
+
data.tar.gz: 95dc7830051f1a8533d897cb04b396baf619343bfdab2b54b8dae5036dcd9d82
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f986724a80d0d21685197d1933d3fa0a044a163ad05e5128655949a3463bfce733d0f7be1ade9859548aeb809061e16ff52dfee9e737e93c7d2abc12feec1b2a
|
|
7
|
+
data.tar.gz: d2f64554842a7cc6449a010d703684eb4e62b369334fd0dad17382c25826655a3c20fadfef6ea4cd0899aca867b1d9d96d981d9eaed006eea7d80d72ef18136a
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/.appveyor.yml
CHANGED
|
@@ -45,10 +45,10 @@ jobs:
|
|
|
45
45
|
include:
|
|
46
46
|
- ruby: "3.1"
|
|
47
47
|
platform: "x64-mingw-ucrt"
|
|
48
|
-
PGVERSION: 14.
|
|
48
|
+
PGVERSION: 14.2-1-windows-x64
|
|
49
49
|
- ruby: "2.5"
|
|
50
50
|
platform: "x64-mingw32"
|
|
51
|
-
PGVERSION: 10.
|
|
51
|
+
PGVERSION: 10.20-1-windows
|
|
52
52
|
|
|
53
53
|
runs-on: windows-latest
|
|
54
54
|
env:
|
|
@@ -79,6 +79,7 @@ jobs:
|
|
|
79
79
|
echo "PGUSER=$env:USERNAME" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
80
80
|
echo "PGPASSWORD=" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
81
81
|
|
|
82
|
+
- run: gem update --system
|
|
82
83
|
- run: bundle install
|
|
83
84
|
- run: gem install --local pg-*${{ matrix.platform }}.gem --verbose
|
|
84
85
|
- name: Run specs
|
|
@@ -31,7 +31,7 @@ jobs:
|
|
|
31
31
|
include:
|
|
32
32
|
- os: windows
|
|
33
33
|
ruby: "head"
|
|
34
|
-
PGVERSION: 14.
|
|
34
|
+
PGVERSION: 14.2-1-windows-x64
|
|
35
35
|
PGVER: "14"
|
|
36
36
|
- os: windows
|
|
37
37
|
ruby: "2.5"
|
|
@@ -54,7 +54,7 @@ jobs:
|
|
|
54
54
|
PGVER: "14"
|
|
55
55
|
- os: macos
|
|
56
56
|
ruby: "head"
|
|
57
|
-
PGVERSION: 14.
|
|
57
|
+
PGVERSION: 14.2-1-osx
|
|
58
58
|
PGVER: "14"
|
|
59
59
|
|
|
60
60
|
runs-on: ${{ matrix.os }}-latest
|
|
@@ -110,6 +110,7 @@ jobs:
|
|
|
110
110
|
unzip postgresql-$PGVERSION-binaries.zip && \
|
|
111
111
|
echo `pwd`/pgsql/bin >> $GITHUB_PATH
|
|
112
112
|
|
|
113
|
+
- run: gem update --system
|
|
113
114
|
- run: bundle install
|
|
114
115
|
|
|
115
116
|
- run: gem install --local *.gem --verbose
|
data/History.rdoc
CHANGED
|
@@ -1,4 +1,33 @@
|
|
|
1
|
-
== v1.3.
|
|
1
|
+
== v1.3.2 [2022-02-14] Lars Kanis <lars@greiz-reinsdorf.de>
|
|
2
|
+
|
|
3
|
+
Bugfixes:
|
|
4
|
+
|
|
5
|
+
- Cancel only active query after failing transaction. #430
|
|
6
|
+
This avoids an incompatibility with pgbouncer since pg-1.3.0.
|
|
7
|
+
- Fix String objects with non-applied encoding when using COPY or record decoders. #427
|
|
8
|
+
- Update Windows fat binary gem to PostgreSQL-14.2.
|
|
9
|
+
|
|
10
|
+
Enhancements:
|
|
11
|
+
|
|
12
|
+
- Improve extconf.rb checks to reduces the number of compiler calls.
|
|
13
|
+
- Add a check for PGRES_PIPELINE_SYNC, to make sure the library version and the header files are PostgreSQL-14+. #429
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
== v1.3.1 [2022-02-01] Michael Granger <ged@FaerieMUD.org>
|
|
17
|
+
|
|
18
|
+
Bugfixes:
|
|
19
|
+
|
|
20
|
+
- Fix wrong handling of socket writability on Windows introduced in #417.
|
|
21
|
+
This caused starvation in conn.put_copy_data.
|
|
22
|
+
- Fix error in PG.version_string(true). #419
|
|
23
|
+
- Fix a regression in pg 1.3.0 where Ruby 2.x busy-looping any fractional seconds for every wait. #420
|
|
24
|
+
|
|
25
|
+
Enhancements:
|
|
26
|
+
|
|
27
|
+
- Raise an error when conn.copy_data is used in nonblocking mode.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
== v1.3.0 [2022-01-20] Michael Granger <ged@FaerieMUD.org>
|
|
2
31
|
|
|
3
32
|
Install Enhancements:
|
|
4
33
|
- Print some install help if libpq wasn't found. #396
|
|
@@ -27,6 +56,8 @@ API Enhancements:
|
|
|
27
56
|
- Make discard_results scheduler friendly
|
|
28
57
|
- Do all socket waiting through the conn.socket_io object.
|
|
29
58
|
- Avoid PG.connect blocking while address resolution by automatically providing the +hostaddr+ parameter.
|
|
59
|
+
- On Windows Fiber.scheduler support requires Ruby-3.1+.
|
|
60
|
+
It is also only partly usable since may ruby IO methods are not yet scheduler aware on Windows.
|
|
30
61
|
- Add support for pipeline mode of PostgreSQL-14. #401
|
|
31
62
|
- Allow specification of multiple hosts in PostgreSQL URI. #387
|
|
32
63
|
- Add new method conn.backend_key - used to implement our own cancel method.
|
|
@@ -46,8 +77,9 @@ Other Enhancements:
|
|
|
46
77
|
- Add PG::CONNECTION_* constants for conn.status of newer PostgreSQL versions.
|
|
47
78
|
- Add better support for logical replication. #339
|
|
48
79
|
- Change conn.socket_io to read+write mode and to a BasicSocket object instead of IO.
|
|
49
|
-
- Use rb_io_wait() and the conn.socket_io object if available
|
|
50
|
-
Fall back to rb_wait_for_single_fd() on ruby < 3.0
|
|
80
|
+
- Use rb_io_wait() and the conn.socket_io object if available for better compatibility to Fiber.scheduler .
|
|
81
|
+
Fall back to rb_wait_for_single_fd() on ruby < 3.0.
|
|
82
|
+
- On Windows use a specialized wait function as a workaround for very poor performance of rb_io_wait(). #416
|
|
51
83
|
|
|
52
84
|
Bugfixes:
|
|
53
85
|
- Release GVL while calling PQping which is a blocking method, but it didn't release GVL so far.
|
|
@@ -62,6 +94,7 @@ Deprecated:
|
|
|
62
94
|
Removed:
|
|
63
95
|
- Remove support of ruby-2.2, 2.3 and 2.4. Minimum is ruby-2.5 now.
|
|
64
96
|
- Remove support for PostgreSQL-9.2. Minimum is PostgreSQL-9.3 now.
|
|
97
|
+
- Remove constant PG::REVISION, which was broken since pg-1.1.4.
|
|
65
98
|
|
|
66
99
|
Repository:
|
|
67
100
|
- Replace Hoe by Bundler for gem packaging
|
data/Rakefile.cross
CHANGED
|
@@ -30,7 +30,7 @@ class CrossLibrary < OpenStruct
|
|
|
30
30
|
|
|
31
31
|
# Cross-compilation constants
|
|
32
32
|
self.openssl_version = ENV['OPENSSL_VERSION'] || '1.1.1m'
|
|
33
|
-
self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '14.
|
|
33
|
+
self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '14.2'
|
|
34
34
|
|
|
35
35
|
# Check if symlinks work in the current working directory.
|
|
36
36
|
# This fails, if rake-compiler-dock is running on a Windows box.
|
data/certs/ged.pem
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
|
2
|
-
MIID+
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
MIID+DCCAmCgAwIBAgIBBDANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQDDBdnZWQv
|
|
3
|
+
REM9RmFlcmllTVVEL0RDPW9yZzAeFw0yMjAxMDcyMzU4MTRaFw0yMzAxMDcyMzU4
|
|
4
|
+
MTRaMCIxIDAeBgNVBAMMF2dlZC9EQz1GYWVyaWVNVUQvREM9b3JnMIIBojANBgkq
|
|
5
5
|
hkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAvyVhkRzvlEs0fe7145BYLfN6njX9ih5H
|
|
6
6
|
L60U0p0euIurpv84op9CNKF9tx+1WKwyQvQP7qFGuZxkSUuWcP/sFhDXL1lWUuIl
|
|
7
7
|
M4uHbGCRmOshDrF4dgnBeOvkHr1fIhPlJm5FO+Vew8tSQmlDsosxLUx+VB7DrVFO
|
|
@@ -12,13 +12,13 @@ dXzdHqq+zbGZVSQ7pRYHYomD0IiDe1DbIouFnPWmagaBnGHwXkDT2bKKP+s2v21m
|
|
|
12
12
|
ozilJg4aar2okb/RA6VS87o+d7g6LpDDMMQjH4G9OPnJENLdhu8KnPw/ivSVvQw7
|
|
13
13
|
N2I4L/ZOIe2DIVuYH7aLHfjZDQv/mNgpAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYD
|
|
14
14
|
VR0PBAQDAgSwMB0GA1UdDgQWBBRyjf55EbrHagiRLqt5YAd3yb8k4DANBgkqhkiG
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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gHbXE
|
|
21
|
+
vq1zOTLMSYAS0UB3uionR4yo1hLz60odwkCm7qf0o2Ci/5OjtB0a89VuyqRU2vUJ
|
|
22
|
+
QH95WBjDJ6lCCW7J0mrMPnJQSUFTmufsU6jOChvPaCeAzW1YwrsP/YKnvwueG7ip
|
|
23
|
+
VOdW6RitjtFxhS7evRL0201+KUvLz12zZWWjOcujlQs64QprxOtiv/MiisKb1Ng+
|
|
24
|
+
oL1mUdzB8KrZL4/WbG5YNX6UTtJbIOu9qEFbBAy4/jtIkJX+dlNoFwd4GXQW1YNO
|
|
25
|
+
nA==
|
|
26
|
+
-----END CERTIFICATE-----
|
data/ext/extconf.rb
CHANGED
|
@@ -138,15 +138,18 @@ if /mingw/ =~ RUBY_PLATFORM && RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/
|
|
|
138
138
|
end
|
|
139
139
|
end
|
|
140
140
|
|
|
141
|
-
have_func 'PQconninfo' or
|
|
141
|
+
have_func 'PQconninfo', 'libpq-fe.h' or
|
|
142
142
|
abort "Your PostgreSQL is too old. Either install an older version " +
|
|
143
143
|
"of this gem or upgrade your database to at least PostgreSQL-9.3."
|
|
144
144
|
# optional headers/functions
|
|
145
|
-
have_func 'PQsslAttribute' # since PostgreSQL-9.5
|
|
146
|
-
have_func 'PQresultVerboseErrorMessage' # since PostgreSQL-9.6
|
|
147
|
-
have_func 'PQencryptPasswordConn' # since PostgreSQL-10
|
|
148
|
-
have_func 'PQresultMemorySize' # since PostgreSQL-12
|
|
149
|
-
have_func 'PQenterPipelineMode' # since PostgreSQL-14
|
|
145
|
+
have_func 'PQsslAttribute', 'libpq-fe.h' # since PostgreSQL-9.5
|
|
146
|
+
have_func 'PQresultVerboseErrorMessage', 'libpq-fe.h' # since PostgreSQL-9.6
|
|
147
|
+
have_func 'PQencryptPasswordConn', 'libpq-fe.h' # since PostgreSQL-10
|
|
148
|
+
have_func 'PQresultMemorySize', 'libpq-fe.h' # since PostgreSQL-12
|
|
149
|
+
have_func 'PQenterPipelineMode', 'libpq-fe.h' do |src| # since PostgreSQL-14
|
|
150
|
+
# Ensure header files fit as well
|
|
151
|
+
src + " int con(){ return PGRES_PIPELINE_SYNC; }"
|
|
152
|
+
end
|
|
150
153
|
have_func 'timegm'
|
|
151
154
|
have_func 'rb_gc_adjust_memory_usage' # since ruby-2.4
|
|
152
155
|
have_func 'rb_gc_mark_movable' # since ruby-2.7
|
|
@@ -155,6 +158,7 @@ have_func 'rb_io_wait' # since ruby-3.0
|
|
|
155
158
|
# unistd.h confilicts with ruby/win32.h when cross compiling for win32 and ruby 1.9.1
|
|
156
159
|
have_header 'unistd.h'
|
|
157
160
|
have_header 'inttypes.h'
|
|
161
|
+
have_header('ruby/fiber/scheduler.h') if RUBY_PLATFORM=~/mingw|mswin/
|
|
158
162
|
|
|
159
163
|
checking_for "C99 variable length arrays" do
|
|
160
164
|
$defs.push( "-DHAVE_VARIABLE_LENGTH_ARRAYS" ) if try_compile('void test_vla(int l){ int vla[l]; }')
|
data/ext/pg_connection.c
CHANGED
|
@@ -2207,8 +2207,106 @@ pgconn_notifies(VALUE self)
|
|
|
2207
2207
|
return hash;
|
|
2208
2208
|
}
|
|
2209
2209
|
|
|
2210
|
+
#if defined(_WIN32)
|
|
2211
|
+
|
|
2212
|
+
/* We use a specialized implementation of rb_io_wait() on Windows.
|
|
2213
|
+
* This is because rb_io_wait() and rb_wait_for_single_fd() are very slow on Windows.
|
|
2214
|
+
*/
|
|
2215
|
+
|
|
2216
|
+
#if defined(HAVE_RUBY_FIBER_SCHEDULER_H)
|
|
2217
|
+
#include <ruby/fiber/scheduler.h>
|
|
2218
|
+
#endif
|
|
2219
|
+
|
|
2220
|
+
typedef enum {
|
|
2221
|
+
PG_RUBY_IO_READABLE = RB_WAITFD_IN,
|
|
2222
|
+
PG_RUBY_IO_WRITABLE = RB_WAITFD_OUT,
|
|
2223
|
+
PG_RUBY_IO_PRIORITY = RB_WAITFD_PRI,
|
|
2224
|
+
} pg_rb_io_event_t;
|
|
2225
|
+
|
|
2226
|
+
int rb_w32_wait_events( HANDLE *events, int num, DWORD timeout );
|
|
2227
|
+
|
|
2228
|
+
static VALUE
|
|
2229
|
+
pg_rb_thread_io_wait(VALUE io, VALUE events, VALUE timeout) {
|
|
2230
|
+
rb_io_t *fptr;
|
|
2231
|
+
struct timeval ptimeout;
|
|
2232
|
+
|
|
2233
|
+
struct timeval aborttime={0,0}, currtime, waittime;
|
|
2234
|
+
DWORD timeout_milisec = INFINITE;
|
|
2235
|
+
HANDLE hEvent = WSACreateEvent();
|
|
2236
|
+
|
|
2237
|
+
long rb_events = NUM2UINT(events);
|
|
2238
|
+
long w32_events = 0;
|
|
2239
|
+
DWORD wait_ret;
|
|
2240
|
+
|
|
2241
|
+
GetOpenFile((io), fptr);
|
|
2242
|
+
if( !NIL_P(timeout) ){
|
|
2243
|
+
ptimeout.tv_sec = (time_t)(NUM2DBL(timeout));
|
|
2244
|
+
ptimeout.tv_usec = (time_t)((NUM2DBL(timeout) - (double)ptimeout.tv_sec) * 1e6);
|
|
2245
|
+
|
|
2246
|
+
gettimeofday(&currtime, NULL);
|
|
2247
|
+
timeradd(&currtime, &ptimeout, &aborttime);
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
if(rb_events & PG_RUBY_IO_READABLE) w32_events |= FD_READ | FD_ACCEPT | FD_CLOSE;
|
|
2251
|
+
if(rb_events & PG_RUBY_IO_WRITABLE) w32_events |= FD_WRITE | FD_CONNECT;
|
|
2252
|
+
if(rb_events & PG_RUBY_IO_PRIORITY) w32_events |= FD_OOB;
|
|
2253
|
+
|
|
2254
|
+
for(;;) {
|
|
2255
|
+
if ( WSAEventSelect(_get_osfhandle(fptr->fd), hEvent, w32_events) == SOCKET_ERROR ) {
|
|
2256
|
+
WSACloseEvent( hEvent );
|
|
2257
|
+
rb_raise( rb_eConnectionBad, "WSAEventSelect socket error: %d", WSAGetLastError() );
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
if ( !NIL_P(timeout) ) {
|
|
2261
|
+
gettimeofday(&currtime, NULL);
|
|
2262
|
+
timersub(&aborttime, &currtime, &waittime);
|
|
2263
|
+
timeout_milisec = (DWORD)( waittime.tv_sec * 1e3 + waittime.tv_usec / 1e3 );
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
if( NIL_P(timeout) || (waittime.tv_sec >= 0 && waittime.tv_usec >= 0) ){
|
|
2267
|
+
/* Wait for the socket to become readable before checking again */
|
|
2268
|
+
wait_ret = rb_w32_wait_events( &hEvent, 1, timeout_milisec );
|
|
2269
|
+
} else {
|
|
2270
|
+
wait_ret = WAIT_TIMEOUT;
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
if ( wait_ret == WAIT_TIMEOUT ) {
|
|
2274
|
+
WSACloseEvent( hEvent );
|
|
2275
|
+
return UINT2NUM(0);
|
|
2276
|
+
} else if ( wait_ret == WAIT_OBJECT_0 ) {
|
|
2277
|
+
WSACloseEvent( hEvent );
|
|
2278
|
+
/* The event we were waiting for. */
|
|
2279
|
+
return UINT2NUM(rb_events);
|
|
2280
|
+
} else if ( wait_ret == WAIT_OBJECT_0 + 1) {
|
|
2281
|
+
/* This indicates interruption from timer thread, GC, exception
|
|
2282
|
+
* from other threads etc... */
|
|
2283
|
+
rb_thread_check_ints();
|
|
2284
|
+
} else if ( wait_ret == WAIT_FAILED ) {
|
|
2285
|
+
WSACloseEvent( hEvent );
|
|
2286
|
+
rb_raise( rb_eConnectionBad, "Wait on socket error (WaitForMultipleObjects): %lu", GetLastError() );
|
|
2287
|
+
} else {
|
|
2288
|
+
WSACloseEvent( hEvent );
|
|
2289
|
+
rb_raise( rb_eConnectionBad, "Wait on socket abandoned (WaitForMultipleObjects)" );
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
static VALUE
|
|
2295
|
+
pg_rb_io_wait(VALUE io, VALUE events, VALUE timeout) {
|
|
2296
|
+
#if defined(HAVE_RUBY_FIBER_SCHEDULER_H)
|
|
2297
|
+
/* We don't support Fiber.scheduler on Windows ruby-3.0 because there is no fast way to check whether a scheduler is active.
|
|
2298
|
+
* Fortunatelly ruby-3.1 offers a C-API for it.
|
|
2299
|
+
*/
|
|
2300
|
+
VALUE scheduler = rb_fiber_scheduler_current();
|
|
2301
|
+
|
|
2302
|
+
if (!NIL_P(scheduler)) {
|
|
2303
|
+
return rb_io_wait(io, events, timeout);
|
|
2304
|
+
}
|
|
2305
|
+
#endif
|
|
2306
|
+
return pg_rb_thread_io_wait(io, events, timeout);
|
|
2307
|
+
}
|
|
2210
2308
|
|
|
2211
|
-
#
|
|
2309
|
+
#elif defined(HAVE_RB_IO_WAIT)
|
|
2212
2310
|
|
|
2213
2311
|
/* Use our own function and constants names, to avoid conflicts with truffleruby-head on its road to ruby-3.0 compatibility. */
|
|
2214
2312
|
#define pg_rb_io_wait rb_io_wait
|
|
@@ -2234,7 +2332,7 @@ pg_rb_io_wait(VALUE io, VALUE events, VALUE timeout) {
|
|
|
2234
2332
|
GetOpenFile((io), fptr);
|
|
2235
2333
|
if( !NIL_P(timeout) ){
|
|
2236
2334
|
waittime.tv_sec = (time_t)(NUM2DBL(timeout));
|
|
2237
|
-
waittime.tv_usec = (time_t)(NUM2DBL(timeout) - (double)waittime.tv_sec);
|
|
2335
|
+
waittime.tv_usec = (time_t)((NUM2DBL(timeout) - (double)waittime.tv_sec) * 1e6);
|
|
2238
2336
|
}
|
|
2239
2337
|
res = rb_wait_for_single_fd(fptr->fd, NUM2UINT(events), NIL_P(timeout) ? NULL : &waittime);
|
|
2240
2338
|
|
data/ext/pg_record_coder.c
CHANGED
|
@@ -134,7 +134,7 @@ pg_recordcoder_type_map_get(VALUE self)
|
|
|
134
134
|
* tm = PG::TypeMapByColumn.new([PG::TextEncoder::Float.new]*2)
|
|
135
135
|
* # Use this type map to encode the record:
|
|
136
136
|
* PG::TextEncoder::Record.new(type_map: tm).encode([1,2])
|
|
137
|
-
* # => "(\"1.
|
|
137
|
+
* # => "(\"1.0\",\"2.0\")"
|
|
138
138
|
*
|
|
139
139
|
* Records can also be encoded and decoded directly to and from the database.
|
|
140
140
|
* This avoids intermediate string allocations and is very fast.
|
|
@@ -76,6 +76,7 @@ pg_tmas_fit_to_copy_get( VALUE self )
|
|
|
76
76
|
static VALUE
|
|
77
77
|
pg_tmas_typecast_copy_get( t_typemap *p_typemap, VALUE field_str, int fieldno, int format, int enc_idx )
|
|
78
78
|
{
|
|
79
|
+
rb_str_modify(field_str);
|
|
79
80
|
if( format == 0 ){
|
|
80
81
|
PG_ENCODING_SET_NOCHECK( field_str, enc_idx );
|
|
81
82
|
} else {
|
data/ext/pg_type_map_by_column.c
CHANGED
|
@@ -150,10 +150,12 @@ pg_tmbc_typecast_copy_get( t_typemap *p_typemap, VALUE field_str, int fieldno, i
|
|
|
150
150
|
|
|
151
151
|
/* Is it a pure String conversion? Then we can directly send field_str to the user. */
|
|
152
152
|
if( dec_func == pg_text_dec_string ){
|
|
153
|
+
rb_str_modify(field_str);
|
|
153
154
|
PG_ENCODING_SET_NOCHECK( field_str, enc_idx );
|
|
154
155
|
return field_str;
|
|
155
156
|
}
|
|
156
157
|
if( dec_func == pg_bin_dec_bytea ){
|
|
158
|
+
rb_str_modify(field_str);
|
|
157
159
|
PG_ENCODING_SET_NOCHECK( field_str, rb_ascii8bit_encindex() );
|
|
158
160
|
return field_str;
|
|
159
161
|
}
|
data/lib/pg/connection.rb
CHANGED
|
@@ -7,7 +7,7 @@ require 'io/wait'
|
|
|
7
7
|
require 'socket'
|
|
8
8
|
|
|
9
9
|
# The PostgreSQL connection class. The interface for this class is based on
|
|
10
|
-
# {libpq}[http://www.postgresql.org/docs/
|
|
10
|
+
# {libpq}[http://www.postgresql.org/docs/current/libpq.html], the C
|
|
11
11
|
# application programmer's interface to PostgreSQL. Some familiarity with libpq
|
|
12
12
|
# is recommended, but not necessary.
|
|
13
13
|
#
|
|
@@ -241,6 +241,7 @@ class PG::Connection
|
|
|
241
241
|
# ["more", "data", "to", "copy"]
|
|
242
242
|
|
|
243
243
|
def copy_data( sql, coder=nil )
|
|
244
|
+
raise PG::NotInBlockingMode, "copy_data can not be used in nonblocking mode" if nonblocking?
|
|
244
245
|
res = exec( sql )
|
|
245
246
|
|
|
246
247
|
case res.result_status
|
|
@@ -312,7 +313,7 @@ class PG::Connection
|
|
|
312
313
|
exec "BEGIN"
|
|
313
314
|
res = yield(self)
|
|
314
315
|
rescue Exception
|
|
315
|
-
cancel if transaction_status
|
|
316
|
+
cancel if transaction_status == PG::PQTRANS_ACTIVE
|
|
316
317
|
block
|
|
317
318
|
exec "ROLLBACK"
|
|
318
319
|
raise
|
|
@@ -385,7 +386,7 @@ class PG::Connection
|
|
|
385
386
|
# If the optional code block is given, it will be passed <i>result</i> as an argument,
|
|
386
387
|
# and the PG::Result object will automatically be cleared when the block terminates.
|
|
387
388
|
# In this instance, <code>conn.exec</code> returns the value of the block.
|
|
388
|
-
def get_result
|
|
389
|
+
def get_result
|
|
389
390
|
block
|
|
390
391
|
sync_get_result
|
|
391
392
|
end
|
data/lib/pg/version.rb
CHANGED
data/lib/pg.rb
CHANGED
|
@@ -53,12 +53,14 @@ module PG
|
|
|
53
53
|
|
|
54
54
|
class NotAllCopyDataRetrieved < PG::Error
|
|
55
55
|
end
|
|
56
|
+
class NotInBlockingMode < PG::Error
|
|
57
|
+
end
|
|
56
58
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return
|
|
59
|
+
# Get the PG library version.
|
|
60
|
+
#
|
|
61
|
+
# +include_buildnum+ is no longer used and any value passed will be ignored.
|
|
62
|
+
def self::version_string( include_buildnum=nil )
|
|
63
|
+
return "%s %s" % [ self.name, VERSION ]
|
|
62
64
|
end
|
|
63
65
|
|
|
64
66
|
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pg
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Granger
|
|
@@ -12,31 +12,31 @@ cert_chain:
|
|
|
12
12
|
- |
|
|
13
13
|
-----BEGIN CERTIFICATE-----
|
|
14
14
|
MIIETTCCArWgAwIBAgIBATANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0yMjAyMTQxMzMwNTZaFw0yMzAy
|
|
16
|
+
MTQxMzMwNTZaMCgxJjAkBgNVBAMMHWxhcnMvREM9Z3JlaXotcmVpbnNkb3JmL0RD
|
|
17
|
+
PWRlMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAwum6Y1KznfpzXOT/
|
|
18
|
+
mZgJTBbxZuuZF49Fq3K0WA67YBzNlDv95qzSp7V/7Ek3NCcnT7G+2kSuhNo1FhdN
|
|
19
|
+
eSDO/moYebZNAcu3iqLsuzuULXPLuoU0GsMnVMqV9DZPh7cQHE5EBZ7hlzDBK7k/
|
|
20
|
+
8nBMvR0mHo77kIkapHc26UzVq/G0nKLfDsIHXVylto3PjzOumjG6GhmFN4r3cP6e
|
|
21
|
+
SDfl1FSeRYVpt4kmQULz/zdSaOH3AjAq7PM2Z91iGwQvoUXMANH2v89OWjQO/NHe
|
|
22
|
+
JMNDFsmHK/6Ji4Kk48Z3TyscHQnipAID5GhS1oD21/WePdj7GhmbF5gBzkV5uepd
|
|
23
|
+
eJQPgWGwrQW/Z2oPjRuJrRofzWfrMWqbOahj9uth6WSxhN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y4/jtIkJX+dlNoFwd4GXQW1YNO
|
|
37
|
+
nA==
|
|
38
38
|
-----END CERTIFICATE-----
|
|
39
|
-
date: 2022-
|
|
39
|
+
date: 2022-02-14 00:00:00.000000000 Z
|
|
40
40
|
dependencies: []
|
|
41
41
|
description: Pg is the Ruby interface to the PostgreSQL RDBMS. It works with PostgreSQL
|
|
42
42
|
9.3 and later.
|
|
@@ -74,6 +74,7 @@ files:
|
|
|
74
74
|
- Rakefile
|
|
75
75
|
- Rakefile.cross
|
|
76
76
|
- certs/ged.pem
|
|
77
|
+
- certs/larskanis-2022.pem
|
|
77
78
|
- ext/errorcodes.def
|
|
78
79
|
- ext/errorcodes.rb
|
|
79
80
|
- ext/errorcodes.txt
|
|
@@ -173,11 +174,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
173
174
|
version: '2.5'
|
|
174
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
176
|
requirements:
|
|
176
|
-
- - "
|
|
177
|
+
- - ">="
|
|
177
178
|
- !ruby/object:Gem::Version
|
|
178
|
-
version:
|
|
179
|
+
version: '0'
|
|
179
180
|
requirements: []
|
|
180
|
-
rubygems_version: 3.2.
|
|
181
|
+
rubygems_version: 3.2.15
|
|
181
182
|
signing_key:
|
|
182
183
|
specification_version: 4
|
|
183
184
|
summary: Pg is the Ruby interface to the PostgreSQL RDBMS
|
metadata.gz.sig
CHANGED
|
Binary file
|