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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/{History.md → CHANGELOG.md} +126 -0
- data/Gemfile +11 -7
- data/README-Windows.rdoc +1 -1
- data/README.ja.md +83 -32
- data/README.md +79 -29
- data/Rakefile +84 -19
- data/certs/larskanis-2026.pem +24 -0
- data/ext/errorcodes.def +9 -0
- data/ext/errorcodes.rb +1 -1
- data/ext/errorcodes.txt +8 -1
- data/ext/extconf.rb +194 -30
- data/ext/gvl_wrappers.c +13 -2
- data/ext/gvl_wrappers.h +47 -134
- data/ext/pg.c +23 -16
- data/ext/pg.h +23 -24
- data/ext/pg_binary_decoder.c +157 -3
- data/ext/pg_binary_encoder.c +219 -9
- data/ext/pg_cancel_connection.c +360 -0
- data/ext/pg_coder.c +58 -9
- data/ext/pg_connection.c +558 -291
- data/ext/pg_copy_coder.c +36 -23
- data/ext/pg_record_coder.c +11 -7
- data/ext/pg_result.c +144 -76
- data/ext/pg_text_decoder.c +7 -7
- data/ext/pg_text_encoder.c +29 -11
- data/ext/pg_tuple.c +9 -9
- data/ext/pg_type_map.c +45 -3
- data/ext/pg_type_map_all_strings.c +3 -3
- data/ext/pg_type_map_by_class.c +2 -2
- data/ext/pg_type_map_by_column.c +4 -3
- data/ext/pg_type_map_by_mri_type.c +1 -1
- data/ext/pg_type_map_by_oid.c +4 -2
- data/ext/pg_type_map_in_ruby.c +2 -2
- data/ext/pg_util.c +2 -2
- data/ext/pg_util.h +2 -2
- data/lib/pg/basic_type_map_based_on_result.rb +5 -0
- data/lib/pg/basic_type_map_for_queries.rb +16 -5
- data/lib/pg/basic_type_map_for_results.rb +5 -0
- data/lib/pg/basic_type_registry.rb +2 -2
- data/lib/pg/cancel_connection.rb +53 -0
- data/lib/pg/coder.rb +4 -2
- data/lib/pg/connection.rb +393 -180
- data/lib/pg/text_decoder/date.rb +1 -1
- data/lib/pg/text_decoder/json.rb +1 -1
- data/lib/pg/text_encoder/date.rb +7 -1
- data/lib/pg/text_encoder/json.rb +1 -1
- data/lib/pg/version.rb +2 -1
- data/lib/pg.rb +156 -130
- data/misc/glibc/Dockerfile +20 -0
- data/misc/glibc/docker-compose.yml +9 -0
- data/misc/glibc/glibc_spec.rb +5 -0
- data/misc/yugabyte/Dockerfile +9 -0
- data/misc/yugabyte/docker-compose.yml +28 -0
- data/misc/yugabyte/pg-test.rb +45 -0
- data/pg.gemspec +5 -3
- data/ports/patches/krb5/1.22.2/0001-Allow-static-linking-krb5-library.patch +30 -0
- data/ports/patches/krb5/1.22.2/0002-unknown-command-line-option-on-clang.patch +12 -0
- data/ports/patches/postgresql/18.6/0001-Use-workaround-of-__builtin_setjmp-only-on-MINGW-on-.patch +42 -0
- data/rakelib/pg_gem_helper.rb +64 -0
- data/sample/async_mixed.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +36 -22
- metadata.gz.sig +0 -0
- data/Manifest.txt +0 -72
- data/Rakefile.cross +0 -303
data/lib/pg/text_decoder/date.rb
CHANGED
data/lib/pg/text_decoder/json.rb
CHANGED
data/lib/pg/text_encoder/date.rb
CHANGED
|
@@ -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?(:
|
|
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
|
data/lib/pg/text_encoder/json.rb
CHANGED
data/lib/pg/version.rb
CHANGED
data/lib/pg.rb
CHANGED
|
@@ -5,135 +5,161 @@
|
|
|
5
5
|
# The top-level PG namespace.
|
|
6
6
|
module PG
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
+
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
|
|
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 = ">=
|
|
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/
|
|
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"
|
data/ports/patches/postgresql/18.6/0001-Use-workaround-of-__builtin_setjmp-only-on-MINGW-on-.patch
ADDED
|
@@ -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
|
data/sample/async_mixed.rb
CHANGED
|
@@ -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
|
|
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
|