pg 0.18.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data/BSDL +2 -2
  4. data/ChangeLog +798 -7
  5. data/History.rdoc +96 -0
  6. data/Manifest.txt +0 -18
  7. data/README.rdoc +16 -11
  8. data/Rakefile +31 -24
  9. data/Rakefile.cross +21 -24
  10. data/ext/errorcodes.def +33 -0
  11. data/ext/errorcodes.txt +15 -1
  12. data/ext/extconf.rb +22 -33
  13. data/ext/gvl_wrappers.c +4 -0
  14. data/ext/gvl_wrappers.h +27 -39
  15. data/ext/pg.c +18 -50
  16. data/ext/pg.h +13 -80
  17. data/ext/pg_binary_decoder.c +3 -1
  18. data/ext/pg_binary_encoder.c +14 -12
  19. data/ext/pg_coder.c +31 -10
  20. data/ext/pg_connection.c +340 -225
  21. data/ext/pg_copy_coder.c +34 -4
  22. data/ext/pg_result.c +24 -22
  23. data/ext/pg_text_decoder.c +3 -1
  24. data/ext/pg_text_encoder.c +65 -42
  25. data/ext/pg_type_map.c +20 -13
  26. data/ext/pg_type_map_by_column.c +7 -7
  27. data/lib/pg/basic_type_mapping.rb +35 -8
  28. data/lib/pg/connection.rb +53 -12
  29. data/lib/pg/result.rb +10 -5
  30. data/lib/pg/text_decoder.rb +7 -0
  31. data/lib/pg/text_encoder.rb +8 -0
  32. data/lib/pg.rb +18 -10
  33. data/spec/helpers.rb +8 -15
  34. data/spec/pg/basic_type_mapping_spec.rb +54 -0
  35. data/spec/pg/connection_spec.rb +390 -209
  36. data/spec/pg/result_spec.rb +14 -7
  37. data/spec/pg/type_map_by_class_spec.rb +2 -2
  38. data/spec/pg/type_map_by_mri_type_spec.rb +1 -1
  39. data/spec/pg/type_spec.rb +90 -3
  40. data/spec/pg_spec.rb +1 -1
  41. data.tar.gz.sig +0 -0
  42. metadata +56 -69
  43. metadata.gz.sig +0 -0
  44. data/sample/array_insert.rb +0 -20
  45. data/sample/async_api.rb +0 -106
  46. data/sample/async_copyto.rb +0 -39
  47. data/sample/async_mixed.rb +0 -56
  48. data/sample/check_conn.rb +0 -21
  49. data/sample/copyfrom.rb +0 -81
  50. data/sample/copyto.rb +0 -19
  51. data/sample/cursor.rb +0 -21
  52. data/sample/disk_usage_report.rb +0 -186
  53. data/sample/issue-119.rb +0 -94
  54. data/sample/losample.rb +0 -69
  55. data/sample/minimal-testcase.rb +0 -17
  56. data/sample/notify_wait.rb +0 -72
  57. data/sample/pg_statistics.rb +0 -294
  58. data/sample/replication_monitor.rb +0 -231
  59. data/sample/test_binary_values.rb +0 -33
  60. data/sample/wal_shipper.rb +0 -434
  61. data/sample/warehouse_partitions.rb +0 -320
data/History.rdoc CHANGED
@@ -1,3 +1,98 @@
1
+ == v1.0.0 [2018-01-10] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Deprecated:
4
+ - Deprecate Ruby older than 2.2.
5
+ - Deprecate Connection#socket in favor of #socket_io.
6
+
7
+ Removed:
8
+ - Remove compatibility code for Ruby < 2.0 and PostgreSQL < 9.2.
9
+ - Remove partial compatibility with Rubinius.
10
+
11
+ Enhancements:
12
+ - Update error codes to PostgreSQL-10
13
+ - Update Windows binary gems to Ruby-2.5, PostgreSQL 10.1 and
14
+ OpenSSL 1.1.0g.
15
+
16
+ Bugfixes:
17
+ - Fix URI detection for connection strings. #265 (thanks to jjoos)
18
+ - MINGW: Workaround segfault due to GCC linker error in conjunction with MSVC.
19
+ This happens when linking to PostgreSQL-10.0-x64 from EnterpriseDB.
20
+
21
+ Documentation fixes:
22
+ - Add PostgreSQL version since when the given function is supported. #263
23
+ - Better documentation to `encoder` and `decoder` arguments of COPY related methods.
24
+
25
+
26
+ == v0.21.0 [2017-06-12] Michael Granger <ged@FaerieMUD.org>
27
+
28
+ Enhancements:
29
+ - Move add_dll_directory to the Runtime namespace for newest versions
30
+ of RubyInstaller.
31
+ - Deprecate PGconn, PGresult, and PGError top-level constants; a warning
32
+ will be output the first time one of them is used. They will be
33
+ removed in the upcoming 1.0 release.
34
+
35
+ Documentation fixes:
36
+ - Update the docs for PG::Result#cmd_tuples
37
+
38
+ New Samples:
39
+ - Add an example of the nicer #copy_data way of doing `COPY`.
40
+
41
+
42
+ == v0.20.0 [2017-03-10] Michael Granger <ged@FaerieMUD.org>
43
+
44
+ Enhancements:
45
+ - Update error codes to PostgreSQL-9.6
46
+ - Update Windows binary gems to Ruby-2.4, PostgreSQL 9.6.1 and
47
+ OpenSSL 1.0.2j.
48
+ - Add support for RubyInstaller2 to Windows binary gems.
49
+
50
+ Bugfixes:
51
+ - Use secure JSON methods for JSON (de)serialisation. #248
52
+ - Fix Result#inspect on a cleared result.
53
+ - Fix test case that failed on Ruby-2.4. #255
54
+
55
+ Documentation fixes:
56
+ - Talk about Integer instead of Fixnum.
57
+ - Fix method signature of Coder#encode.
58
+
59
+
60
+ == v0.19.0 [2016-09-21] Michael Granger <ged@FaerieMUD.org>
61
+
62
+ - Deprecate Ruby 1.9
63
+
64
+ Enhancements:
65
+ - Respect and convert character encoding of all strings sent
66
+ to the server. #231
67
+ - Add PostgreSQL-9.5 functions PQsslInUse(), PQsslAttribute()
68
+ and PQsslAttributeNames().
69
+ - Various documentation fixes and improvements.
70
+ - Add mechanism to build without pg_config:
71
+ gem install pg -- --with-pg-config=ignore
72
+ - Update Windows binary gems to Ruby-2.3, PostgreSQL 9.5.4 and
73
+ OpenSSL 1.0.2f.
74
+ - Add JSON coders and add them to BasicTypeMapForResults and
75
+ BasicTypeMapBasedOnResult
76
+ - Allow build from git per bundler.
77
+
78
+ Bugfixes:
79
+ - Release GVL while calling PQsetClientEncoding(). #245
80
+ - Add __EXTENSIONS__ to Solaris/SmartOS for Ruby >= 2.3.x. #236
81
+ - Fix wrong exception when running SQL while in Connection#copy_data
82
+ block for output
83
+
84
+
85
+ == v0.18.4 [2015-11-13] Michael Granger <ged@FaerieMUD.org>
86
+
87
+ Enhancements:
88
+ - Fixing compilation problems with Microsoft Visual Studio 2008. GH #10
89
+ - Avoid name clash with xcode and jemalloc. PR#22, PR#23
90
+
91
+ Bugfixes:
92
+ - Avoid segfault, when quote_ident or TextEncoder::Identifier
93
+ is called with Array containing non-strings. #226
94
+
95
+
1
96
  == v0.18.3 [2015-09-03] Michael Granger <ged@FaerieMUD.org>
2
97
 
3
98
  Enhancements:
@@ -16,6 +111,7 @@ Bugfixes:
16
111
  Enhancements:
17
112
 
18
113
  - Allow URI connection string (thanks to Chris Bandy)
114
+ - Allow Array type parameter to conn.quote_ident
19
115
 
20
116
  Bugfixes:
21
117
 
data/Manifest.txt CHANGED
@@ -51,24 +51,6 @@ lib/pg/result.rb
51
51
  lib/pg/text_decoder.rb
52
52
  lib/pg/text_encoder.rb
53
53
  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
54
  spec/data/expected_trace.out
73
55
  spec/data/random_binary_data
74
56
  spec/helpers.rb
data/README.rdoc CHANGED
@@ -4,12 +4,14 @@ home :: https://bitbucket.org/ged/ruby-pg
4
4
  mirror :: https://github.com/ged/ruby-pg
5
5
  docs :: http://deveiate.org/code/pg
6
6
 
7
+ {<img src="https://badges.gitter.im/Join%20Chat.svg" alt="Join the chat at https://gitter.im/ged/ruby-pg">}[https://gitter.im/ged/ruby-pg?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge]
8
+
7
9
 
8
10
  == Description
9
11
 
10
12
  Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/].
11
13
 
12
- It works with {PostgreSQL 8.4 and later}[http://www.postgresql.org/support/versioning/].
14
+ It works with {PostgreSQL 9.2 and later}[http://www.postgresql.org/support/versioning/].
13
15
 
14
16
  A small example usage:
15
17
 
@@ -21,7 +23,7 @@ A small example usage:
21
23
  conn = PG.connect( dbname: 'sales' )
22
24
  conn.exec( "SELECT * FROM pg_stat_activity" ) do |result|
23
25
  puts " PID | User | Query"
24
- result.each do |row|
26
+ result.each do |row|
25
27
  puts " %7d | %-16s | %s " %
26
28
  row.values_at('procpid', 'usename', 'current_query')
27
29
  end
@@ -29,16 +31,16 @@ A small example usage:
29
31
 
30
32
  == Build Status
31
33
 
32
- {<img src="https://travis-ci.org/ged/ruby-pg.png?branch=master" alt="Build Status Travis-CI" />}[https://travis-ci.org/ged/ruby-pg]
33
- {<img src="https://ci.appveyor.com/api/projects/status/at4g4swb2cd4xji7/branch/master?svg=true" alt="Build Status Appveyor" />}[https://ci.appveyor.com/api/projects/status/at4g4swb2cd4xji7/branch/master]
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
+ {<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]
34
36
 
35
37
 
36
38
  == Requirements
37
39
 
38
- * Ruby 1.9.3-p392, or 2.0.0-p0.
39
- * PostgreSQL 8.4.x or later (with headers, -dev packages, etc).
40
+ * Ruby 2.2 or newer
41
+ * PostgreSQL 9.2.x or later (with headers, -dev packages, etc).
40
42
 
41
- It may work with earlier versions of Ruby/PostgreSQL as well, but those are
43
+ It usually work with earlier versions of Ruby/PostgreSQL as well, but those are
42
44
  not regularly tested.
43
45
 
44
46
 
@@ -64,6 +66,10 @@ There's also {a Google+ group}[http://goo.gl/TFy1U] and a
64
66
  {mailing list}[http://groups.google.com/group/ruby-pg] if you get stuck, or just
65
67
  want to chat about something.
66
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
+
67
73
 
68
74
  == Type Casts
69
75
 
@@ -110,7 +116,7 @@ needs for type casting. The default type map is PG::TypeMapAllStrings.
110
116
 
111
117
  A type map can be assigned per connection or per query respectively per
112
118
  result set. Type maps can also be used for COPY in and out data streaming.
113
-
119
+ See PG::Connection#copy_data .
114
120
 
115
121
  == Contributing
116
122
 
@@ -131,7 +137,7 @@ Lars Kanis <lars@greiz-reinsdorf.de>.
131
137
 
132
138
  == Copying
133
139
 
134
- Copyright (c) 1997-2015 by the authors.
140
+ Copyright (c) 1997-2016 by the authors.
135
141
 
136
142
  * Jeff Davis <ruby-pg@j-davis.com>
137
143
  * Guy Decoux (ts) <decoux@moulon.inra.fr>
@@ -143,7 +149,7 @@ Copyright (c) 1997-2015 by the authors.
143
149
  * Noboru Saitou <noborus@netlab.jp>
144
150
 
145
151
  You may redistribute this software under the same terms as Ruby itself; see
146
- http://www.ruby-lang.org/en/LICENSE.txt or the LICENSE file in the source
152
+ https://www.ruby-lang.org/en/about/license.txt or the BSDL file in the source
147
153
  for details.
148
154
 
149
155
  Portions of the code are from the PostgreSQL project, and are distributed
@@ -159,4 +165,3 @@ to this library over the years.
159
165
 
160
166
  We are thankful to the people at the ruby-list and ruby-dev mailing lists.
161
167
  And to the people who developed PostgreSQL.
162
-
data/Rakefile CHANGED
@@ -55,30 +55,24 @@ $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 :BSD
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.9', :developer
64
- self.dependency 'rake-compiler-dock', '~> 0.3', :developer
65
- self.dependency 'hoe', '~> 3.12', :developer
66
- self.dependency 'hoe-deveiate', '~> 0.6', :developer
63
+ self.dependency 'rake-compiler', '~> 1.0', :developer
64
+ self.dependency 'rake-compiler-dock', ['~> 0.6', '>= 0.6.2'], :developer
65
+ self.dependency 'hoe-deveiate', '~> 0.9', :developer
67
66
  self.dependency 'hoe-bundler', '~> 1.0', :developer
68
- self.dependency 'rspec', '~> 3.0', :developer
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( '>= 1.9.3' )
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= )
77
- self.spec_extras[:rdoc_options] = [
78
- '-f', 'fivefish',
79
- '-t', 'pg: The Ruby Interface to PostgreSQL',
80
- '-m', 'README.rdoc',
81
- ]
82
76
 
83
77
  self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
84
78
  end
@@ -86,7 +80,7 @@ end
86
80
  ENV['VERSION'] ||= $hoespec.spec.version.to_s
87
81
 
88
82
  # Tests should pass before checking in
89
- task 'hg:precheckin' => [ :check_history, :check_manifest, :spec ]
83
+ task 'hg:precheckin' => [ :check_history, :check_manifest, :spec, :gemspec ]
90
84
 
91
85
  # Support for 'rvm specs'
92
86
  task :specs => :spec
@@ -102,7 +96,7 @@ task :test do
102
96
  # the installed gem dir. So we clear the task rake-compiler set up
103
97
  # to break the dependency between :spec and :compile when running under
104
98
  # rubygems-test, and then run :spec.
105
- Rake::Task[ EXT.to_s ].clear
99
+ Rake::Task[ EXT.to_s ].clear if File.exist?(EXT.to_s)
106
100
  Rake::Task[ :spec ].execute
107
101
  end
108
102
 
@@ -111,8 +105,6 @@ task :maint do
111
105
  ENV['MAINTAINER_MODE'] = 'yes'
112
106
  end
113
107
 
114
- ENV['RUBY_CC_VERSION'] ||= '1.8.7:1.9.2:2.0.0'
115
-
116
108
  # Rake-compiler task
117
109
  Rake::ExtensionTask.new do |ext|
118
110
  ext.name = 'pg_ext'
@@ -137,8 +129,22 @@ Rake::ExtensionTask.new do |ext|
137
129
 
138
130
  # Add libpq.dll to windows binary gemspec
139
131
  ext.cross_compiling do |spec|
140
- # mingw32-platform strings differ (RUBY_PLATFORM=i386-mingw32 vs. x86-mingw32 for rubygems)
141
- spec.files << "lib/#{spec.platform.to_s.gsub(/^x86-/, "i386-")}/libpq.dll"
132
+ spec.files << "lib/libpq.dll"
133
+ end
134
+ end
135
+
136
+
137
+ # Use the fivefish formatter for docs generated from development checkout
138
+ if File.directory?( '.hg' )
139
+ require 'rdoc/task'
140
+
141
+ Rake::Task[ 'docs' ].clear
142
+ RDoc::Task.new( 'docs' ) do |rdoc|
143
+ rdoc.main = "README.rdoc"
144
+ rdoc.rdoc_files.include( "*.rdoc", "ChangeLog", "lib/**/*.rb", 'ext/**/*.{c,h}' )
145
+ rdoc.generator = :fivefish
146
+ rdoc.title = "PG: The Ruby PostgreSQL Driver"
147
+ rdoc.rdoc_dir = 'doc'
142
148
  end
143
149
  end
144
150
 
@@ -147,6 +153,7 @@ end
147
153
  file '.hg/branch' do
148
154
  warn "WARNING: You need the Mercurial repo to update the ChangeLog"
149
155
  end
156
+ Rake::Task["ChangeLog"].clear
150
157
  file 'ChangeLog' do |task|
151
158
  if File.exist?('.hg/branch')
152
159
  $stderr.puts "Updating the changelog..."
@@ -177,13 +184,11 @@ end
177
184
 
178
185
  desc "Update list of server error codes"
179
186
  task :update_error_codes do
180
- URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=HEAD"
187
+ URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=refs/tags/REL_10_1"
181
188
 
182
189
  ERRORCODES_TXT = "ext/errorcodes.txt"
183
190
  sh "wget #{URL_ERRORCODES_TXT.inspect} -O #{ERRORCODES_TXT.inspect} || curl #{URL_ERRORCODES_TXT.inspect} -o #{ERRORCODES_TXT.inspect}"
184
- end
185
191
 
186
- file 'ext/errorcodes.def' => ['ext/errorcodes.rb', 'ext/errorcodes.txt'] do
187
192
  ruby 'ext/errorcodes.rb', 'ext/errorcodes.txt', 'ext/errorcodes.def'
188
193
  end
189
194
 
@@ -197,12 +202,14 @@ file GEMSPEC => __FILE__
197
202
  task GEMSPEC do |task|
198
203
  spec = $hoespec.spec
199
204
  spec.files.delete( '.gemtest' )
200
- spec.version = "#{spec.version}.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
205
+ spec.signing_key = nil
206
+ spec.version = "#{spec.version.bump}.0.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
207
+ spec.cert_chain = [ 'certs/ged.pem' ]
201
208
  File.open( task.name, 'w' ) do |fh|
202
209
  fh.write( spec.to_ruby )
203
210
  end
204
211
  end
205
212
 
206
- CLOBBER.include( GEMSPEC.to_s )
213
+ CLOBBER.include( '*.gemspec' )
207
214
  task :default => :gemspec
208
215
 
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.2d'
33
- self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '9.4.4'
32
+ self.openssl_version = ENV['OPENSSL_VERSION'] || '1.1.0g'
33
+ self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '10.1'
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.
@@ -54,8 +54,8 @@ class CrossLibrary < OpenStruct
54
54
  self.openssl_tarball = static_sourcesdir + File.basename( openssl_source_uri.path )
55
55
  self.openssl_makefile = static_openssl_builddir + 'Makefile'
56
56
 
57
- self.libssleay32 = static_openssl_builddir + 'libssleay32.a'
58
- self.libeay32 = static_openssl_builddir + 'libeay32.a'
57
+ self.libssl = static_openssl_builddir + 'libssl.a'
58
+ self.libcrypto = static_openssl_builddir + 'libcrypto.a'
59
59
 
60
60
  self.openssl_patches = Rake::FileList[ (MISCDIR + "openssl-#{openssl_version}.*.patch").to_s ]
61
61
 
@@ -82,8 +82,6 @@ class CrossLibrary < OpenStruct
82
82
  CLEAN.include( static_builddir.to_s )
83
83
 
84
84
 
85
- ENV['RUBY_CC_VERSION'] ||= '1.9.3:2.0.0'
86
-
87
85
  def download(url, save_to)
88
86
  part = save_to+".part"
89
87
  sh "wget #{url.to_s.inspect} -O #{part.inspect} || curl #{url.to_s.inspect} -o #{part.inspect}"
@@ -126,11 +124,9 @@ class CrossLibrary < OpenStruct
126
124
  end
127
125
 
128
126
  self.cmd_prelude = [
129
- 'env',
130
- "CC=#{host_platform}-gcc",
127
+ "env",
128
+ "CROSS_COMPILE=#{host_platform}-",
131
129
  "CFLAGS=-DDSO_WIN32",
132
- "AR=#{host_platform}-ar",
133
- "RANLIB=#{host_platform}-ranlib"
134
130
  ]
135
131
 
136
132
 
@@ -145,7 +141,7 @@ class CrossLibrary < OpenStruct
145
141
  end
146
142
 
147
143
  desc "compile static openssl libraries"
148
- task :openssl_libs => [ libssleay32, libeay32 ]
144
+ task :openssl_libs => [ libssl, libcrypto ]
149
145
 
150
146
  task :compile_static_openssl => openssl_makefile do |t|
151
147
  chdir( static_openssl_builddir ) do
@@ -156,14 +152,14 @@ class CrossLibrary < OpenStruct
156
152
  end
157
153
  end
158
154
 
159
- desc "compile static #{libeay32}"
160
- file libeay32 => :compile_static_openssl do |t|
161
- FileUtils.cp( static_openssl_builddir + 'libcrypto.a', libeay32.to_s )
155
+ desc "compile static #{libssl}"
156
+ file libssl => :compile_static_openssl do |t|
157
+ rm t.name.gsub(/\.a$/, ".dll.a")
162
158
  end
163
159
 
164
- desc "compile static #{libssleay32}"
165
- file libssleay32 => :compile_static_openssl do |t|
166
- FileUtils.cp( static_openssl_builddir + 'libssl.a', libssleay32.to_s )
160
+ desc "compile static #{libcrypto}"
161
+ file libcrypto => :compile_static_openssl do |t|
162
+ rm t.name.gsub(/\.a$/, ".dll.a")
167
163
  end
168
164
 
169
165
 
@@ -207,7 +203,7 @@ class CrossLibrary < OpenStruct
207
203
  cmd << "CFLAGS=-L#{static_openssl_builddir}"
208
204
  cmd << "LDFLAGS=-L#{static_openssl_builddir}"
209
205
  cmd << "LDFLAGS_SL=-L#{static_openssl_builddir}"
210
- cmd << "LIBS=-lwsock32 -lgdi32"
206
+ cmd << "LIBS=-lwsock32 -lgdi32 -lws2_32"
211
207
  cmd << "CPPFLAGS=-I#{static_openssl_builddir}/include"
212
208
 
213
209
  run( *cmd )
@@ -226,7 +222,7 @@ class CrossLibrary < OpenStruct
226
222
  sh 'make',
227
223
  "-j#{NUM_CPUS}",
228
224
  postgresql_lib.basename.to_s,
229
- 'SHLIB_LINK=-lssleay32 -leay32 -lcrypt32 -lgdi32 -lsecur32 -lwsock32 -lws2_32'
225
+ 'SHLIB_LINK=-lssl -lcrypto -lcrypt32 -lgdi32 -lsecur32 -lwsock32 -lws2_32'
230
226
  end
231
227
  end
232
228
 
@@ -235,7 +231,7 @@ class CrossLibrary < OpenStruct
235
231
  task :libpq => postgresql_lib
236
232
 
237
233
  # copy libpq.dll to lib dir
238
- dest_libpq = "lib/#{for_platform}/#{postgresql_lib.basename}"
234
+ dest_libpq = "lib/#{postgresql_lib.basename}"
239
235
  directory File.dirname(dest_libpq)
240
236
  file dest_libpq => [postgresql_lib, File.dirname(dest_libpq)] do
241
237
  cp postgresql_lib, dest_libpq
@@ -290,12 +286,13 @@ task 'gem:windows' => ['ChangeLog'] do
290
286
 
291
287
  # Copy gem signing key and certs to be accessable from the docker container
292
288
  mkdir_p 'build/gem'
293
- sh "cp ~/.gem/gem-*.pem build/gem/"
289
+ sh "cp ~/.gem/gem-*.pem build/gem/ || true"
290
+ sh "bundle package"
294
291
 
295
292
  RakeCompilerDock.sh <<-EOT
296
293
  mkdir ~/.gem &&
297
- cp build/gem/gem-*.pem ~/.gem/ &&
298
- bundle install &&
299
- rake cross native gem RUBYOPT=--disable-rubygems RUBY_CC_VERSION=1.9.3:2.0.0:2.1.6:2.2.2
294
+ (cp build/gem/gem-*.pem ~/.gem/ || true) &&
295
+ bundle install --local &&
296
+ rake cross native gem RUBY_CC_VERSION=2.5.0:2.4.0:2.3.0:2.2.2:2.1.6:2.0.0
300
297
  EOT
301
298
  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 );
@@ -222,6 +230,10 @@
222
230
  VALUE klass = define_error_class( "NumericValueOutOfRange", "22" );
223
231
  register_error_class( "22003", klass );
224
232
  }
233
+ {
234
+ VALUE klass = define_error_class( "SequenceGeneratorLimitExceeded", "22" );
235
+ register_error_class( "2200H", klass );
236
+ }
225
237
  {
226
238
  VALUE klass = define_error_class( "StringDataLengthMismatch", "22" );
227
239
  register_error_class( "22026", klass );
@@ -365,6 +377,10 @@
365
377
  VALUE klass = define_error_class( "InFailedSqlTransaction", "25" );
366
378
  register_error_class( "25P02", klass );
367
379
  }
380
+ {
381
+ VALUE klass = define_error_class( "IdleInTransactionSessionTimeout", "25" );
382
+ register_error_class( "25P03", klass );
383
+ }
368
384
  {
369
385
  VALUE klass = define_error_class( "InvalidSqlStatementName", NULL );
370
386
  register_error_class( "26000", klass );
@@ -466,6 +482,10 @@
466
482
  VALUE klass = define_error_class( "ERIESrfProtocolViolated", "39" );
467
483
  register_error_class( "39P02", klass );
468
484
  }
485
+ {
486
+ VALUE klass = define_error_class( "ERIEEventTriggerProtocolViolated", "39" );
487
+ register_error_class( "39P03", klass );
488
+ }
469
489
  {
470
490
  VALUE klass = define_error_class( "SavepointException", NULL );
471
491
  register_error_class( "3B000", klass );
@@ -571,6 +591,10 @@
571
591
  VALUE klass = define_error_class( "WrongObjectType", "42" );
572
592
  register_error_class( "42809", klass );
573
593
  }
594
+ {
595
+ VALUE klass = define_error_class( "GeneratedAlways", "42" );
596
+ register_error_class( "428C9", klass );
597
+ }
574
598
  {
575
599
  VALUE klass = define_error_class( "UndefinedColumn", "42" );
576
600
  register_error_class( "42703", klass );
@@ -781,6 +805,11 @@
781
805
  VALUE klass = define_error_class( "DuplicateFile", "58" );
782
806
  register_error_class( "58P02", klass );
783
807
  }
808
+ {
809
+ VALUE klass = define_error_class( "SnapshotTooOld", NULL );
810
+ register_error_class( "72000", klass );
811
+ register_error_class( "72", klass );
812
+ }
784
813
  {
785
814
  VALUE klass = define_error_class( "ConfigFileError", NULL );
786
815
  register_error_class( "F0000", klass );
@@ -916,6 +945,10 @@
916
945
  VALUE klass = define_error_class( "TooManyRows", "P0" );
917
946
  register_error_class( "P0003", klass );
918
947
  }
948
+ {
949
+ VALUE klass = define_error_class( "AssertFailure", "P0" );
950
+ register_error_class( "P0004", klass );
951
+ }
919
952
  {
920
953
  VALUE klass = define_error_class( "InternalError", NULL );
921
954
  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-2013, PostgreSQL Global Development Group
5
+ # Copyright (c) 2003-2017, 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,12 +180,15 @@ 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
183
188
  22004 E ERRCODE_NULL_VALUE_NOT_ALLOWED null_value_not_allowed
184
189
  22002 E ERRCODE_NULL_VALUE_NO_INDICATOR_PARAMETER null_value_no_indicator_parameter
185
190
  22003 E ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE numeric_value_out_of_range
191
+ 2200H E ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED sequence_generator_limit_exceeded
186
192
  22026 E ERRCODE_STRING_DATA_LENGTH_MISMATCH string_data_length_mismatch
187
193
  22001 E ERRCODE_STRING_DATA_RIGHT_TRUNCATION string_data_right_truncation
188
194
  22011 E ERRCODE_SUBSTRING_ERROR substring_error
@@ -227,6 +233,7 @@ Section: Class 25 - Invalid Transaction State
227
233
  25007 E ERRCODE_SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED schema_and_data_statement_mixing_not_supported
228
234
  25P01 E ERRCODE_NO_ACTIVE_SQL_TRANSACTION no_active_sql_transaction
229
235
  25P02 E ERRCODE_IN_FAILED_SQL_TRANSACTION in_failed_sql_transaction
236
+ 25P03 E ERRCODE_IDLE_IN_TRANSACTION_SESSION_TIMEOUT idle_in_transaction_session_timeout
230
237
 
231
238
  Section: Class 26 - Invalid SQL Statement Name
232
239
 
@@ -278,6 +285,7 @@ Section: Class 39 - External Routine Invocation Exception
278
285
  39004 E ERRCODE_E_R_I_E_NULL_VALUE_NOT_ALLOWED null_value_not_allowed
279
286
  39P01 E ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED trigger_protocol_violated
280
287
  39P02 E ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED srf_protocol_violated
288
+ 39P03 E ERRCODE_E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED event_trigger_protocol_violated
281
289
 
282
290
  Section: Class 3B - Savepoint Exception
283
291
 
@@ -319,6 +327,7 @@ Section: Class 42 - Syntax Error or Access Rule Violation
319
327
  42P21 E ERRCODE_COLLATION_MISMATCH collation_mismatch
320
328
  42P22 E ERRCODE_INDETERMINATE_COLLATION indeterminate_collation
321
329
  42809 E ERRCODE_WRONG_OBJECT_TYPE wrong_object_type
330
+ 428C9 E ERRCODE_GENERATED_ALWAYS generated_always
322
331
 
323
332
  # Note: for ERRCODE purposes, we divide namable objects into these categories:
324
333
  # databases, schemas, prepared statements, cursors, tables, columns,
@@ -410,6 +419,10 @@ Section: Class 58 - System Error (errors external to PostgreSQL itself)
410
419
  58P01 E ERRCODE_UNDEFINED_FILE undefined_file
411
420
  58P02 E ERRCODE_DUPLICATE_FILE duplicate_file
412
421
 
422
+ Section: Class 72 - Snapshot Failure
423
+ # (class borrowed from Oracle)
424
+ 72000 E ERRCODE_SNAPSHOT_TOO_OLD snapshot_too_old
425
+
413
426
  Section: Class F0 - Configuration File Error
414
427
 
415
428
  # (PostgreSQL-specific error class)
@@ -454,6 +467,7 @@ P0000 E ERRCODE_PLPGSQL_ERROR plp
454
467
  P0001 E ERRCODE_RAISE_EXCEPTION raise_exception
455
468
  P0002 E ERRCODE_NO_DATA_FOUND no_data_found
456
469
  P0003 E ERRCODE_TOO_MANY_ROWS too_many_rows
470
+ P0004 E ERRCODE_ASSERT_FAILURE assert_failure
457
471
 
458
472
  Section: Class XX - Internal Error
459
473