pg 0.18.4 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/BSDL +2 -2
- data/ChangeLog +689 -5
- data/History.rdoc +56 -0
- data/Manifest.txt +1 -18
- data/README.rdoc +13 -9
- data/Rakefile +15 -17
- data/Rakefile.cross +8 -7
- data/ext/errorcodes.def +25 -0
- data/ext/errorcodes.txt +13 -1
- data/ext/extconf.rb +9 -1
- data/ext/gvl_wrappers.h +4 -0
- data/ext/pg.c +4 -3
- data/ext/pg.h +6 -3
- data/ext/pg_binary_encoder.c +8 -8
- data/ext/pg_coder.c +31 -10
- data/ext/pg_connection.c +252 -98
- data/ext/pg_copy_coder.c +34 -4
- data/ext/pg_result.c +20 -14
- data/ext/pg_text_encoder.c +62 -42
- data/ext/pg_type_map.c +14 -7
- data/lib/pg/basic_type_mapping.rb +35 -8
- data/lib/pg/connection.rb +46 -10
- data/lib/pg/deprecated_constants.rb +21 -0
- data/lib/pg/result.rb +10 -5
- data/lib/pg/text_decoder.rb +7 -0
- data/lib/pg/text_encoder.rb +8 -0
- data/lib/pg.rb +21 -9
- data/spec/helpers.rb +6 -9
- data/spec/pg/basic_type_mapping_spec.rb +54 -0
- data/spec/pg/connection_spec.rb +158 -26
- data/spec/pg/result_spec.rb +11 -4
- data/spec/pg/type_map_by_class_spec.rb +2 -2
- data/spec/pg/type_map_by_mri_type_spec.rb +1 -1
- data/spec/pg/type_spec.rb +82 -2
- data.tar.gz.sig +0 -0
- metadata +50 -64
- metadata.gz.sig +0 -0
- data/sample/array_insert.rb +0 -20
- data/sample/async_api.rb +0 -106
- data/sample/async_copyto.rb +0 -39
- data/sample/async_mixed.rb +0 -56
- data/sample/check_conn.rb +0 -21
- data/sample/copyfrom.rb +0 -81
- data/sample/copyto.rb +0 -19
- data/sample/cursor.rb +0 -21
- data/sample/disk_usage_report.rb +0 -186
- data/sample/issue-119.rb +0 -94
- data/sample/losample.rb +0 -69
- data/sample/minimal-testcase.rb +0 -17
- data/sample/notify_wait.rb +0 -72
- data/sample/pg_statistics.rb +0 -294
- data/sample/replication_monitor.rb +0 -231
- data/sample/test_binary_values.rb +0 -33
- data/sample/wal_shipper.rb +0 -434
- data/sample/warehouse_partitions.rb +0 -320
data/History.rdoc
CHANGED
@@ -1,3 +1,59 @@
|
|
1
|
+
== v0.21.0 [2017-06-12] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
Enhancements:
|
4
|
+
- Move add_dll_directory to the Runtime namespace for newest versions
|
5
|
+
of RubyInstaller.
|
6
|
+
- Deprecate PGconn, PGresult, and PGError top-level constants; a warning
|
7
|
+
will be output the first time one of them is used. They will be
|
8
|
+
removed in the upcoming 1.0 release.
|
9
|
+
|
10
|
+
Documentation fixes:
|
11
|
+
- Update the docs for PG::Result#cmd_tuples
|
12
|
+
|
13
|
+
|
14
|
+
== v0.20.0 [2017-03-10] Michael Granger <ged@FaerieMUD.org>
|
15
|
+
|
16
|
+
Enhancements:
|
17
|
+
- Update error codes to PostgreSQL-9.6
|
18
|
+
- Update Windows binary gems to Ruby-2.4, PostgreSQL 9.6.1 and
|
19
|
+
OpenSSL 1.0.2j.
|
20
|
+
- Add support for RubyInstaller2 to Windows binary gems.
|
21
|
+
|
22
|
+
Bugfixes:
|
23
|
+
- Use secure JSON methods for JSON (de)serialisation. #248
|
24
|
+
- Fix Result#inspect on a cleared result.
|
25
|
+
- Fix test case that failed on Ruby-2.4. #255
|
26
|
+
|
27
|
+
Documentation fixes:
|
28
|
+
- Talk about Integer instead of Fixnum.
|
29
|
+
- Fix method signature of Coder#encode.
|
30
|
+
|
31
|
+
|
32
|
+
== v0.19.0 [2016-09-21] Michael Granger <ged@FaerieMUD.org>
|
33
|
+
|
34
|
+
- Deprecate Ruby 1.9
|
35
|
+
|
36
|
+
Enhancements:
|
37
|
+
- Respect and convert character encoding of all strings sent
|
38
|
+
to the server. #231
|
39
|
+
- Add PostgreSQL-9.5 functions PQsslInUse(), PQsslAttribute()
|
40
|
+
and PQsslAttributeNames().
|
41
|
+
- Various documentation fixes and improvements.
|
42
|
+
- Add mechanism to build without pg_config:
|
43
|
+
gem install pg -- --with-pg-config=ignore
|
44
|
+
- Update Windows binary gems to Ruby-2.3, PostgreSQL 9.5.4 and
|
45
|
+
OpenSSL 1.0.2f.
|
46
|
+
- Add JSON coders and add them to BasicTypeMapForResults and
|
47
|
+
BasicTypeMapBasedOnResult
|
48
|
+
- Allow build from git per bundler.
|
49
|
+
|
50
|
+
Bugfixes:
|
51
|
+
- Release GVL while calling PQsetClientEncoding(). #245
|
52
|
+
- Add __EXTENSIONS__ to Solaris/SmartOS for Ruby >= 2.3.x. #236
|
53
|
+
- Fix wrong exception when running SQL while in Connection#copy_data
|
54
|
+
block for output
|
55
|
+
|
56
|
+
|
1
57
|
== v0.18.4 [2015-11-13] Michael Granger <ged@FaerieMUD.org>
|
2
58
|
|
3
59
|
Enhancements:
|
data/Manifest.txt
CHANGED
@@ -46,29 +46,12 @@ lib/pg/basic_type_mapping.rb
|
|
46
46
|
lib/pg/coder.rb
|
47
47
|
lib/pg/connection.rb
|
48
48
|
lib/pg/constants.rb
|
49
|
+
lib/pg/deprecated_constants.rb
|
49
50
|
lib/pg/exceptions.rb
|
50
51
|
lib/pg/result.rb
|
51
52
|
lib/pg/text_decoder.rb
|
52
53
|
lib/pg/text_encoder.rb
|
53
54
|
lib/pg/type_map_by_column.rb
|
54
|
-
sample/array_insert.rb
|
55
|
-
sample/async_api.rb
|
56
|
-
sample/async_copyto.rb
|
57
|
-
sample/async_mixed.rb
|
58
|
-
sample/check_conn.rb
|
59
|
-
sample/copyfrom.rb
|
60
|
-
sample/copyto.rb
|
61
|
-
sample/cursor.rb
|
62
|
-
sample/disk_usage_report.rb
|
63
|
-
sample/issue-119.rb
|
64
|
-
sample/losample.rb
|
65
|
-
sample/minimal-testcase.rb
|
66
|
-
sample/notify_wait.rb
|
67
|
-
sample/pg_statistics.rb
|
68
|
-
sample/replication_monitor.rb
|
69
|
-
sample/test_binary_values.rb
|
70
|
-
sample/wal_shipper.rb
|
71
|
-
sample/warehouse_partitions.rb
|
72
55
|
spec/data/expected_trace.out
|
73
56
|
spec/data/random_binary_data
|
74
57
|
spec/helpers.rb
|
data/README.rdoc
CHANGED
@@ -11,7 +11,7 @@ docs :: http://deveiate.org/code/pg
|
|
11
11
|
|
12
12
|
Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/].
|
13
13
|
|
14
|
-
It works with {PostgreSQL
|
14
|
+
It works with {PostgreSQL 9.1 and later}[http://www.postgresql.org/support/versioning/].
|
15
15
|
|
16
16
|
A small example usage:
|
17
17
|
|
@@ -23,7 +23,7 @@ A small example usage:
|
|
23
23
|
conn = PG.connect( dbname: 'sales' )
|
24
24
|
conn.exec( "SELECT * FROM pg_stat_activity" ) do |result|
|
25
25
|
puts " PID | User | Query"
|
26
|
-
|
26
|
+
result.each do |row|
|
27
27
|
puts " %7d | %-16s | %s " %
|
28
28
|
row.values_at('procpid', 'usename', 'current_query')
|
29
29
|
end
|
@@ -31,16 +31,16 @@ A small example usage:
|
|
31
31
|
|
32
32
|
== Build Status
|
33
33
|
|
34
|
-
{<img src="https://travis-ci.org/ged/ruby-pg.
|
34
|
+
{<img src="https://travis-ci.org/ged/ruby-pg.svg?branch=master" alt="Build Status Travis-CI" />}[https://travis-ci.org/ged/ruby-pg]
|
35
35
|
{<img src="https://ci.appveyor.com/api/projects/status/at4g4swb2cd4xji7/branch/master?svg=true" alt="Build Status Appveyor" />}[https://ci.appveyor.com/project/ged/ruby-pg]
|
36
36
|
|
37
37
|
|
38
38
|
== Requirements
|
39
39
|
|
40
|
-
* Ruby
|
41
|
-
* PostgreSQL
|
40
|
+
* Ruby 2.2
|
41
|
+
* PostgreSQL 9.1.x or later (with headers, -dev packages, etc).
|
42
42
|
|
43
|
-
It
|
43
|
+
It usually work with earlier versions of Ruby/PostgreSQL as well, but those are
|
44
44
|
not regularly tested.
|
45
45
|
|
46
46
|
|
@@ -66,6 +66,10 @@ There's also {a Google+ group}[http://goo.gl/TFy1U] and a
|
|
66
66
|
{mailing list}[http://groups.google.com/group/ruby-pg] if you get stuck, or just
|
67
67
|
want to chat about something.
|
68
68
|
|
69
|
+
If you want to install as a signed gem, the public certs of the gem signers
|
70
|
+
can be found in {the `certs` directory}[https://bitbucket.org/ged/ruby-pg/src/tip/certs/]
|
71
|
+
of the repository.
|
72
|
+
|
69
73
|
|
70
74
|
== Type Casts
|
71
75
|
|
@@ -112,7 +116,7 @@ needs for type casting. The default type map is PG::TypeMapAllStrings.
|
|
112
116
|
|
113
117
|
A type map can be assigned per connection or per query respectively per
|
114
118
|
result set. Type maps can also be used for COPY in and out data streaming.
|
115
|
-
|
119
|
+
See PG::Connection#copy_data .
|
116
120
|
|
117
121
|
== Contributing
|
118
122
|
|
@@ -133,7 +137,7 @@ Lars Kanis <lars@greiz-reinsdorf.de>.
|
|
133
137
|
|
134
138
|
== Copying
|
135
139
|
|
136
|
-
Copyright (c) 1997-
|
140
|
+
Copyright (c) 1997-2016 by the authors.
|
137
141
|
|
138
142
|
* Jeff Davis <ruby-pg@j-davis.com>
|
139
143
|
* Guy Decoux (ts) <decoux@moulon.inra.fr>
|
@@ -145,7 +149,7 @@ Copyright (c) 1997-2015 by the authors.
|
|
145
149
|
* Noboru Saitou <noborus@netlab.jp>
|
146
150
|
|
147
151
|
You may redistribute this software under the same terms as Ruby itself; see
|
148
|
-
|
152
|
+
https://www.ruby-lang.org/en/about/license.txt or the BSDL file in the source
|
149
153
|
for details.
|
150
154
|
|
151
155
|
Portions of the code are from the PostgreSQL project, and are distributed
|
data/Rakefile
CHANGED
@@ -55,22 +55,21 @@ $hoespec = Hoe.spec 'pg' do
|
|
55
55
|
self.extra_rdoc_files = Rake::FileList[ '*.rdoc' ]
|
56
56
|
self.extra_rdoc_files.include( 'POSTGRES', 'LICENSE' )
|
57
57
|
self.extra_rdoc_files.include( 'ext/*.c' )
|
58
|
-
self.license
|
58
|
+
self.license 'BSD-3-Clause'
|
59
59
|
|
60
60
|
self.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
61
61
|
self.developer 'Lars Kanis', 'lars@greiz-reinsdorf.de'
|
62
62
|
|
63
|
-
self.dependency 'rake-compiler', '~> 0
|
64
|
-
self.dependency 'rake-compiler-dock', '~> 0.
|
65
|
-
self.dependency 'hoe', '~>
|
66
|
-
self.dependency 'hoe-deveiate', '~> 0.6', :developer
|
63
|
+
self.dependency 'rake-compiler', '~> 1.0', :developer
|
64
|
+
self.dependency 'rake-compiler-dock', '~> 0.6', :developer
|
65
|
+
self.dependency 'hoe-deveiate', '~> 0.9', :developer
|
67
66
|
self.dependency 'hoe-bundler', '~> 1.0', :developer
|
68
|
-
self.dependency 'rspec', '~> 3.
|
67
|
+
self.dependency 'rspec', '~> 3.5', :developer
|
68
|
+
self.dependency 'rdoc', '~> 5.1', :developer
|
69
69
|
|
70
|
-
self.spec_extras[:licenses] = ['BSD', 'Ruby', 'GPL']
|
71
70
|
self.spec_extras[:extensions] = [ 'ext/extconf.rb' ]
|
72
71
|
|
73
|
-
self.require_ruby_version( '>=
|
72
|
+
self.require_ruby_version( '>= 2.0.0' )
|
74
73
|
|
75
74
|
self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
|
76
75
|
self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )
|
@@ -81,7 +80,7 @@ end
|
|
81
80
|
ENV['VERSION'] ||= $hoespec.spec.version.to_s
|
82
81
|
|
83
82
|
# Tests should pass before checking in
|
84
|
-
task 'hg:precheckin' => [ :check_history, :check_manifest, :spec ]
|
83
|
+
task 'hg:precheckin' => [ :check_history, :check_manifest, :spec, :gemspec ]
|
85
84
|
|
86
85
|
# Support for 'rvm specs'
|
87
86
|
task :specs => :spec
|
@@ -97,7 +96,7 @@ task :test do
|
|
97
96
|
# the installed gem dir. So we clear the task rake-compiler set up
|
98
97
|
# to break the dependency between :spec and :compile when running under
|
99
98
|
# rubygems-test, and then run :spec.
|
100
|
-
Rake::Task[ EXT.to_s ].clear
|
99
|
+
Rake::Task[ EXT.to_s ].clear if File.exist?(EXT.to_s)
|
101
100
|
Rake::Task[ :spec ].execute
|
102
101
|
end
|
103
102
|
|
@@ -132,8 +131,7 @@ Rake::ExtensionTask.new do |ext|
|
|
132
131
|
|
133
132
|
# Add libpq.dll to windows binary gemspec
|
134
133
|
ext.cross_compiling do |spec|
|
135
|
-
|
136
|
-
spec.files << "lib/#{spec.platform.to_s.gsub(/^x86-/, "i386-")}/libpq.dll"
|
134
|
+
spec.files << "lib/libpq.dll"
|
137
135
|
end
|
138
136
|
end
|
139
137
|
|
@@ -187,13 +185,11 @@ end
|
|
187
185
|
|
188
186
|
desc "Update list of server error codes"
|
189
187
|
task :update_error_codes do
|
190
|
-
URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=
|
188
|
+
URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=refs/tags/REL9_6_1"
|
191
189
|
|
192
190
|
ERRORCODES_TXT = "ext/errorcodes.txt"
|
193
191
|
sh "wget #{URL_ERRORCODES_TXT.inspect} -O #{ERRORCODES_TXT.inspect} || curl #{URL_ERRORCODES_TXT.inspect} -o #{ERRORCODES_TXT.inspect}"
|
194
|
-
end
|
195
192
|
|
196
|
-
file 'ext/errorcodes.def' => ['ext/errorcodes.rb', 'ext/errorcodes.txt'] do
|
197
193
|
ruby 'ext/errorcodes.rb', 'ext/errorcodes.txt', 'ext/errorcodes.def'
|
198
194
|
end
|
199
195
|
|
@@ -207,12 +203,14 @@ file GEMSPEC => __FILE__
|
|
207
203
|
task GEMSPEC do |task|
|
208
204
|
spec = $hoespec.spec
|
209
205
|
spec.files.delete( '.gemtest' )
|
210
|
-
spec.
|
206
|
+
spec.signing_key = nil
|
207
|
+
spec.version = "#{spec.version.bump}.0.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
|
208
|
+
spec.cert_chain = [ 'certs/ged.pem' ]
|
211
209
|
File.open( task.name, 'w' ) do |fh|
|
212
210
|
fh.write( spec.to_ruby )
|
213
211
|
end
|
214
212
|
end
|
215
213
|
|
216
|
-
CLOBBER.include(
|
214
|
+
CLOBBER.include( '*.gemspec' )
|
217
215
|
task :default => :gemspec
|
218
216
|
|
data/Rakefile.cross
CHANGED
@@ -29,8 +29,8 @@ class CrossLibrary < OpenStruct
|
|
29
29
|
self.host_platform = toolchain
|
30
30
|
|
31
31
|
# Cross-compilation constants
|
32
|
-
self.openssl_version = ENV['OPENSSL_VERSION'] || '1.0.
|
33
|
-
self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '9.
|
32
|
+
self.openssl_version = ENV['OPENSSL_VERSION'] || '1.0.2j'
|
33
|
+
self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '9.6.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.
|
@@ -235,7 +235,7 @@ class CrossLibrary < OpenStruct
|
|
235
235
|
task :libpq => postgresql_lib
|
236
236
|
|
237
237
|
# copy libpq.dll to lib dir
|
238
|
-
dest_libpq = "lib/#{
|
238
|
+
dest_libpq = "lib/#{postgresql_lib.basename}"
|
239
239
|
directory File.dirname(dest_libpq)
|
240
240
|
file dest_libpq => [postgresql_lib, File.dirname(dest_libpq)] do
|
241
241
|
cp postgresql_lib, dest_libpq
|
@@ -290,12 +290,13 @@ task 'gem:windows' => ['ChangeLog'] do
|
|
290
290
|
|
291
291
|
# Copy gem signing key and certs to be accessable from the docker container
|
292
292
|
mkdir_p 'build/gem'
|
293
|
-
sh "cp ~/.gem/gem-*.pem build/gem/"
|
293
|
+
sh "cp ~/.gem/gem-*.pem build/gem/ || true"
|
294
|
+
sh "bundle package"
|
294
295
|
|
295
296
|
RakeCompilerDock.sh <<-EOT
|
296
297
|
mkdir ~/.gem &&
|
297
|
-
cp build/gem/gem-*.pem ~/.gem/ &&
|
298
|
-
bundle install &&
|
299
|
-
rake cross native gem
|
298
|
+
(cp build/gem/gem-*.pem ~/.gem/ || true) &&
|
299
|
+
bundle install --local &&
|
300
|
+
rake cross native gem RUBY_CC_VERSION=2.4.0:2.3.0:2.2.2:2.1.6:2.0.0
|
300
301
|
EOT
|
301
302
|
end
|
data/ext/errorcodes.def
CHANGED
@@ -198,6 +198,14 @@
|
|
198
198
|
VALUE klass = define_error_class( "InvalidRowCountInResultOffsetClause", "22" );
|
199
199
|
register_error_class( "2201X", klass );
|
200
200
|
}
|
201
|
+
{
|
202
|
+
VALUE klass = define_error_class( "InvalidTablesampleArgument", "22" );
|
203
|
+
register_error_class( "2202H", klass );
|
204
|
+
}
|
205
|
+
{
|
206
|
+
VALUE klass = define_error_class( "InvalidTablesampleRepeat", "22" );
|
207
|
+
register_error_class( "2202G", klass );
|
208
|
+
}
|
201
209
|
{
|
202
210
|
VALUE klass = define_error_class( "InvalidTimeZoneDisplacementValue", "22" );
|
203
211
|
register_error_class( "22009", klass );
|
@@ -365,6 +373,10 @@
|
|
365
373
|
VALUE klass = define_error_class( "InFailedSqlTransaction", "25" );
|
366
374
|
register_error_class( "25P02", klass );
|
367
375
|
}
|
376
|
+
{
|
377
|
+
VALUE klass = define_error_class( "IdleInTransactionSessionTimeout", "25" );
|
378
|
+
register_error_class( "25P03", klass );
|
379
|
+
}
|
368
380
|
{
|
369
381
|
VALUE klass = define_error_class( "InvalidSqlStatementName", NULL );
|
370
382
|
register_error_class( "26000", klass );
|
@@ -466,6 +478,10 @@
|
|
466
478
|
VALUE klass = define_error_class( "ERIESrfProtocolViolated", "39" );
|
467
479
|
register_error_class( "39P02", klass );
|
468
480
|
}
|
481
|
+
{
|
482
|
+
VALUE klass = define_error_class( "ERIEEventTriggerProtocolViolated", "39" );
|
483
|
+
register_error_class( "39P03", klass );
|
484
|
+
}
|
469
485
|
{
|
470
486
|
VALUE klass = define_error_class( "SavepointException", NULL );
|
471
487
|
register_error_class( "3B000", klass );
|
@@ -781,6 +797,11 @@
|
|
781
797
|
VALUE klass = define_error_class( "DuplicateFile", "58" );
|
782
798
|
register_error_class( "58P02", klass );
|
783
799
|
}
|
800
|
+
{
|
801
|
+
VALUE klass = define_error_class( "SnapshotTooOld", NULL );
|
802
|
+
register_error_class( "72000", klass );
|
803
|
+
register_error_class( "72", klass );
|
804
|
+
}
|
784
805
|
{
|
785
806
|
VALUE klass = define_error_class( "ConfigFileError", NULL );
|
786
807
|
register_error_class( "F0000", klass );
|
@@ -916,6 +937,10 @@
|
|
916
937
|
VALUE klass = define_error_class( "TooManyRows", "P0" );
|
917
938
|
register_error_class( "P0003", klass );
|
918
939
|
}
|
940
|
+
{
|
941
|
+
VALUE klass = define_error_class( "AssertFailure", "P0" );
|
942
|
+
register_error_class( "P0004", klass );
|
943
|
+
}
|
919
944
|
{
|
920
945
|
VALUE klass = define_error_class( "InternalError", NULL );
|
921
946
|
register_error_class( "XX000", klass );
|
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-2016, 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
|
@@ -15,6 +15,9 @@
|
|
15
15
|
# src/pl/plpgsql/src/plerrcodes.h
|
16
16
|
# a list of PL/pgSQL condition names and their SQLSTATE codes
|
17
17
|
#
|
18
|
+
# src/pl/tcl/pltclerrcodes.h
|
19
|
+
# the same, for PL/Tcl
|
20
|
+
#
|
18
21
|
# doc/src/sgml/errcodes-list.sgml
|
19
22
|
# a SGML table of error codes for inclusion in the documentation
|
20
23
|
#
|
@@ -177,6 +180,8 @@ Section: Class 22 - Data Exception
|
|
177
180
|
2201B E ERRCODE_INVALID_REGULAR_EXPRESSION invalid_regular_expression
|
178
181
|
2201W E ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE invalid_row_count_in_limit_clause
|
179
182
|
2201X E ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE invalid_row_count_in_result_offset_clause
|
183
|
+
2202H E ERRCODE_INVALID_TABLESAMPLE_ARGUMENT invalid_tablesample_argument
|
184
|
+
2202G E ERRCODE_INVALID_TABLESAMPLE_REPEAT invalid_tablesample_repeat
|
180
185
|
22009 E ERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUE invalid_time_zone_displacement_value
|
181
186
|
2200C E ERRCODE_INVALID_USE_OF_ESCAPE_CHARACTER invalid_use_of_escape_character
|
182
187
|
2200G E ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH most_specific_type_mismatch
|
@@ -227,6 +232,7 @@ Section: Class 25 - Invalid Transaction State
|
|
227
232
|
25007 E ERRCODE_SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED schema_and_data_statement_mixing_not_supported
|
228
233
|
25P01 E ERRCODE_NO_ACTIVE_SQL_TRANSACTION no_active_sql_transaction
|
229
234
|
25P02 E ERRCODE_IN_FAILED_SQL_TRANSACTION in_failed_sql_transaction
|
235
|
+
25P03 E ERRCODE_IDLE_IN_TRANSACTION_SESSION_TIMEOUT idle_in_transaction_session_timeout
|
230
236
|
|
231
237
|
Section: Class 26 - Invalid SQL Statement Name
|
232
238
|
|
@@ -278,6 +284,7 @@ Section: Class 39 - External Routine Invocation Exception
|
|
278
284
|
39004 E ERRCODE_E_R_I_E_NULL_VALUE_NOT_ALLOWED null_value_not_allowed
|
279
285
|
39P01 E ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED trigger_protocol_violated
|
280
286
|
39P02 E ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED srf_protocol_violated
|
287
|
+
39P03 E ERRCODE_E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED event_trigger_protocol_violated
|
281
288
|
|
282
289
|
Section: Class 3B - Savepoint Exception
|
283
290
|
|
@@ -410,6 +417,10 @@ Section: Class 58 - System Error (errors external to PostgreSQL itself)
|
|
410
417
|
58P01 E ERRCODE_UNDEFINED_FILE undefined_file
|
411
418
|
58P02 E ERRCODE_DUPLICATE_FILE duplicate_file
|
412
419
|
|
420
|
+
Section: Class 72 - Snapshot Failure
|
421
|
+
# (class borrowed from Oracle)
|
422
|
+
72000 E ERRCODE_SNAPSHOT_TOO_OLD snapshot_too_old
|
423
|
+
|
413
424
|
Section: Class F0 - Configuration File Error
|
414
425
|
|
415
426
|
# (PostgreSQL-specific error class)
|
@@ -454,6 +465,7 @@ P0000 E ERRCODE_PLPGSQL_ERROR plp
|
|
454
465
|
P0001 E ERRCODE_RAISE_EXCEPTION raise_exception
|
455
466
|
P0002 E ERRCODE_NO_DATA_FOUND no_data_found
|
456
467
|
P0003 E ERRCODE_TOO_MANY_ROWS too_many_rows
|
468
|
+
P0004 E ERRCODE_ASSERT_FAILURE assert_failure
|
457
469
|
|
458
470
|
Section: Class XX - Internal Error
|
459
471
|
|
data/ext/extconf.rb
CHANGED
@@ -24,7 +24,11 @@ if enable_config("windows-cross")
|
|
24
24
|
else
|
25
25
|
# Native build
|
26
26
|
|
27
|
-
|
27
|
+
pgconfig = with_config('pg-config') ||
|
28
|
+
with_config('pg_config') ||
|
29
|
+
find_executable('pg_config')
|
30
|
+
|
31
|
+
if pgconfig && pgconfig != 'ignore'
|
28
32
|
$stderr.puts "Using config values from %s" % [ pgconfig ]
|
29
33
|
incdir = `"#{pgconfig}" --includedir`.chomp
|
30
34
|
libdir = `"#{pgconfig}" --libdir`.chomp
|
@@ -43,6 +47,9 @@ else
|
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
50
|
+
if RUBY_VERSION >= '2.3.0' && /solaris/ =~ RUBY_PLATFORM
|
51
|
+
append_cppflags( '-D__EXTENSIONS__' )
|
52
|
+
end
|
46
53
|
|
47
54
|
find_header( 'libpq-fe.h' ) or abort "Can't find the 'libpq-fe.h header"
|
48
55
|
find_header( 'libpq/libpq-fs.h' ) or abort "Can't find the 'libpq/libpq-fs.h header"
|
@@ -73,6 +80,7 @@ have_func 'PQlibVersion'
|
|
73
80
|
have_func 'PQping'
|
74
81
|
have_func 'PQsetSingleRowMode'
|
75
82
|
have_func 'PQconninfo'
|
83
|
+
have_func 'PQsslAttribute'
|
76
84
|
|
77
85
|
have_func 'rb_encdb_alias'
|
78
86
|
have_func 'rb_enc_alias'
|
data/ext/gvl_wrappers.h
CHANGED
@@ -195,6 +195,9 @@ extern void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1,
|
|
195
195
|
#define FOR_EACH_PARAM_OF_PQsendDescribePortal(param) \
|
196
196
|
param(PGconn *, conn)
|
197
197
|
|
198
|
+
#define FOR_EACH_PARAM_OF_PQsetClientEncoding(param) \
|
199
|
+
param(PGconn *, conn)
|
200
|
+
|
198
201
|
#define FOR_EACH_PARAM_OF_PQisBusy(param)
|
199
202
|
|
200
203
|
#define FOR_EACH_PARAM_OF_PQcancel(param) \
|
@@ -226,6 +229,7 @@ extern void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1,
|
|
226
229
|
function(PQsendQueryPrepared, GVL_TYPE_NONVOID, int, int, resultFormat) \
|
227
230
|
function(PQsendDescribePrepared, GVL_TYPE_NONVOID, int, const char *, stmt) \
|
228
231
|
function(PQsendDescribePortal, GVL_TYPE_NONVOID, int, const char *, portal) \
|
232
|
+
function(PQsetClientEncoding, GVL_TYPE_NONVOID, int, const char *, encoding) \
|
229
233
|
function(PQisBusy, GVL_TYPE_NONVOID, int, PGconn *, conn) \
|
230
234
|
function(PQcancel, GVL_TYPE_NONVOID, int, int, errbufsize);
|
231
235
|
|
data/ext/pg.c
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
/*
|
2
2
|
* pg.c - Toplevel extension
|
3
|
-
* $Id: pg.c,v
|
3
|
+
* $Id: pg.c,v c77d0997b4e4 2016/08/20 17:30:03 ged $
|
4
4
|
*
|
5
5
|
* Author/s:
|
6
6
|
*
|
7
7
|
* - Jeff Davis <ruby-pg@j-davis.com>
|
8
8
|
* - Guy Decoux (ts) <decoux@moulon.inra.fr>
|
9
9
|
* - Michael Granger <ged@FaerieMUD.org>
|
10
|
+
* - Lars Kanis <lars@greiz-reinsdorf.de>
|
10
11
|
* - Dave Lee
|
11
12
|
* - Eiji Matsumoto <usagi@ruby.club.or.jp>
|
12
13
|
* - Yukihiro Matsumoto <matz@ruby-lang.org>
|
@@ -15,10 +16,10 @@
|
|
15
16
|
* See Contributors.rdoc for the many additional fine people that have contributed
|
16
17
|
* to this library over the years.
|
17
18
|
*
|
18
|
-
* Copyright (c) 1997-
|
19
|
+
* Copyright (c) 1997-2016 by the authors.
|
19
20
|
*
|
20
21
|
* You may redistribute this software under the same terms as Ruby itself; see
|
21
|
-
*
|
22
|
+
* https://www.ruby-lang.org/en/about/license.txt or the BSDL file in the source
|
22
23
|
* for details.
|
23
24
|
*
|
24
25
|
* Portions of the code are from the PostgreSQL project, and are distributed
|
data/ext/pg.h
CHANGED
@@ -9,6 +9,9 @@
|
|
9
9
|
#include <stdio.h>
|
10
10
|
#include <stdlib.h>
|
11
11
|
#include <sys/types.h>
|
12
|
+
#if !defined(_WIN32)
|
13
|
+
# include <sys/time.h>
|
14
|
+
#endif
|
12
15
|
#if defined(HAVE_UNISTD_H) && !defined(_WIN32)
|
13
16
|
# include <unistd.h>
|
14
17
|
#endif /* HAVE_UNISTD_H */
|
@@ -205,7 +208,7 @@ typedef struct {
|
|
205
208
|
} t_pg_result;
|
206
209
|
|
207
210
|
|
208
|
-
typedef int (* t_pg_coder_enc_func)(t_pg_coder *, VALUE, char *, VALUE
|
211
|
+
typedef int (* t_pg_coder_enc_func)(t_pg_coder *, VALUE, char *, VALUE *, int);
|
209
212
|
typedef VALUE (* t_pg_coder_dec_func)(t_pg_coder *, char *, int, int, int, int);
|
210
213
|
typedef VALUE (* t_pg_fit_to_result)(VALUE, VALUE);
|
211
214
|
typedef VALUE (* t_pg_fit_to_query)(VALUE, VALUE);
|
@@ -321,8 +324,8 @@ void init_pg_binary_decoder _(( void ));
|
|
321
324
|
VALUE lookup_error_class _(( const char * ));
|
322
325
|
VALUE pg_bin_dec_bytea _(( t_pg_coder*, char *, int, int, int, int ));
|
323
326
|
VALUE pg_text_dec_string _(( t_pg_coder*, char *, int, int, int, int ));
|
324
|
-
int pg_coder_enc_to_s _(( t_pg_coder*, VALUE, char *, VALUE
|
325
|
-
int pg_text_enc_identifier _(( t_pg_coder*, VALUE, char *, VALUE
|
327
|
+
int pg_coder_enc_to_s _(( t_pg_coder*, VALUE, char *, VALUE *, int));
|
328
|
+
int pg_text_enc_identifier _(( t_pg_coder*, VALUE, char *, VALUE *, int));
|
326
329
|
t_pg_coder_enc_func pg_coder_enc_func _(( t_pg_coder* ));
|
327
330
|
t_pg_coder_dec_func pg_coder_dec_func _(( t_pg_coder*, int ));
|
328
331
|
void pg_define_coder _(( const char *, void *, VALUE, VALUE ));
|
data/ext/pg_binary_encoder.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* pg_column_map.c - PG::ColumnMap class extension
|
3
|
-
* $Id: pg_binary_encoder.c,v
|
3
|
+
* $Id: pg_binary_encoder.c,v e61a06f1f5ed 2015/12/25 21:14:21 lars $
|
4
4
|
*
|
5
5
|
*/
|
6
6
|
|
@@ -22,7 +22,7 @@ VALUE rb_mPG_BinaryEncoder;
|
|
22
22
|
*
|
23
23
|
*/
|
24
24
|
static int
|
25
|
-
pg_bin_enc_boolean(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate)
|
25
|
+
pg_bin_enc_boolean(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate, int enc_idx)
|
26
26
|
{
|
27
27
|
char mybool;
|
28
28
|
switch(value){
|
@@ -44,7 +44,7 @@ pg_bin_enc_boolean(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate
|
|
44
44
|
*
|
45
45
|
*/
|
46
46
|
static int
|
47
|
-
pg_bin_enc_int2(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate)
|
47
|
+
pg_bin_enc_int2(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate, int enc_idx)
|
48
48
|
{
|
49
49
|
if(out){
|
50
50
|
write_nbo16(NUM2INT(*intermediate), out);
|
@@ -63,7 +63,7 @@ pg_bin_enc_int2(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate)
|
|
63
63
|
*
|
64
64
|
*/
|
65
65
|
static int
|
66
|
-
pg_bin_enc_int4(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate)
|
66
|
+
pg_bin_enc_int4(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate, int enc_idx)
|
67
67
|
{
|
68
68
|
if(out){
|
69
69
|
write_nbo32(NUM2LONG(*intermediate), out);
|
@@ -82,7 +82,7 @@ pg_bin_enc_int4(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate)
|
|
82
82
|
*
|
83
83
|
*/
|
84
84
|
static int
|
85
|
-
pg_bin_enc_int8(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate)
|
85
|
+
pg_bin_enc_int8(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate, int enc_idx)
|
86
86
|
{
|
87
87
|
if(out){
|
88
88
|
write_nbo64(NUM2LL(*intermediate), out);
|
@@ -100,7 +100,7 @@ pg_bin_enc_int8(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate)
|
|
100
100
|
*
|
101
101
|
*/
|
102
102
|
static int
|
103
|
-
pg_bin_enc_from_base64(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate)
|
103
|
+
pg_bin_enc_from_base64(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate, int enc_idx)
|
104
104
|
{
|
105
105
|
int strlen;
|
106
106
|
VALUE subint;
|
@@ -109,13 +109,13 @@ pg_bin_enc_from_base64(t_pg_coder *conv, VALUE value, char *out, VALUE *intermed
|
|
109
109
|
|
110
110
|
if(out){
|
111
111
|
/* Second encoder pass, if required */
|
112
|
-
strlen = enc_func(this->elem, value, out, intermediate);
|
112
|
+
strlen = enc_func(this->elem, value, out, intermediate, enc_idx);
|
113
113
|
strlen = base64_decode( out, out, strlen );
|
114
114
|
|
115
115
|
return strlen;
|
116
116
|
} else {
|
117
117
|
/* First encoder pass */
|
118
|
-
strlen = enc_func(this->elem, value, NULL, &subint);
|
118
|
+
strlen = enc_func(this->elem, value, NULL, &subint, enc_idx);
|
119
119
|
|
120
120
|
if( strlen == -1 ){
|
121
121
|
/* Encoded string is returned in subint */
|