pg 1.5.9 → 1.7.0

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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/{History.md → CHANGELOG.md} +126 -0
  4. data/Gemfile +11 -7
  5. data/README-Windows.rdoc +1 -1
  6. data/README.ja.md +83 -32
  7. data/README.md +79 -29
  8. data/Rakefile +84 -19
  9. data/certs/larskanis-2026.pem +24 -0
  10. data/ext/errorcodes.def +9 -0
  11. data/ext/errorcodes.rb +1 -1
  12. data/ext/errorcodes.txt +8 -1
  13. data/ext/extconf.rb +194 -30
  14. data/ext/gvl_wrappers.c +13 -2
  15. data/ext/gvl_wrappers.h +47 -134
  16. data/ext/pg.c +23 -16
  17. data/ext/pg.h +23 -24
  18. data/ext/pg_binary_decoder.c +157 -3
  19. data/ext/pg_binary_encoder.c +219 -9
  20. data/ext/pg_cancel_connection.c +360 -0
  21. data/ext/pg_coder.c +58 -9
  22. data/ext/pg_connection.c +558 -291
  23. data/ext/pg_copy_coder.c +36 -23
  24. data/ext/pg_record_coder.c +11 -7
  25. data/ext/pg_result.c +144 -76
  26. data/ext/pg_text_decoder.c +7 -7
  27. data/ext/pg_text_encoder.c +29 -11
  28. data/ext/pg_tuple.c +9 -9
  29. data/ext/pg_type_map.c +45 -3
  30. data/ext/pg_type_map_all_strings.c +3 -3
  31. data/ext/pg_type_map_by_class.c +2 -2
  32. data/ext/pg_type_map_by_column.c +4 -3
  33. data/ext/pg_type_map_by_mri_type.c +1 -1
  34. data/ext/pg_type_map_by_oid.c +4 -2
  35. data/ext/pg_type_map_in_ruby.c +2 -2
  36. data/ext/pg_util.c +2 -2
  37. data/ext/pg_util.h +2 -2
  38. data/lib/pg/basic_type_map_based_on_result.rb +5 -0
  39. data/lib/pg/basic_type_map_for_queries.rb +16 -5
  40. data/lib/pg/basic_type_map_for_results.rb +5 -0
  41. data/lib/pg/basic_type_registry.rb +2 -2
  42. data/lib/pg/cancel_connection.rb +53 -0
  43. data/lib/pg/coder.rb +4 -2
  44. data/lib/pg/connection.rb +393 -180
  45. data/lib/pg/text_decoder/date.rb +1 -1
  46. data/lib/pg/text_decoder/json.rb +1 -1
  47. data/lib/pg/text_encoder/date.rb +7 -1
  48. data/lib/pg/text_encoder/json.rb +1 -1
  49. data/lib/pg/version.rb +2 -1
  50. data/lib/pg.rb +156 -130
  51. data/misc/glibc/Dockerfile +20 -0
  52. data/misc/glibc/docker-compose.yml +9 -0
  53. data/misc/glibc/glibc_spec.rb +5 -0
  54. data/misc/yugabyte/Dockerfile +9 -0
  55. data/misc/yugabyte/docker-compose.yml +28 -0
  56. data/misc/yugabyte/pg-test.rb +45 -0
  57. data/pg.gemspec +5 -3
  58. data/ports/patches/krb5/1.22.2/0001-Allow-static-linking-krb5-library.patch +30 -0
  59. data/ports/patches/krb5/1.22.2/0002-unknown-command-line-option-on-clang.patch +12 -0
  60. data/ports/patches/postgresql/18.6/0001-Use-workaround-of-__builtin_setjmp-only-on-MINGW-on-.patch +42 -0
  61. data/rakelib/pg_gem_helper.rb +64 -0
  62. data/sample/async_mixed.rb +1 -1
  63. data.tar.gz.sig +0 -0
  64. metadata +36 -22
  65. metadata.gz.sig +0 -0
  66. data/Manifest.txt +0 -72
  67. data/Rakefile.cross +0 -303
@@ -11,7 +11,7 @@ module PG
11
11
  class Date < SimpleDecoder
12
12
  def decode(string, tuple=nil, field=nil)
13
13
  if string =~ /\A(\d{4})-(\d\d)-(\d\d)\z/
14
- ::Date.new $1.to_i, $2.to_i, $3.to_i
14
+ ::Date.new $1.to_i, $2.to_i, $3.to_i, ::Date::GREGORIAN
15
15
  else
16
16
  string
17
17
  end
@@ -10,7 +10,7 @@ module PG
10
10
  # As soon as this class is used, it requires the ruby standard library 'json'.
11
11
  class JSON < SimpleDecoder
12
12
  def decode(string, tuple=nil, field=nil)
13
- ::JSON.parse(string, quirks_mode: true)
13
+ ::JSON.parse(string)
14
14
  end
15
15
  end
16
16
  end
@@ -6,7 +6,13 @@ module PG
6
6
  # This is a encoder class for conversion of Ruby Date values to PostgreSQL date type.
7
7
  class Date < SimpleEncoder
8
8
  def encode(value)
9
- value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d") : value
9
+ if value.respond_to?(:gregorian?)
10
+ # Only create a new gregorian Date object if necessary
11
+ value = value.gregorian unless value.gregorian?
12
+ value.strftime("%Y-%m-%d")
13
+ else
14
+ value
15
+ end
10
16
  end
11
17
  end
12
18
  end
@@ -10,7 +10,7 @@ module PG
10
10
  # As soon as this class is used, it requires the ruby standard library 'json'.
11
11
  class JSON < SimpleEncoder
12
12
  def encode(value)
13
- ::JSON.generate(value, quirks_mode: true)
13
+ ::JSON.generate(value)
14
14
  end
15
15
  end
16
16
  end
data/lib/pg/version.rb CHANGED
@@ -1,4 +1,5 @@
1
+ # frozen_string_literal: true
1
2
  module PG
2
3
  # Library version
3
- VERSION = '1.5.9'
4
+ VERSION = '1.7.0'
4
5
  end
data/lib/pg.rb CHANGED
@@ -5,135 +5,161 @@
5
5
  # The top-level PG namespace.
6
6
  module PG
7
7
 
8
- # Is this file part of a fat binary gem with bundled libpq?
9
- bundled_libpq_path = File.join(__dir__, RUBY_PLATFORM.gsub(/^i386-/, "x86-"))
10
- if File.exist?(bundled_libpq_path)
11
- POSTGRESQL_LIB_PATH = bundled_libpq_path
12
- else
13
- bundled_libpq_path = nil
14
- # Try to load libpq path as found by extconf.rb
15
- begin
16
- require "pg/postgresql_lib_path"
17
- rescue LoadError
18
- # rake-compiler doesn't use regular "make install", but uses it's own install tasks.
19
- # It therefore doesn't copy pg/postgresql_lib_path.rb in case of "rake compile".
20
- POSTGRESQL_LIB_PATH = false
21
- end
22
- end
23
-
24
- add_dll_path = proc do |path, &block|
25
- if RUBY_PLATFORM =~/(mswin|mingw)/i && path && File.exist?(path)
26
- begin
27
- require 'ruby_installer/runtime'
28
- RubyInstaller::Runtime.add_dll_directory(path, &block)
29
- rescue LoadError
30
- old_path = ENV['PATH']
31
- ENV['PATH'] = "#{path};#{old_path}"
32
- block.call
33
- ENV['PATH'] = old_path
34
- end
35
- else
36
- # No need to set a load path manually - it's set as library rpath.
37
- block.call
38
- end
39
- end
40
-
41
- # Add a load path to the one retrieved from pg_config
42
- add_dll_path.call(POSTGRESQL_LIB_PATH) do
43
- if bundled_libpq_path
44
- # It's a Windows binary gem, try the <major>.<minor> subdirectory
45
- major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
46
- raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
47
- require "#{major_minor}/pg_ext"
48
- else
49
- require 'pg_ext'
50
- end
51
- end
52
-
53
- # Get the PG library version.
54
- #
55
- # +include_buildnum+ is no longer used and any value passed will be ignored.
56
- def self.version_string( include_buildnum=nil )
57
- "%s %s" % [ self.name, VERSION ]
58
- end
59
-
60
-
61
- ### Convenience alias for PG::Connection.new.
62
- def self.connect( *args, &block )
63
- Connection.new( *args, &block )
64
- end
65
-
66
- if defined?(Ractor.make_shareable)
67
- def self.make_shareable(obj)
68
- Ractor.make_shareable(obj)
69
- end
70
- else
71
- def self.make_shareable(obj)
72
- obj.freeze
73
- end
74
- end
75
-
76
- module BinaryDecoder
77
- %i[ TimestampUtc TimestampUtcToLocal TimestampLocal ].each do |klass|
78
- autoload klass, 'pg/binary_decoder/timestamp'
79
- end
80
- autoload :Date, 'pg/binary_decoder/date'
81
- end
82
- module BinaryEncoder
83
- %i[ TimestampUtc TimestampLocal ].each do |klass|
84
- autoload klass, 'pg/binary_encoder/timestamp'
85
- end
86
- end
87
- module TextDecoder
88
- %i[ TimestampUtc TimestampUtcToLocal TimestampLocal TimestampWithoutTimeZone TimestampWithTimeZone ].each do |klass|
89
- autoload klass, 'pg/text_decoder/timestamp'
90
- end
91
- autoload :Date, 'pg/text_decoder/date'
92
- autoload :Inet, 'pg/text_decoder/inet'
93
- autoload :JSON, 'pg/text_decoder/json'
94
- autoload :Numeric, 'pg/text_decoder/numeric'
95
- end
96
- module TextEncoder
97
- %i[ TimestampUtc TimestampWithoutTimeZone TimestampWithTimeZone ].each do |klass|
98
- autoload klass, 'pg/text_encoder/timestamp'
99
- end
100
- autoload :Date, 'pg/text_encoder/date'
101
- autoload :Inet, 'pg/text_encoder/inet'
102
- autoload :JSON, 'pg/text_encoder/json'
103
- autoload :Numeric, 'pg/text_encoder/numeric'
104
- end
105
-
106
- autoload :BasicTypeMapBasedOnResult, 'pg/basic_type_map_based_on_result'
107
- autoload :BasicTypeMapForQueries, 'pg/basic_type_map_for_queries'
108
- autoload :BasicTypeMapForResults, 'pg/basic_type_map_for_results'
109
- autoload :BasicTypeRegistry, 'pg/basic_type_registry'
110
- require 'pg/exceptions'
111
- require 'pg/coder'
112
- require 'pg/type_map_by_column'
113
- require 'pg/connection'
114
- require 'pg/result'
115
- require 'pg/tuple'
116
- autoload :VERSION, 'pg/version'
117
-
118
-
119
- # Avoid "uninitialized constant Truffle::WarningOperations" on Truffleruby up to 22.3.1
120
- if RUBY_ENGINE=="truffleruby" && !defined?(Truffle::WarningOperations)
121
- module TruffleFixWarn
122
- def warn(str, category=nil)
123
- super(str)
124
- end
125
- end
126
- Warning.extend(TruffleFixWarn)
127
- end
128
-
129
- # Ruby-3.4+ prints a warning, if bigdecimal is required but not in the Gemfile.
130
- # But it's a false positive, since we enable bigdecimal depending features only if it's available.
131
- # And most people don't need these features.
132
- def self.require_bigdecimal_without_warning
133
- oldverb, $VERBOSE = $VERBOSE, nil
134
- require "bigdecimal"
135
- ensure
136
- $VERBOSE = oldverb
137
- end
8
+ # Is this file part of a fat binary gem with bundled libpq?
9
+ # This path must be enabled by add_dll_directory on Windows.
10
+ gplat = Gem::Platform.local
11
+ bundled_libpq_path = Dir[File.expand_path("../ports/#{gplat.cpu}-#{gplat.os}*/lib", __dir__)].first
12
+ if bundled_libpq_path
13
+ POSTGRESQL_LIB_PATH = bundled_libpq_path
14
+ else
15
+ # Try to load libpq path as found by extconf.rb
16
+ begin
17
+ require "pg/postgresql_lib_path"
18
+ rescue LoadError
19
+ # rake-compiler doesn't use regular "make install", but uses it's own install tasks.
20
+ # It therefore doesn't copy pg/postgresql_lib_path.rb in case of "rake compile".
21
+ POSTGRESQL_LIB_PATH = false
22
+ end
23
+ end
24
+ POSTGRESQL_LIB_PATH.freeze
25
+
26
+ add_dll_path = proc do |path, &block|
27
+ if RUBY_PLATFORM =~/(mswin|mingw)/i && path
28
+ BUNDLED_LIBPQ_WITH_UNIXSOCKET = false
29
+ begin
30
+ require 'ruby_installer/runtime'
31
+ RubyInstaller::Runtime.add_dll_directory(path, &block)
32
+ rescue LoadError
33
+ old_path = ENV['PATH']
34
+ ENV['PATH'] = "#{path};#{old_path}"
35
+ block.call
36
+ ENV['PATH'] = old_path
37
+ end
38
+ else
39
+ # libpq is found by a relative rpath in the cross compiled extension dll
40
+ # or by the system library loader
41
+ block.call
42
+ BUNDLED_LIBPQ_WITH_UNIXSOCKET = RUBY_PLATFORM=~/linux/i && PG::IS_BINARY_GEM
43
+ end
44
+ end
45
+
46
+ # Add a load path to the one retrieved from pg_config
47
+ add_dll_path.call(POSTGRESQL_LIB_PATH) do
48
+ begin
49
+ # Try the <major>.<minor> subdirectory for fat binary gems
50
+ major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
51
+ raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
52
+ require "#{major_minor}/pg_ext"
53
+ rescue LoadError => error1
54
+ begin
55
+ require 'pg_ext'
56
+ rescue LoadError => error2
57
+ msg = <<~EOT
58
+ pg's C extension failed to load:
59
+ #{error1}
60
+ #{error2}
61
+ EOT
62
+ if msg =~ /GLIBC/
63
+ msg += <<~EOT
64
+
65
+ The GLIBC version of this system seems too old. Please use the source version of pg:
66
+ gem uninstall pg --all
67
+ gem install pg --platform ruby
68
+ or in your Gemfile:
69
+ gem "pg", force_ruby_platform: true
70
+ See also: https://deveiate.org/code/pg/README_md.html#label-Source+gem
71
+ EOT
72
+ end
73
+ raise error2, msg
74
+ end
75
+ end
76
+ end
77
+
78
+ # Get the PG library version.
79
+ #
80
+ # +include_buildnum+ is no longer used and any value passed will be ignored.
81
+ def self.version_string( include_buildnum=nil )
82
+ "%s %s" % [ self.name, VERSION ]
83
+ end
84
+
85
+
86
+ ### Convenience alias for PG::Connection.new.
87
+ def self.connect( *args, &block )
88
+ Connection.new( *args, &block )
89
+ end
90
+
91
+ if defined?(Ractor.make_shareable)
92
+ def self.make_shareable(obj)
93
+ Ractor.make_shareable(obj)
94
+ end
95
+ else
96
+ def self.make_shareable(obj)
97
+ obj.freeze
98
+ end
99
+ end
100
+
101
+ module BinaryDecoder
102
+ %i[ TimestampUtc TimestampUtcToLocal TimestampLocal ].each do |klass|
103
+ autoload klass, 'pg/binary_decoder/timestamp'
104
+ end
105
+ autoload :Date, 'pg/binary_decoder/date'
106
+ end
107
+ module BinaryEncoder
108
+ %i[ TimestampUtc TimestampLocal ].each do |klass|
109
+ autoload klass, 'pg/binary_encoder/timestamp'
110
+ end
111
+ end
112
+ module TextDecoder
113
+ %i[ TimestampUtc TimestampUtcToLocal TimestampLocal TimestampWithoutTimeZone TimestampWithTimeZone ].each do |klass|
114
+ autoload klass, 'pg/text_decoder/timestamp'
115
+ end
116
+ autoload :Date, 'pg/text_decoder/date'
117
+ autoload :Inet, 'pg/text_decoder/inet'
118
+ autoload :JSON, 'pg/text_decoder/json'
119
+ autoload :Numeric, 'pg/text_decoder/numeric'
120
+ end
121
+ module TextEncoder
122
+ %i[ TimestampUtc TimestampWithoutTimeZone TimestampWithTimeZone ].each do |klass|
123
+ autoload klass, 'pg/text_encoder/timestamp'
124
+ end
125
+ autoload :Date, 'pg/text_encoder/date'
126
+ autoload :Inet, 'pg/text_encoder/inet'
127
+ autoload :JSON, 'pg/text_encoder/json'
128
+ autoload :Numeric, 'pg/text_encoder/numeric'
129
+ end
130
+
131
+ autoload :BasicTypeMapBasedOnResult, 'pg/basic_type_map_based_on_result'
132
+ autoload :BasicTypeMapForQueries, 'pg/basic_type_map_for_queries'
133
+ autoload :BasicTypeMapForResults, 'pg/basic_type_map_for_results'
134
+ autoload :BasicTypeRegistry, 'pg/basic_type_registry'
135
+ require 'pg/exceptions'
136
+ require 'pg/coder'
137
+ require 'pg/type_map_by_column'
138
+ require 'pg/connection'
139
+ require 'pg/cancel_connection'
140
+ require 'pg/result'
141
+ require 'pg/tuple'
142
+ autoload :VERSION, 'pg/version'
143
+
144
+
145
+ # Avoid "uninitialized constant Truffle::WarningOperations" on Truffleruby up to 22.3.1
146
+ if RUBY_ENGINE=="truffleruby" && !defined?(Truffle::WarningOperations)
147
+ module TruffleFixWarn
148
+ def warn(str, category=nil)
149
+ super(str)
150
+ end
151
+ end
152
+ Warning.extend(TruffleFixWarn)
153
+ end
154
+
155
+ # Ruby-3.4+ prints a warning, if bigdecimal is required but not in the Gemfile.
156
+ # But it's a false positive, since we enable bigdecimal depending features only if it's available.
157
+ # And most people don't need these features.
158
+ def self.require_bigdecimal_without_warning
159
+ oldverb, $VERBOSE = $VERBOSE, nil
160
+ require "bigdecimal"
161
+ ensure
162
+ $VERBOSE = oldverb
163
+ end
138
164
 
139
165
  end # module PG
@@ -0,0 +1,20 @@
1
+ FROM debian:10.13
2
+
3
+ WORKDIR /pg
4
+
5
+ # Debian 10.13 is EOL now:
6
+ RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
7
+
8
+ RUN apt-get update && apt-get install ruby git wget gcc make libz-dev libffi-dev libreadline-dev libyaml-dev libssl-dev -y
9
+
10
+ ENV RBENV_ROOT=/usr/local/rbenv
11
+
12
+ RUN git clone https://github.com/rbenv/rbenv.git ${RBENV_ROOT} && \
13
+ git clone https://github.com/rbenv/ruby-build.git ${RBENV_ROOT}/plugins/ruby-build && \
14
+ $RBENV_ROOT/bin/rbenv init
15
+
16
+ RUN $RBENV_ROOT/bin/rbenv install 3.3.9 -- --disable-install-doc
17
+ RUN /usr/local/rbenv/versions/3.3.9/bin/gem inst rspec
18
+
19
+ CMD /usr/local/rbenv/versions/3.3.9/bin/gem inst --local pg-*.gem && \
20
+ /usr/local/rbenv/versions/3.3.9/bin/rspec glibc_spec.rb
@@ -0,0 +1,9 @@
1
+ services:
2
+ pg:
3
+ build:
4
+ context: .
5
+ args:
6
+ - http_proxy
7
+ - https_proxy
8
+ volumes:
9
+ - .:/pg
@@ -0,0 +1,5 @@
1
+ RSpec.describe "require 'pg'" do
2
+ it "gives a descriptive error message when GLIBC is too old" do
3
+ expect { require "pg" }.to raise_error(/GLIBC.*gem install pg --platform ruby/m)
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ FROM yugabytedb/yugabyte:2024.1.0.0-b129
2
+
3
+ WORKDIR /app
4
+
5
+ RUN yugabyted cert generate_server_certs --hostnames=127.0.0.1 --base_dir=.
6
+
7
+ ENTRYPOINT ["yugabyted"]
8
+ CMD ["start", "--background", "false", "--ui", "false", "--tserver_flags", "use_client_to_server_encryption=true,cert_node_filename=127.0.0.1,certs_dir=/app/generated_certs/127.0.0.1"]
9
+ VOLUME /app
@@ -0,0 +1,28 @@
1
+ services:
2
+ yb:
3
+ build: .
4
+ container_name: yb
5
+ ports:
6
+ - "127.0.0.1:5433:5433"
7
+ volumes:
8
+ - certs:/app/generated_certs
9
+ healthcheck:
10
+ test: 'ysqlsh -h $$(hostname) -c \\conninfo || exit 1;'
11
+ interval: 2s
12
+ timeout: 30s
13
+ retries: 20
14
+ start_period: 10s
15
+
16
+ pg:
17
+ image: ruby:4.0
18
+ working_dir: /app
19
+ volumes:
20
+ - .:/app
21
+ - certs:/generated_certs
22
+ command: bash -c "gem inst pg-*.gem && ruby pg-test.rb"
23
+ depends_on:
24
+ yb:
25
+ condition: service_healthy
26
+
27
+ volumes:
28
+ certs:
@@ -0,0 +1,45 @@
1
+ require 'pg'
2
+
3
+ conn = PG.connect(
4
+ host: 'yb',
5
+ port: 5433,
6
+ user: 'yugabyte',
7
+ dbname: 'yugabyte',
8
+ sslmode: 'require',
9
+ sslrootcert: 'app/generated_certs/127.0.0.1/ca.crt',
10
+ sslcert: 'app/generated_certs/127.0.0.1/node.127.0.0.1.crt',
11
+ sslkey: 'app/generated_certs/127.0.0.1/node.127.0.0.1.key'
12
+ )
13
+
14
+ $stdout.sync = true
15
+ # fd = File.open("pg_trace.log", "a+")
16
+ # conn.trace(fd)
17
+
18
+ begin
19
+ # Validate connection is working
20
+ res = conn.exec("SELECT version();")
21
+ res.each_row do |row|
22
+ puts "You are connected to: #{row[0]}"
23
+ end
24
+ # 53*511
25
+ # 53*767
26
+ # 53*1023
27
+ # 53*1279
28
+ # 7*1817
29
+ # 11*1487
30
+ # 13*1363
31
+ # 16*1211
32
+ # 18*1128
33
+ # 22*1984
34
+ # 27*1723
35
+
36
+ (22..53).each do |m|
37
+ (1..2048).each do |l|
38
+ hanging_query = "SELECT lpad(''::text, #{m}, '0') FROM generate_series(1, #{l});"
39
+ puts "Executing hanging query: #{hanging_query}"
40
+ conn.exec(hanging_query)
41
+ end
42
+ end
43
+ ensure
44
+ conn.close if conn
45
+ end
data/pg.gemspec CHANGED
@@ -10,15 +10,17 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["ged@FaerieMUD.org", "lars@greiz-reinsdorf.de"]
11
11
 
12
12
  spec.summary = "Pg is the Ruby interface to the PostgreSQL RDBMS"
13
- spec.description = "Pg is the Ruby interface to the PostgreSQL RDBMS. It works with PostgreSQL 9.3 and later."
13
+ spec.description = "Pg is the Ruby interface to the PostgreSQL RDBMS. It works with PostgreSQL 10 and later."
14
14
  spec.homepage = "https://github.com/ged/ruby-pg"
15
15
  spec.license = "BSD-2-Clause"
16
- spec.required_ruby_version = ">= 2.5"
16
+ spec.required_ruby_version = ">= 3.1"
17
17
 
18
18
  spec.metadata["homepage_uri"] = spec.homepage
19
19
  spec.metadata["source_code_uri"] = "https://github.com/ged/ruby-pg"
20
- spec.metadata["changelog_uri"] = "https://github.com/ged/ruby-pg/blob/master/History.md"
20
+ spec.metadata["changelog_uri"] = "https://github.com/ged/ruby-pg/blob/master/CHANGELOG.md"
21
21
  spec.metadata["documentation_uri"] = "http://deveiate.org/code/pg"
22
+ # https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency
23
+ spec.metadata["msys2_mingw_dependencies"] = "postgresql"
22
24
 
23
25
  # Specify which files should be added to the gem when it is released.
24
26
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -0,0 +1,30 @@
1
+ From e82c1b395162ea71279ea2170259383082e41ab0 Mon Sep 17 00:00:00 2001
2
+ From: Lars Kanis <lars@greiz-reinsdorf.de>
3
+ Date: Sat, 12 Jul 2025 10:55:17 +0200
4
+ Subject: [PATCH] Allow static linking krb5 library
5
+
6
+ Otherwise it fails with:
7
+ Undefined symbols for architecture arm64:
8
+ "_krb5int_c_mit_des_zeroblock", referenced from:
9
+ _krb5int_des3_cbc_encrypt in libk5crypto.a(d3_aead.o)
10
+ _krb5int_des3_cbc_decrypt in libk5crypto.a(d3_aead.o)
11
+ ---
12
+ src/lib/crypto/builtin/des/des_int.h | 2 +-
13
+ 1 file changed, 1 insertion(+), 1 deletion(-)
14
+
15
+ diff --git a/src/lib/crypto/builtin/des/des_int.h b/src/lib/crypto/builtin/des/des_int.h
16
+ index 46fed7dbd..114e48ebd 100644
17
+ --- a/lib/crypto/builtin/des/des_int.h
18
+ +++ b/lib/crypto/builtin/des/des_int.h
19
+ @@ -159,7 +159,7 @@ mit_des_cbc_encrypt(const mit_des_cblock *in, mit_des_cblock *out,
20
+ const mit_des_cblock ivec, int enc);
21
+
22
+ #define mit_des_zeroblock krb5int_c_mit_des_zeroblock
23
+ -extern const mit_des_cblock mit_des_zeroblock;
24
+ +const mit_des_cblock mit_des_zeroblock;
25
+
26
+ /* fin_rndkey.c */
27
+ krb5_error_code mit_des_finish_random_key(const krb5_encrypt_block *,
28
+ --
29
+ 2.43.0
30
+
@@ -0,0 +1,12 @@
1
+ diff --git a/src/lib/krb5/krb/deltat.c b/src/lib/krb5/krb/deltat.c
2
+ index 03145c854..34cdf969e 100644
3
+ --- a/lib/krb5/krb/deltat.c
4
+ +++ b/lib/krb5/krb/deltat.c
5
+ @@ -44,7 +44,6 @@
6
+ #ifdef __GNUC__
7
+ #pragma GCC diagnostic push
8
+ #pragma GCC diagnostic ignored "-Wuninitialized"
9
+ -#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
10
+ #endif
11
+
12
+ #include "k5-int.h"
@@ -0,0 +1,42 @@
1
+ From 746e8e250b265c40d9706f26560e02e8623f123f Mon Sep 17 00:00:00 2001
2
+ From: Lars Kanis <lars@greiz-reinsdorf.de>
3
+ Date: Fri, 31 Jan 2025 21:58:00 +0100
4
+ Subject: [PATCH] Use workaround of __builtin_setjmp only on MINGW on MSVCRT
5
+
6
+ Because it is not present on ARM64 on Windows and not necessary on any UCRT based toolchain.
7
+ ---
8
+ src/include/c.h | 10 +++++-----
9
+ 1 file changed, 5 insertions(+), 5 deletions(-)
10
+
11
+ diff --git a/src/include/c.h b/src/include/c.h
12
+ index a14c631516..33792c860c 100644
13
+ --- a/src/include/c.h
14
+ +++ b/src/include/c.h
15
+ @@ -1312,19 +1312,19 @@ extern int fdatasync(int fildes);
16
+ /*
17
+ * When there is no sigsetjmp, its functionality is provided by plain
18
+ * setjmp. We now support the case only on Windows. However, it seems
19
+ - * that MinGW-64 has some longstanding issues in its setjmp support,
20
+ - * so on that toolchain we cheat and use gcc's builtins.
21
+ + * that MinGW-64 on x86_64 has some longstanding issues in its setjmp
22
+ + * support, so on that toolchain we cheat and use gcc's builtins.
23
+ */
24
+ #ifdef WIN32
25
+ -#ifdef __MINGW64__
26
+ +#if defined(__MINGW64__) && !defined(_UCRT)
27
+ typedef intptr_t sigjmp_buf[5];
28
+ #define sigsetjmp(x,y) __builtin_setjmp(x)
29
+ #define siglongjmp __builtin_longjmp
30
+ -#else /* !__MINGW64__ */
31
+ +#else /* !defined(__MINGW64__) || defined(_UCRT) */
32
+ #define sigjmp_buf jmp_buf
33
+ #define sigsetjmp(x,y) setjmp(x)
34
+ #define siglongjmp longjmp
35
+ -#endif /* __MINGW64__ */
36
+ +#endif /* defined(__MINGW64__) && !defined(_UCRT) */
37
+ #endif /* WIN32 */
38
+
39
+ /* /port compatibility functions */
40
+ --
41
+ 2.43.0
42
+
@@ -0,0 +1,64 @@
1
+ require 'bundler'
2
+ require 'bundler/gem_helper'
3
+
4
+ class PgGemHelper < Bundler::GemHelper
5
+ attr_accessor :cross_platforms
6
+
7
+ def install
8
+ super
9
+
10
+ task "release:guard_clean" => ["release:update_history"]
11
+
12
+ task "release:update_history" do
13
+ update_history
14
+ end
15
+
16
+ task "release:rubygem_push" => ["gem:native"]
17
+ end
18
+
19
+ def hfile
20
+ "CHANGELOG.md"
21
+ end
22
+
23
+ def headline
24
+ '^([^\n]*)(\d+\.\d+\.\d+(?:\.\w+)?)([^\w]+)([2Y][0Y][0-9Y][0-9Y]-[0-1M][0-9M]-[0-3D][0-9D])([^\w]*|$)'
25
+ end
26
+
27
+ def reldate
28
+ Time.now.strftime("%Y-%m-%d")
29
+ end
30
+
31
+ def update_history
32
+ hin = File.read(hfile)
33
+ hout = hin.sub(/#{headline}/) do
34
+ raise "#{hfile} isn't up-to-date for version #{version} (!= #{$2})" unless $2==version.to_s
35
+ $1 + $2 + $3 + reldate + $5
36
+ end
37
+ if hout != hin
38
+ Bundler.ui.confirm "Updating #{hfile} for release."
39
+ File.write(hfile, hout)
40
+ Rake::FileUtilsExt.sh "git", "commit", hfile, "-m", "Update release date in #{hfile}"
41
+ end
42
+ end
43
+
44
+ def tag_version
45
+ Bundler.ui.confirm "Tag release with annotation:"
46
+ m = File.read(hfile).match(/(?<annotation>#{headline}.*?)#{headline}/m) || raise("Unable to find release notes in #{hfile}")
47
+ Bundler.ui.info(m[:annotation].gsub(/^/, " "))
48
+ IO.popen(["git", "tag", "--file=-", version_tag], "w") do |fd|
49
+ fd.write m[:annotation]
50
+ end
51
+ yield if block_given?
52
+ rescue
53
+ Bundler.ui.error "Untagging #{version_tag} due to error."
54
+ Rake::FileUtilsExt.sh "git", "tag", "-d", version_tag
55
+ raise
56
+ end
57
+
58
+ def rubygem_push(path)
59
+ cross_platforms.each do |ruby_platform|
60
+ super(path.gsub(/\.gem\z/, "-#{ruby_platform}.gem"))
61
+ end
62
+ super(path)
63
+ end
64
+ end
@@ -5,7 +5,7 @@ require 'pg'
5
5
  $stdout.sync = true
6
6
 
7
7
  # This is a example of how to mix and match synchronous and async APIs. In this case,
8
- # the connection to the server is made syncrhonously, and then queries are
8
+ # the connection to the server is made synchronously, and then queries are
9
9
  # asynchronous.
10
10
 
11
11
  TIMEOUT = 5.0 # seconds to wait for an async operation to complete
data.tar.gz.sig CHANGED
Binary file