pg 0.21.0 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/History.rdoc +98 -0
  5. data/Manifest.txt +5 -1
  6. data/README.rdoc +14 -4
  7. data/Rakefile +4 -5
  8. data/Rakefile.cross +17 -21
  9. data/ext/errorcodes.def +12 -0
  10. data/ext/errorcodes.rb +1 -1
  11. data/ext/errorcodes.txt +4 -1
  12. data/ext/extconf.rb +14 -32
  13. data/ext/gvl_wrappers.c +4 -0
  14. data/ext/gvl_wrappers.h +23 -39
  15. data/ext/pg.c +23 -50
  16. data/ext/pg.h +51 -81
  17. data/ext/pg_binary_decoder.c +73 -6
  18. data/ext/pg_coder.c +52 -3
  19. data/ext/pg_connection.c +369 -219
  20. data/ext/pg_copy_coder.c +10 -5
  21. data/ext/pg_result.c +343 -119
  22. data/ext/pg_text_decoder.c +597 -37
  23. data/ext/pg_text_encoder.c +6 -7
  24. data/ext/pg_tuple.c +541 -0
  25. data/ext/util.c +6 -6
  26. data/ext/util.h +2 -2
  27. data/lib/pg.rb +5 -7
  28. data/lib/pg/basic_type_mapping.rb +40 -7
  29. data/lib/pg/binary_decoder.rb +22 -0
  30. data/lib/pg/coder.rb +1 -1
  31. data/lib/pg/connection.rb +27 -3
  32. data/lib/pg/constants.rb +1 -1
  33. data/lib/pg/exceptions.rb +1 -1
  34. data/lib/pg/result.rb +1 -1
  35. data/lib/pg/text_decoder.rb +19 -23
  36. data/lib/pg/text_encoder.rb +35 -1
  37. data/lib/pg/tuple.rb +30 -0
  38. data/lib/pg/type_map_by_column.rb +1 -1
  39. data/spec/helpers.rb +49 -21
  40. data/spec/pg/basic_type_mapping_spec.rb +230 -27
  41. data/spec/pg/connection_spec.rb +473 -277
  42. data/spec/pg/connection_sync_spec.rb +41 -0
  43. data/spec/pg/result_spec.rb +48 -13
  44. data/spec/pg/tuple_spec.rb +280 -0
  45. data/spec/pg/type_map_by_class_spec.rb +1 -1
  46. data/spec/pg/type_map_by_column_spec.rb +1 -1
  47. data/spec/pg/type_map_by_mri_type_spec.rb +1 -1
  48. data/spec/pg/type_map_by_oid_spec.rb +1 -1
  49. data/spec/pg/type_map_in_ruby_spec.rb +1 -1
  50. data/spec/pg/type_map_spec.rb +1 -1
  51. data/spec/pg/type_spec.rb +184 -12
  52. data/spec/pg_spec.rb +2 -2
  53. metadata +37 -33
  54. metadata.gz.sig +0 -0
  55. data/lib/pg/deprecated_constants.rb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d459edbf441a30095d92512f986194a7e183efe9
4
- data.tar.gz: 90ba3a4e5b506aa68d9addab7e8af76f5efcee8e
2
+ SHA256:
3
+ metadata.gz: a66c426de7c3035db5c8412a38b7f551bc50f7e6563b0b0de78515fd3ae7e825
4
+ data.tar.gz: 5c528696d8ebd74de4e53dec34efede57cbf06c62defe35b25b37f7986e746e1
5
5
  SHA512:
6
- metadata.gz: 0212d8cb8cd8a29ab8f120d6d1c4a90087107fd273785b53fa6b59e1583c48eb350420a53132a51ab6e9c1d10ccb821fa2924b850b14fbf8a759fe915d73251b
7
- data.tar.gz: b3bbd17f06fb3ab2a7864bbdeeead245c7f47348c618e39fb732f20b58f46591bac774844438fe410c96fbd460dbaa204c705e1617d62a4c74d3da18e425c001
6
+ metadata.gz: a4d8f2671a07a483efab8dd62701eea5a327eba332c5d9dce9f670d3db0b968e335e630d04f7f68b2f74ce9fb0c9da0f936a6ed839040fffbaf5710467f6e2c3
7
+ data.tar.gz: 482f9f0bc7f3cb6645897debb05d7e1258790b7c63cd275ee7f9e29f47b82f2f9f78fb4b49a2f7c629a0494663c98aee198e4788931074164ec9e9f9e09b0f43
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,98 @@
1
+ == v1.1.4 [2019-01-08] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ - Fix PG::BinaryDecoder::Timestamp on 32 bit systems. # 284
4
+ - Add new error-codes of PostgreSQL-11.
5
+ - Add ruby-2.6 support for Windows fat binary gems and remove ruby-2.0 and 2.1.
6
+
7
+
8
+ == v1.1.3 [2018-09-06] Michael Granger <ged@FaerieMUD.org>
9
+
10
+ - Revert opimization that was sometimes causing EBADF in rb_wait_for_single_fd().
11
+
12
+
13
+ == v1.1.2 [2018-08-28] Michael Granger <ged@FaerieMUD.org>
14
+
15
+ - Don't generate aliases for JOHAB encoding.
16
+ This avoids linking to deprecated/private function rb_enc(db)_alias().
17
+
18
+
19
+ == v1.1.1 [2018-08-27] Michael Granger <ged@FaerieMUD.org>
20
+
21
+ - Reduce deprecation warnings to only one message per deprecation.
22
+
23
+
24
+ == v1.1.0 [2018-08-24] Michael Granger <ged@FaerieMUD.org>
25
+
26
+ Deprecated (disable warnings per PG_SKIP_DEPRECATION_WARNING=1):
27
+ - Forwarding conn.exec to conn.exec_params is deprecated.
28
+ - Forwarding conn.exec_params to conn.exec is deprecated.
29
+ - Forwarding conn.async_exec to conn.async_exec_params.
30
+ - Forwarding conn.send_query to conn.send_query_params is deprecated.
31
+ - Forwarding conn.async_exec_params to conn.async_exec is deprecated.
32
+
33
+ PG::Connection enhancements:
34
+ - Provide PG::Connection#sync_* and PG::Connection#async_* query methods for explicit calling syncronous or asynchronous libpq API.
35
+ - Make PG::Connection#exec and siblings switchable between sync and async API per PG::Connection.async_api= and change the default to async flavors.
36
+ - Add async flavors of exec_params, prepare, exec_prepared, describe_prepared and describe_portal.
37
+ They are identical to their syncronous counterpart, but make use of PostgreSQL's async API.
38
+ - Replace `rb_thread_fd_select()` by faster `rb_wait_for_single_fd()` in `conn.block` and `conn.async_exec` .
39
+ - Add PG::Connection#discard_results .
40
+ - Raise an ArgumentError for strings containing zero bytes by #escape, #escape_literal, #escape_identifier, #quote_ident and PG::TextEncoder::Identifier. These methods previously truncated strings.
41
+
42
+ Result retrieval enhancements:
43
+ - Add PG::Result#tuple_values to retrieve all field values of a row as array.
44
+ - Add PG::Tuple, PG::Result#tuple and PG::Result#stream_each_tuple .
45
+ PG::Tuple offers a way to lazy cast result values.
46
+ - Estimate PG::Result size allocated by libpq and notify the garbage collector about it when running on Ruby-2.4 or newer.
47
+ - Make the estimated PG::Result size available to ObjectSpace.memsize_of(result) .
48
+
49
+ Type cast enhancements:
50
+ - Replace Ruby code by a faster C implementation of the SimpleDecoder's timestamp decode functions. github #20
51
+ - Interpret years with up to 7 digists and BC dates by timestamp decoder.
52
+ - Add text timestamp decoders for UTC vs. local timezone variations.
53
+ - Add text timestamp encoders for UTC timezone.
54
+ - Add decoders for binary timestamps: PG::BinaryDecoder::Timestamp and variations.
55
+ - Add PG::Coder#flags accessor to allow modifications of de- respectively encoder behaviour.
56
+ - Add a flag to raise TypeError for invalid input values to PG::TextDecoder::Array .
57
+ - Add a text decoder for inet/cidr written in C.
58
+ - Add a numeric decoder written in C.
59
+ - Ensure input text is zero terminated for text format in PG::Coder#decode .
60
+
61
+ Source code enhancements:
62
+ - Fix headers and permission bits of various repository files.
63
+
64
+ Bugfixes:
65
+ - Properly decode array with prepended dimensions. #272
66
+ For now dimension decorations are ignored, but a correct Array is returned.
67
+ - Array-Decoder: Avoid leaking memory when an Exception is raised while parsing. Fixes #279
68
+
69
+
70
+ == v1.0.0 [2018-01-10] Michael Granger <ged@FaerieMUD.org>
71
+
72
+ Deprecated:
73
+ - Deprecate Ruby older than 2.2.
74
+ - Deprecate Connection#socket in favor of #socket_io.
75
+
76
+ Removed:
77
+ - Remove compatibility code for Ruby < 2.0 and PostgreSQL < 9.2.
78
+ - Remove partial compatibility with Rubinius.
79
+ - Remove top-level constants PGconn, PGresult, and PGError.
80
+
81
+ Enhancements:
82
+ - Update error codes to PostgreSQL-10
83
+ - Update Windows binary gems to Ruby-2.5, PostgreSQL 10.1 and
84
+ OpenSSL 1.1.0g.
85
+
86
+ Bugfixes:
87
+ - Fix URI detection for connection strings. #265 (thanks to jjoos)
88
+ - MINGW: Workaround segfault due to GCC linker error in conjunction with MSVC.
89
+ This happens when linking to PostgreSQL-10.0-x64 from EnterpriseDB.
90
+
91
+ Documentation fixes:
92
+ - Add PostgreSQL version since when the given function is supported. #263
93
+ - Better documentation to `encoder` and `decoder` arguments of COPY related methods.
94
+
95
+
1
96
  == v0.21.0 [2017-06-12] Michael Granger <ged@FaerieMUD.org>
2
97
 
3
98
  Enhancements:
@@ -10,6 +105,9 @@ Enhancements:
10
105
  Documentation fixes:
11
106
  - Update the docs for PG::Result#cmd_tuples
12
107
 
108
+ New Samples:
109
+ - Add an example of the nicer #copy_data way of doing `COPY`.
110
+
13
111
 
14
112
  == v0.20.0 [2017-03-10] Michael Granger <ged@FaerieMUD.org>
15
113
 
@@ -29,6 +29,7 @@ ext/pg_errors.c
29
29
  ext/pg_result.c
30
30
  ext/pg_text_decoder.c
31
31
  ext/pg_text_encoder.c
32
+ ext/pg_tuple.c
32
33
  ext/pg_type_map.c
33
34
  ext/pg_type_map_all_strings.c
34
35
  ext/pg_type_map_by_class.c
@@ -43,21 +44,24 @@ ext/vc/pg_18/pg.vcproj
43
44
  ext/vc/pg_19/pg_19.vcproj
44
45
  lib/pg.rb
45
46
  lib/pg/basic_type_mapping.rb
47
+ lib/pg/binary_decoder.rb
46
48
  lib/pg/coder.rb
47
49
  lib/pg/connection.rb
48
50
  lib/pg/constants.rb
49
- lib/pg/deprecated_constants.rb
50
51
  lib/pg/exceptions.rb
51
52
  lib/pg/result.rb
52
53
  lib/pg/text_decoder.rb
53
54
  lib/pg/text_encoder.rb
55
+ lib/pg/tuple.rb
54
56
  lib/pg/type_map_by_column.rb
55
57
  spec/data/expected_trace.out
56
58
  spec/data/random_binary_data
57
59
  spec/helpers.rb
58
60
  spec/pg/basic_type_mapping_spec.rb
59
61
  spec/pg/connection_spec.rb
62
+ spec/pg/connection_sync_spec.rb
60
63
  spec/pg/result_spec.rb
64
+ spec/pg/tuple_spec.rb
61
65
  spec/pg/type_map_by_class_spec.rb
62
66
  spec/pg/type_map_by_column_spec.rb
63
67
  spec/pg/type_map_by_mri_type_spec.rb
@@ -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 9.1 and later}[http://www.postgresql.org/support/versioning/].
14
+ It works with {PostgreSQL 9.2 and later}[http://www.postgresql.org/support/versioning/].
15
15
 
16
16
  A small example usage:
17
17
 
@@ -37,13 +37,24 @@ A small example usage:
37
37
 
38
38
  == Requirements
39
39
 
40
- * Ruby 2.2
41
- * PostgreSQL 9.1.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).
42
42
 
43
43
  It usually work with earlier versions of Ruby/PostgreSQL as well, but those are
44
44
  not regularly tested.
45
45
 
46
46
 
47
+ == Versioning
48
+
49
+ We tag and release gems according to the {Semantic Versioning}[http://semver.org/] principle.
50
+
51
+ As a result of this policy, you can (and should) specify a dependency on this gem using the {Pessimistic Version Constraint}[http://guides.rubygems.org/patterns/#pessimistic-version-constraint] with two digits of precision.
52
+
53
+ For example:
54
+
55
+ spec.add_dependency 'pg', '~> 1.0'
56
+
57
+
47
58
  == How To Install
48
59
 
49
60
  Install via RubyGems:
@@ -165,4 +176,3 @@ to this library over the years.
165
176
 
166
177
  We are thankful to the people at the ruby-list and ruby-dev mailing lists.
167
178
  And to the people who developed PostgreSQL.
168
-
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env rake
1
+ # -*- rake -*-
2
2
 
3
3
  require 'rbconfig'
4
4
  require 'pathname'
@@ -61,7 +61,7 @@ $hoespec = Hoe.spec 'pg' do
61
61
  self.developer 'Lars Kanis', 'lars@greiz-reinsdorf.de'
62
62
 
63
63
  self.dependency 'rake-compiler', '~> 1.0', :developer
64
- self.dependency 'rake-compiler-dock', '~> 0.6', :developer
64
+ self.dependency 'rake-compiler-dock', ['~> 0.7.0'], :developer
65
65
  self.dependency 'hoe-deveiate', '~> 0.9', :developer
66
66
  self.dependency 'hoe-bundler', '~> 1.0', :developer
67
67
  self.dependency 'rspec', '~> 3.5', :developer
@@ -105,8 +105,6 @@ task :maint do
105
105
  ENV['MAINTAINER_MODE'] = 'yes'
106
106
  end
107
107
 
108
- ENV['RUBY_CC_VERSION'] ||= '1.8.7:1.9.2:2.0.0'
109
-
110
108
  # Rake-compiler task
111
109
  Rake::ExtensionTask.new do |ext|
112
110
  ext.name = 'pg_ext'
@@ -155,6 +153,7 @@ end
155
153
  file '.hg/branch' do
156
154
  warn "WARNING: You need the Mercurial repo to update the ChangeLog"
157
155
  end
156
+ Rake::Task["ChangeLog"].clear
158
157
  file 'ChangeLog' do |task|
159
158
  if File.exist?('.hg/branch')
160
159
  $stderr.puts "Updating the changelog..."
@@ -185,7 +184,7 @@ end
185
184
 
186
185
  desc "Update list of server error codes"
187
186
  task :update_error_codes do
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"
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_11_1"
189
188
 
190
189
  ERRORCODES_TXT = "ext/errorcodes.txt"
191
190
  sh "wget #{URL_ERRORCODES_TXT.inspect} -O #{ERRORCODES_TXT.inspect} || curl #{URL_ERRORCODES_TXT.inspect} -o #{ERRORCODES_TXT.inspect}"
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env rake
1
+ # -*- rake -*-
2
2
 
3
3
  require 'uri'
4
4
  require 'tempfile'
@@ -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.2j'
33
- self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '9.6.2'
32
+ self.openssl_version = ENV['OPENSSL_VERSION'] || '1.1.1a'
33
+ self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '11.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
 
@@ -297,6 +293,6 @@ task 'gem:windows' => ['ChangeLog'] do
297
293
  mkdir ~/.gem &&
298
294
  (cp build/gem/gem-*.pem ~/.gem/ || true) &&
299
295
  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
296
+ rake cross native gem MAKE="make -j`nproc`"
301
297
  EOT
302
298
  end
@@ -186,6 +186,10 @@
186
186
  VALUE klass = define_error_class( "InvalidParameterValue", "22" );
187
187
  register_error_class( "22023", klass );
188
188
  }
189
+ {
190
+ VALUE klass = define_error_class( "InvalidPrecedingOrFollowingSize", "22" );
191
+ register_error_class( "22013", klass );
192
+ }
189
193
  {
190
194
  VALUE klass = define_error_class( "InvalidRegularExpression", "22" );
191
195
  register_error_class( "2201B", klass );
@@ -230,6 +234,10 @@
230
234
  VALUE klass = define_error_class( "NumericValueOutOfRange", "22" );
231
235
  register_error_class( "22003", klass );
232
236
  }
237
+ {
238
+ VALUE klass = define_error_class( "SequenceGeneratorLimitExceeded", "22" );
239
+ register_error_class( "2200H", klass );
240
+ }
233
241
  {
234
242
  VALUE klass = define_error_class( "StringDataLengthMismatch", "22" );
235
243
  register_error_class( "22026", klass );
@@ -587,6 +595,10 @@
587
595
  VALUE klass = define_error_class( "WrongObjectType", "42" );
588
596
  register_error_class( "42809", klass );
589
597
  }
598
+ {
599
+ VALUE klass = define_error_class( "GeneratedAlways", "42" );
600
+ register_error_class( "428C9", klass );
601
+ }
590
602
  {
591
603
  VALUE klass = define_error_class( "UndefinedColumn", "42" );
592
604
  register_error_class( "42703", klass );
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env ruby
1
+ # -*- ruby -*-
2
2
 
3
3
  def camelize(lower_case_and_underscored_word)
4
4
  lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
@@ -2,7 +2,7 @@
2
2
  # errcodes.txt
3
3
  # PostgreSQL error codes
4
4
  #
5
- # Copyright (c) 2003-2016, PostgreSQL Global Development Group
5
+ # Copyright (c) 2003-2018, 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
@@ -177,6 +177,7 @@ Section: Class 22 - Data Exception
177
177
  22P06 E ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER nonstandard_use_of_escape_character
178
178
  22010 E ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE invalid_indicator_parameter_value
179
179
  22023 E ERRCODE_INVALID_PARAMETER_VALUE invalid_parameter_value
180
+ 22013 E ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE invalid_preceding_or_following_size
180
181
  2201B E ERRCODE_INVALID_REGULAR_EXPRESSION invalid_regular_expression
181
182
  2201W E ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE invalid_row_count_in_limit_clause
182
183
  2201X E ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE invalid_row_count_in_result_offset_clause
@@ -188,6 +189,7 @@ Section: Class 22 - Data Exception
188
189
  22004 E ERRCODE_NULL_VALUE_NOT_ALLOWED null_value_not_allowed
189
190
  22002 E ERRCODE_NULL_VALUE_NO_INDICATOR_PARAMETER null_value_no_indicator_parameter
190
191
  22003 E ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE numeric_value_out_of_range
192
+ 2200H E ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED sequence_generator_limit_exceeded
191
193
  22026 E ERRCODE_STRING_DATA_LENGTH_MISMATCH string_data_length_mismatch
192
194
  22001 E ERRCODE_STRING_DATA_RIGHT_TRUNCATION string_data_right_truncation
193
195
  22011 E ERRCODE_SUBSTRING_ERROR substring_error
@@ -326,6 +328,7 @@ Section: Class 42 - Syntax Error or Access Rule Violation
326
328
  42P21 E ERRCODE_COLLATION_MISMATCH collation_mismatch
327
329
  42P22 E ERRCODE_INDETERMINATE_COLLATION indeterminate_collation
328
330
  42809 E ERRCODE_WRONG_OBJECT_TYPE wrong_object_type
331
+ 428C9 E ERRCODE_GENERATED_ALWAYS generated_always
329
332
 
330
333
  # Note: for ERRCODE purposes, we divide namable objects into these categories:
331
334
  # databases, schemas, prepared statements, cursors, tables, columns,
@@ -60,48 +60,30 @@ abort "Can't find the PostgreSQL client library (libpq)" unless
60
60
  have_library( 'libpq', 'PQconnectdb', ['libpq-fe.h'] ) ||
61
61
  have_library( 'ms/libpq', 'PQconnectdb', ['libpq-fe.h'] )
62
62
 
63
+ if /mingw/ =~ RUBY_PLATFORM && RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/
64
+ # Work around: https://sourceware.org/bugzilla/show_bug.cgi?id=22504
65
+ checking_for "workaround gcc version with link issue" do
66
+ `#{RbConfig::MAKEFILE_CONFIG['CC']} --version`.chomp =~ /\s(\d+)\.\d+\.\d+(\s|$)/ &&
67
+ $1.to_i >= 6 &&
68
+ have_library(':libpq.lib') # Prefer linking to libpq.lib over libpq.dll if available
69
+ end
70
+ end
71
+
63
72
  # optional headers/functions
64
- have_func 'PQconnectionUsedPassword' or
73
+ have_func 'PQsetSingleRowMode' or
65
74
  abort "Your PostgreSQL is too old. Either install an older version " +
66
- "of this gem or upgrade your database."
67
- have_func 'PQisthreadsafe'
68
- have_func 'PQprepare'
69
- have_func 'PQexecParams'
70
- have_func 'PQescapeString'
71
- have_func 'PQescapeStringConn'
72
- have_func 'PQescapeLiteral'
73
- have_func 'PQescapeIdentifier'
74
- have_func 'PQgetCancel'
75
- have_func 'lo_create'
76
- have_func 'pg_encoding_to_char'
77
- have_func 'pg_char_to_encoding'
78
- have_func 'PQsetClientEncoding'
79
- have_func 'PQlibVersion'
80
- have_func 'PQping'
81
- have_func 'PQsetSingleRowMode'
75
+ "of this gem or upgrade your database to at least PostgreSQL-9.2."
82
76
  have_func 'PQconninfo'
83
77
  have_func 'PQsslAttribute'
78
+ have_func 'PQencryptPasswordConn'
79
+ have_func 'timegm'
80
+ have_func 'rb_gc_adjust_memory_usage'
84
81
 
85
- have_func 'rb_encdb_alias'
86
- have_func 'rb_enc_alias'
87
- have_func 'rb_thread_call_without_gvl'
88
- have_func 'rb_thread_call_with_gvl'
89
- have_func 'rb_thread_fd_select'
90
- have_func 'rb_w32_wrap_io_handle'
91
- have_func 'rb_str_modify_expand'
92
- have_func 'rb_hash_dup'
93
-
94
- have_const 'PGRES_COPY_BOTH', 'libpq-fe.h'
95
- have_const 'PGRES_SINGLE_TUPLE', 'libpq-fe.h'
96
82
  have_const 'PG_DIAG_TABLE_NAME', 'libpq-fe.h'
97
83
 
98
- $defs.push( "-DHAVE_ST_NOTIFY_EXTRA" ) if
99
- have_struct_member 'struct pgNotify', 'extra', 'libpq-fe.h'
100
-
101
84
  # unistd.h confilicts with ruby/win32.h when cross compiling for win32 and ruby 1.9.1
102
85
  have_header 'unistd.h'
103
86
  have_header 'inttypes.h'
104
- have_header 'ruby/st.h' or have_header 'st.h' or abort "pg currently requires the ruby/st.h header"
105
87
 
106
88
  checking_for "C99 variable length arrays" do
107
89
  $defs.push( "-DHAVE_VARIABLE_LENGTH_ARRAYS" ) if try_compile('void test_vla(int l){ int vla[l]; }')