pg 1.5.5-x64-mingw32 → 1.5.6-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2e2941b283b4e9b9b2c680341f2a1d583681eb2c744a59fde717fbbefe28b92
4
- data.tar.gz: d9663ef33ad0501b379cf0d545fa3c992e08fb20e2106a3013701804cbf3a282
3
+ metadata.gz: d8edaa42878fbf42973b532a75cc311ba482fb7850f0e922a6a4c9be093ca8d4
4
+ data.tar.gz: 6414cf328b39c2163347529d7113fc4106a8f633380ed13dccc9dfe41eca5de0
5
5
  SHA512:
6
- metadata.gz: 7b5d19b2289ba605a908c478efc9aac517139e847ff7ba5223689b5f0b48b75d3d7e9cacde4e309d95c36e1edac8cb008a7aed55671f587ed8e5bea2e2421ecc
7
- data.tar.gz: d3de39319127018fab5cbb8234c5e3258f305c9ef05b0c720030b7f6f69b8c5c094488bf582ab018514ecf883a50e60a5de3314fbb511b0717f3fecfdfc96409
6
+ metadata.gz: bdde5b8daa6b351a2196d10f0f9d483c9afecee9c22a359af3e11ee98c7edaa64169bfd129ea513cd435ab4cd93762a6e952de0335aa3c49adc7e11d8a8c8af6
7
+ data.tar.gz: 7f6360b71e278a031263d0c5c97e59ba27cb357721ac702b8184e05133a57c9cc5a568368969ed28d4a79fc6dc57a8dc3f7f5e621d8ef13e5d79913f475fad7d
checksums.yaml.gz.sig CHANGED
Binary file
data/Gemfile CHANGED
@@ -11,4 +11,7 @@ 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
+ # "bigdecimal" is a gem on ruby-3.4+ and it's optional for ruby-pg.
15
+ # Specs should succeed without it, but 4 examples are then excluded.
16
+ # gem "bigdecimal", "~> 3.0"
14
17
  end
data/History.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## v1.5.6 [2024-03-01] Lars Kanis <lars@greiz-reinsdorf.de>
2
+
3
+ - Renew address resolution (DNS) in conn.reset. [#558](https://github.com/ged/ruby-pg/pull/558)
4
+ This is important, if DNS is used for load balancing, etc.
5
+ - Make bigdecimal an optional dependency. [#556](https://github.com/ged/ruby-pg/pull/556)
6
+ It's a gem in ruby-3.4+, so that users shouldn't be forced to use it.
7
+
8
+
1
9
  ## v1.5.5 [2024-02-15] Lars Kanis <lars@greiz-reinsdorf.de>
2
10
 
3
11
  - Explicitly retype timespec fields to int64_t to fix compatibility with 32bit arches. [#547](https://github.com/ged/ruby-pg/pull/547)
@@ -0,0 +1,24 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIEBDCCAmygAwIBAgIBAzANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
3
+ L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0yNDAyMjgxOTMxNDdaFw0yNTAy
4
+ MjcxOTMxNDdaMCgxJjAkBgNVBAMMHWxhcnMvREM9Z3JlaXotcmVpbnNkb3JmL0RD
5
+ PWRlMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAwum6Y1KznfpzXOT/
6
+ mZgJTBbxZuuZF49Fq3K0WA67YBzNlDv95qzSp7V/7Ek3NCcnT7G+2kSuhNo1FhdN
7
+ eSDO/moYebZNAcu3iqLsuzuULXPLuoU0GsMnVMqV9DZPh7cQHE5EBZ7hlzDBK7k/
8
+ 8nBMvR0mHo77kIkapHc26UzVq/G0nKLfDsIHXVylto3PjzOumjG6GhmFN4r3cP6e
9
+ SDfl1FSeRYVpt4kmQULz/zdSaOH3AjAq7PM2Z91iGwQvoUXMANH2v89OWjQO/NHe
10
+ JMNDFsmHK/6Ji4Kk48Z3TyscHQnipAID5GhS1oD21/WePdj7GhmbF5gBzkV5uepd
11
+ eJQPgWGwrQW/Z2oPjRuJrRofzWfrMWqbOahj9uth6WSxhNexUtbjk6P8emmXOJi5
12
+ chQPnWX+N3Gj+jjYxqTFdwT7Mj3pv1VHa+aNUbqSPpvJeDyxRIuo9hvzDaBHb/Cg
13
+ 9qRVcm8a96n4t7y2lrX1oookY6bkBaxWOMtWlqIprq8JZXM9AgMBAAGjOTA3MAkG
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/pg_connection.c CHANGED
@@ -563,6 +563,27 @@ pgconn_sync_reset( VALUE self )
563
563
  return self;
564
564
  }
565
565
 
566
+ static VALUE
567
+ pgconn_reset_start2( VALUE self, VALUE conninfo )
568
+ {
569
+ t_pg_connection *this = pg_get_connection( self );
570
+
571
+ /* Close old connection */
572
+ pgconn_close_socket_io( self );
573
+ PQfinish( this->pgconn );
574
+
575
+ /* Start new connection */
576
+ this->pgconn = gvl_PQconnectStart( StringValueCStr(conninfo) );
577
+
578
+ if( this->pgconn == NULL )
579
+ rb_raise(rb_ePGerror, "PQconnectStart() unable to allocate PGconn structure");
580
+
581
+ if ( PQstatus(this->pgconn) == CONNECTION_BAD )
582
+ pg_raise_conn_error( rb_eConnectionBad, self, "%s", PQerrorMessage(this->pgconn));
583
+
584
+ return Qnil;
585
+ }
586
+
566
587
  /*
567
588
  * call-seq:
568
589
  * conn.reset_start() -> nil
@@ -4468,6 +4489,7 @@ init_pg_connection(void)
4468
4489
  rb_define_method(rb_cPGconn, "finished?", pgconn_finished_p, 0);
4469
4490
  rb_define_method(rb_cPGconn, "sync_reset", pgconn_sync_reset, 0);
4470
4491
  rb_define_method(rb_cPGconn, "reset_start", pgconn_reset_start, 0);
4492
+ rb_define_private_method(rb_cPGconn, "reset_start2", pgconn_reset_start2, 1);
4471
4493
  rb_define_method(rb_cPGconn, "reset_poll", pgconn_reset_poll, 0);
4472
4494
  rb_define_alias(rb_cPGconn, "close", "finish");
4473
4495
 
data/lib/2.5/pg_ext.so CHANGED
Binary file
data/lib/2.6/pg_ext.so CHANGED
Binary file
data/lib/2.7/pg_ext.so CHANGED
Binary file
data/lib/3.0/pg_ext.so CHANGED
Binary file
@@ -166,6 +166,12 @@ class PG::BasicTypeMapForQueries < PG::TypeMapByClass
166
166
  @textarray_encoder
167
167
  end
168
168
 
169
+ begin
170
+ require "bigdecimal"
171
+ has_bigdecimal = true
172
+ rescue LoadError
173
+ end
174
+
169
175
  DEFAULT_TYPE_MAP = PG.make_shareable({
170
176
  TrueClass => [1, 'bool', 'bool'],
171
177
  FalseClass => [1, 'bool', 'bool'],
@@ -173,7 +179,6 @@ class PG::BasicTypeMapForQueries < PG::TypeMapByClass
173
179
  # to unnecessary type conversions on server side.
174
180
  Integer => [0, 'int8'],
175
181
  Float => [0, 'float8'],
176
- BigDecimal => [0, 'numeric'],
177
182
  Time => [0, 'timestamptz'],
178
183
  # We use text format and no type OID for IPAddr, because setting the OID can lead
179
184
  # to unnecessary inet/cidr conversions on the server side.
@@ -181,7 +186,7 @@ class PG::BasicTypeMapForQueries < PG::TypeMapByClass
181
186
  Hash => [0, 'json'],
182
187
  Array => :get_array_type,
183
188
  BinaryData => [1, 'bytea'],
184
- })
189
+ }.merge(has_bigdecimal ? {BigDecimal => [0, 'numeric']} : {}))
185
190
  private_constant :DEFAULT_TYPE_MAP
186
191
 
187
192
  DEFAULT_ARRAY_TYPE_MAP = PG.make_shareable({
@@ -190,9 +195,8 @@ class PG::BasicTypeMapForQueries < PG::TypeMapByClass
190
195
  Integer => [0, '_int8'],
191
196
  String => [0, '_text'],
192
197
  Float => [0, '_float8'],
193
- BigDecimal => [0, '_numeric'],
194
198
  Time => [0, '_timestamptz'],
195
199
  IPAddr => [0, '_inet'],
196
- })
200
+ }.merge(has_bigdecimal ? {BigDecimal => [0, '_numeric']} : {}))
197
201
  private_constant :DEFAULT_ARRAY_TYPE_MAP
198
202
  end
@@ -225,7 +225,11 @@ class PG::BasicTypeRegistry
225
225
  alias_type 0, 'int8', 'int2'
226
226
  alias_type 0, 'oid', 'int2'
227
227
 
228
- register_type 0, 'numeric', PG::TextEncoder::Numeric, PG::TextDecoder::Numeric
228
+ begin
229
+ require "bigdecimal"
230
+ register_type 0, 'numeric', PG::TextEncoder::Numeric, PG::TextDecoder::Numeric
231
+ rescue LoadError
232
+ end
229
233
  register_type 0, 'text', PG::TextEncoder::String, PG::TextDecoder::String
230
234
  alias_type 0, 'varchar', 'text'
231
235
  alias_type 0, 'char', 'text'
data/lib/pg/connection.rb CHANGED
@@ -565,7 +565,12 @@ class PG::Connection
565
565
  # Resets the backend connection. This method closes the
566
566
  # backend connection and tries to re-connect.
567
567
  def reset
568
- reset_start
568
+ iopts = conninfo_hash.compact
569
+ if iopts[:host] && !iopts[:host].empty? && PG.library_version >= 100000
570
+ iopts = self.class.send(:resolve_hosts, iopts)
571
+ end
572
+ conninfo = self.class.parse_connect_args( iopts );
573
+ reset_start2(conninfo)
569
574
  async_connect_or_reset(:reset_poll)
570
575
  self
571
576
  end
@@ -773,6 +778,40 @@ class PG::Connection
773
778
  alias setdb new
774
779
  alias setdblogin new
775
780
 
781
+ # Resolve DNS in Ruby to avoid blocking state while connecting.
782
+ # Multiple comma-separated values are generated, if the hostname resolves to both IPv4 and IPv6 addresses.
783
+ # This requires PostgreSQL-10+, so no DNS resolving is done on earlier versions.
784
+ private def resolve_hosts(iopts)
785
+ ihosts = iopts[:host].split(",", -1)
786
+ iports = iopts[:port].split(",", -1)
787
+ iports = [nil] if iports.size == 0
788
+ iports = iports * ihosts.size if iports.size == 1
789
+ raise PG::ConnectionBad, "could not match #{iports.size} port numbers to #{ihosts.size} hosts" if iports.size != ihosts.size
790
+
791
+ dests = ihosts.each_with_index.flat_map do |mhost, idx|
792
+ unless host_is_named_pipe?(mhost)
793
+ if Fiber.respond_to?(:scheduler) &&
794
+ Fiber.scheduler &&
795
+ RUBY_VERSION < '3.1.'
796
+
797
+ # Use a second thread to avoid blocking of the scheduler.
798
+ # `TCPSocket.gethostbyname` isn't fiber aware before ruby-3.1.
799
+ hostaddrs = Thread.new{ Addrinfo.getaddrinfo(mhost, nil, nil, :STREAM).map(&:ip_address) rescue [''] }.value
800
+ else
801
+ hostaddrs = Addrinfo.getaddrinfo(mhost, nil, nil, :STREAM).map(&:ip_address) rescue ['']
802
+ end
803
+ else
804
+ # No hostname to resolve (UnixSocket)
805
+ hostaddrs = [nil]
806
+ end
807
+ hostaddrs.map { |hostaddr| [hostaddr, mhost, iports[idx]] }
808
+ end
809
+ iopts.merge(
810
+ hostaddr: dests.map{|d| d[0] }.join(","),
811
+ host: dests.map{|d| d[1] }.join(","),
812
+ port: dests.map{|d| d[2] }.join(","))
813
+ end
814
+
776
815
  private def connect_to_hosts(*args)
777
816
  option_string = parse_connect_args(*args)
778
817
  iopts = PG::Connection.conninfo_parse(option_string).each_with_object({}){|h, o| o[h[:keyword].to_sym] = h[:val] if h[:val] }
@@ -782,37 +821,7 @@ class PG::Connection
782
821
  # hostaddr is provided -> no need to resolve hostnames
783
822
 
784
823
  elsif iopts[:host] && !iopts[:host].empty? && PG.library_version >= 100000
785
- # Resolve DNS in Ruby to avoid blocking state while connecting.
786
- # Multiple comma-separated values are generated, if the hostname resolves to both IPv4 and IPv6 addresses.
787
- # This requires PostgreSQL-10+, so no DNS resolving is done on earlier versions.
788
- ihosts = iopts[:host].split(",", -1)
789
- iports = iopts[:port].split(",", -1)
790
- iports = [nil] if iports.size == 0
791
- iports = iports * ihosts.size if iports.size == 1
792
- raise PG::ConnectionBad, "could not match #{iports.size} port numbers to #{ihosts.size} hosts" if iports.size != ihosts.size
793
-
794
- dests = ihosts.each_with_index.flat_map do |mhost, idx|
795
- unless host_is_named_pipe?(mhost)
796
- if Fiber.respond_to?(:scheduler) &&
797
- Fiber.scheduler &&
798
- RUBY_VERSION < '3.1.'
799
-
800
- # Use a second thread to avoid blocking of the scheduler.
801
- # `TCPSocket.gethostbyname` isn't fiber aware before ruby-3.1.
802
- hostaddrs = Thread.new{ Addrinfo.getaddrinfo(mhost, nil, nil, :STREAM).map(&:ip_address) rescue [''] }.value
803
- else
804
- hostaddrs = Addrinfo.getaddrinfo(mhost, nil, nil, :STREAM).map(&:ip_address) rescue ['']
805
- end
806
- else
807
- # No hostname to resolve (UnixSocket)
808
- hostaddrs = [nil]
809
- end
810
- hostaddrs.map { |hostaddr| [hostaddr, mhost, iports[idx]] }
811
- end
812
- iopts.merge!(
813
- hostaddr: dests.map{|d| d[0] }.join(","),
814
- host: dests.map{|d| d[1] }.join(","),
815
- port: dests.map{|d| d[2] }.join(","))
824
+ iopts = resolve_hosts(iopts)
816
825
  else
817
826
  # No host given
818
827
  end
data/lib/pg/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module PG
2
2
  # Library version
3
- VERSION = '1.5.5'
3
+ VERSION = '1.5.6'
4
4
  end
Binary file
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.5.5
4
+ version: 1.5.6
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Michael Granger
@@ -11,26 +11,30 @@ bindir: bin
11
11
  cert_chain:
12
12
  - |
13
13
  -----BEGIN CERTIFICATE-----
14
- MIIDLjCCAhagAwIBAgIBCzANBgkqhkiG9w0BAQsFADA9MQ4wDAYDVQQDDAVrYW5p
15
- czEXMBUGCgmSJomT8ixkARkWB2NvbWNhcmQxEjAQBgoJkiaJk/IsZAEZFgJkZTAe
16
- Fw0yMzA0MjgwOTI0NDhaFw0yNDA0MjcwOTI0NDhaMD0xDjAMBgNVBAMMBWthbmlz
17
- MRcwFQYKCZImiZPyLGQBGRYHY29tY2FyZDESMBAGCgmSJomT8ixkARkWAmRlMIIB
18
- IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApop+rNmg35bzRugZ21VMGqI6
19
- HGzPLO4VHYncWn/xmgPU/ZMcZdfj6MzIaZJ/czXyt4eHpBk1r8QOV3gBXnRXEjVW
20
- 9xi+EdVOkTV2/AVFKThcbTAQGiF/bT1n2M+B1GTybRzMg6hyhOJeGPqIhLfJEpxn
21
- lJi4+ENAVT4MpqHEAGB8yFoPC0GqiOHQsdHxQV3P3c2OZqG+yJey74QtwA2tLcLn
22
- Q53c63+VLGsOjODl1yPn/2ejyq8qWu6ahfTxiIlSar2UbwtaQGBDFdb2CXgEufXT
23
- L7oaPxlmj+Q2oLOfOnInd2Oxop59HoJCQPsg8f921J43NCQGA8VHK6paxIRDLQID
24
- AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUvgTdT7fe
25
- x17ugO3IOsjEJwW7KP4wDQYJKoZIhvcNAQELBQADggEBACAxNXwfMGG7paZjnG/c
26
- smdi/ocW2GmCNtILaSzDZqlD5LoA68MiO7u5vwWyBaDJ6giUB330VJoGRbWMxvxN
27
- JU6Bnwa4yYp9YtF91wYIi7FXwIrCPKd9bk3bf4M5wECdsv+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wQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQ4h1tIyvdUWtMI739xMzTR
27
+ 7EfMFzANBgkqhkiG9w0BAQsFAAOCAYEArBmHSfnUyNWf3R1Fx0mMHloWGdcKn2D2
28
+ BsqTApXU2nADiyppIqRq4b9e7hw342uzadSLkoQcEFOxThLRhAcijoWfQVBcsbV/
29
+ ZsCY1qlUTIJuSWxaSyS4efUX+N4eMNyPM9oW/sphlWFo0DgI34Y9WB6HDzH+O71y
30
+ R7PARke3f4kYnRJf5yRQLPDrH9UYt9KlBQm6l7XMtr5EMnQt0EfcmZEi9H4t/vS2
31
+ haxvpFMdAKo4H46GBYNO96r6b74t++vgQSBTg/AFVwvRZwNSrPPcBfb4xxeEAhRR
32
+ x+LU7feIH7lZ//3buiyD03gLAEtHXai0Y+/VfuWIpwYJAl2BO/tU7FS/dtbJq9oc
33
+ dI36Yyzy+BrCM0WT4oCsagePNb97FaNhl4F6sM5JEPT0ZPxRx0i3G4TNNIYziVos
34
+ 5wFER6XhvvLDFAMh/jMg+s7Wd5SbSHgHNSUaUGVtdWkVPOer6oF0aLdZUR3CETkn
35
+ 5nWXZma/BUd3YgYA/Xumc6QQqIS4p7mr
32
36
  -----END CERTIFICATE-----
33
- date: 2024-02-15 00:00:00.000000000 Z
37
+ date: 2024-03-01 00:00:00.000000000 Z
34
38
  dependencies: []
35
39
  description: Pg is the Ruby interface to the PostgreSQL RDBMS. It works with PostgreSQL
36
40
  9.3 and later.
@@ -125,6 +129,7 @@ files:
125
129
  - certs/kanis@comcard.de.pem
126
130
  - certs/larskanis-2022.pem
127
131
  - certs/larskanis-2023.pem
132
+ - certs/larskanis-2024.pem
128
133
  - ext/errorcodes.def
129
134
  - ext/errorcodes.rb
130
135
  - ext/errorcodes.txt
metadata.gz.sig CHANGED
Binary file