pg 0.19.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data/ChangeLog +218 -1
  4. data/History.rdoc +106 -0
  5. data/Manifest.txt +5 -18
  6. data/README.rdoc +15 -5
  7. data/Rakefile +8 -9
  8. data/Rakefile.cross +19 -22
  9. data/ext/errorcodes.def +17 -0
  10. data/ext/errorcodes.rb +1 -1
  11. data/ext/errorcodes.txt +11 -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 +19 -48
  16. data/ext/pg.h +46 -81
  17. data/ext/pg_binary_decoder.c +69 -6
  18. data/ext/pg_coder.c +53 -4
  19. data/ext/pg_connection.c +401 -253
  20. data/ext/pg_copy_coder.c +10 -5
  21. data/ext/pg_result.c +359 -131
  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/pg_type_map.c +14 -7
  26. data/ext/util.c +6 -6
  27. data/ext/util.h +2 -2
  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 -7
  32. data/lib/pg/constants.rb +1 -1
  33. data/lib/pg/exceptions.rb +1 -1
  34. data/lib/pg/result.rb +6 -5
  35. data/lib/pg/text_decoder.rb +19 -23
  36. data/lib/pg/text_encoder.rb +36 -2
  37. data/lib/pg/tuple.rb +30 -0
  38. data/lib/pg/type_map_by_column.rb +1 -1
  39. data/lib/pg.rb +21 -11
  40. data/spec/helpers.rb +47 -19
  41. data/spec/pg/basic_type_mapping_spec.rb +230 -27
  42. data/spec/pg/connection_spec.rb +402 -275
  43. data/spec/pg/connection_sync_spec.rb +41 -0
  44. data/spec/pg/result_spec.rb +59 -17
  45. data/spec/pg/tuple_spec.rb +280 -0
  46. data/spec/pg/type_map_by_class_spec.rb +2 -2
  47. data/spec/pg/type_map_by_column_spec.rb +1 -1
  48. data/spec/pg/type_map_by_mri_type_spec.rb +1 -1
  49. data/spec/pg/type_map_by_oid_spec.rb +1 -1
  50. data/spec/pg/type_map_in_ruby_spec.rb +1 -1
  51. data/spec/pg/type_map_spec.rb +1 -1
  52. data/spec/pg/type_spec.rb +184 -12
  53. data/spec/pg_spec.rb +2 -2
  54. data.tar.gz.sig +0 -0
  55. metadata +47 -53
  56. metadata.gz.sig +0 -0
  57. data/sample/array_insert.rb +0 -20
  58. data/sample/async_api.rb +0 -106
  59. data/sample/async_copyto.rb +0 -39
  60. data/sample/async_mixed.rb +0 -56
  61. data/sample/check_conn.rb +0 -21
  62. data/sample/copyfrom.rb +0 -81
  63. data/sample/copyto.rb +0 -19
  64. data/sample/cursor.rb +0 -21
  65. data/sample/disk_usage_report.rb +0 -186
  66. data/sample/issue-119.rb +0 -94
  67. data/sample/losample.rb +0 -69
  68. data/sample/minimal-testcase.rb +0 -17
  69. data/sample/notify_wait.rb +0 -72
  70. data/sample/pg_statistics.rb +0 -294
  71. data/sample/replication_monitor.rb +0 -231
  72. data/sample/test_binary_values.rb +0 -33
  73. data/sample/wal_shipper.rb +0 -434
  74. data/sample/warehouse_partitions.rb +0 -320
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f8e328ce8e21a558a72a6c58d723905babf80f22
4
- data.tar.gz: ac9256c75e16561725e5e371c9765b26f6b0502e
2
+ SHA256:
3
+ metadata.gz: 412c807a50f306e6328752a9b678423bc69530d23039c7d5089cb021037f174d
4
+ data.tar.gz: 4f670f1536a8e69b835b43d2b1863552bca4542711323aad9cfdba58118ef051
5
5
  SHA512:
6
- metadata.gz: 9273e0d8a1b916251beb4146e3eae48d62bddeed5082c2174b39c5e3c48b1d09f1141efa99f76bfe942d3083ef505349e17374a9fe798b7bceec802109723504
7
- data.tar.gz: 64ae211c8d2cf4566e199bb55919089dd639d6df1ca2d98423947ef956437af8cea4202659f8cdfa3af6a718b8a7f44d23baa5c4d6a8e0e67d568a1d0b261e47
6
+ metadata.gz: d28cbd788013f390e2b458ac41ea8e6f88890691679d66477da39a986f2218e7c5454058b6f0c002e8964bcc2defb10fd73efe8fb324e354db0555c5bf04fa6b
7
+ data.tar.gz: 10ceb6ab1fed9ad3acb2f114f84c40dccbc77fc4a0c22cb186fa10d53fbb25977043cb34f9fcdedb742957b156658f9580ec5eb35442c88a453ad27b8994a566
checksums.yaml.gz.sig CHANGED
Binary file
data/ChangeLog CHANGED
@@ -1,3 +1,220 @@
1
+ 2017-06-12 Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * Closing branch.
4
+ [d199582de47f] [tip] <olleolleolle/readmerdoc-use-svg-for-travis-build-badg-1489403729779>
5
+
6
+ * Merge with bitbucket upstream
7
+ [7cb095bb8e34]
8
+
9
+ 2017-06-12 Lars Kanis <lars@greiz-reinsdorf.de>
10
+
11
+ * Merged in olleolleolle/ruby-pg/olleolleolle/readmerdoc-use-svg-for-
12
+ travis-build-badg-1489403729779 (pull request #24)
13
+
14
+ README.rdoc: use SVG for Travis build badge
15
+ [97eca85fc660]
16
+
17
+ 2017-03-13 Olle Jonsson <olle.jonsson@gmail.com>
18
+
19
+ * README.rdoc:
20
+ README.rdoc: use SVG for Travis build badge
21
+ [75dcedbff32e] <olleolleolle/readmerdoc-use-svg-for-travis-build-badg-1489403729779>
22
+
23
+ 2017-06-12 Michael Granger <ged@FaerieMUD.org>
24
+
25
+ * .hgignore, .hoerc, History.rdoc, Manifest.txt, lib/pg.rb:
26
+ Bunp minor version, update history, fix manifest/ignore files
27
+ [4729196c11cb]
28
+
29
+ * Merged with bitbucket default
30
+ [f6063a34ae2b]
31
+
32
+ 2017-04-07 Lars Kanis <lars@greiz-reinsdorf.de>
33
+
34
+ * lib/pg.rb:
35
+ Move add_dll_directory to the Runtime namespace.
36
+
37
+ RubyInstaller::Runtime.add_dll_directory is deprecated with
38
+ rubyinstaller-2.4.1-1rc1.
39
+ [050a996456b1]
40
+
41
+ 2017-05-31 Michael Granger <ged@FaerieMUD.org>
42
+
43
+ * Rakefile, lib/pg.rb, lib/pg/connection.rb,
44
+ lib/pg/deprecated_constants.rb, lib/pg/result.rb, pg.gemspec:
45
+ Deprecate the old PGconn, PGresult, and PGError constants.
46
+ [3ce331d8c88e]
47
+
48
+ 2017-06-01 Michael Granger <ged@FaerieMUD.org>
49
+
50
+ * ext/pg_result.c, pg.gemspec, sample/copydata.rb:
51
+ Fix the docs for PG::Result#cmd_tuples
52
+
53
+ Also add an example of the nicer #copy_data way of doing `COPY`.
54
+ [c4a1abc36c47]
55
+
56
+ 2017-03-13 Michael Granger <ged@FaerieMUD.org>
57
+
58
+ * .gems, .rvm.gems, Rakefile, pg.gemspec:
59
+ Update dependencies to latest versions
60
+ [8a15026cfe77]
61
+
62
+ * .hgignore:
63
+ Ignore bundler vendor directory
64
+ [fff7debf0630]
65
+
66
+ * Rakefile.cross:
67
+ Bump Postgresql version for windows binary to 9.6.2
68
+ [11296e69a17f]
69
+
70
+ 2017-03-10 Michael Granger <ged@FaerieMUD.org>
71
+
72
+ * .hgtags:
73
+ Added tag v0.20.0 for changeset e5eb92cca97a
74
+ [409cae555174]
75
+
76
+ * .hgsigs:
77
+ Added signature for changeset 838985377b48
78
+ [e5eb92cca97a] [v0.20.0]
79
+
80
+ * History.rdoc, lib/pg.rb, pg.gemspec:
81
+ Bump the minor version, update history.
82
+ [838985377b48]
83
+
84
+ * .hgignore:
85
+ Ignore .lock files
86
+ [379c198c7185]
87
+
88
+ 2017-02-16 Lars Kanis <lars@greiz-reinsdorf.de>
89
+
90
+ * lib/pg.rb:
91
+ Use block.call instead of yield in proc context
92
+
93
+ yield in a proc context requires Ruby-2.2.
94
+ [aa91b4b14b5c]
95
+
96
+ 2017-01-24 Lars Kanis <lars@greiz-reinsdorf.de>
97
+
98
+ * History.rdoc:
99
+ Update History file regarding RI2 support.
100
+ [d52339653fe3]
101
+
102
+ * lib/pg.rb:
103
+ Add support for RubyInstaller2 to Windows binary gem.
104
+
105
+ RI2 ignores PATH setting for DLL search, but provides it's own API.
106
+ [87fe14131d78]
107
+
108
+ 2017-01-14 Lars Kanis <lars@greiz-reinsdorf.de>
109
+
110
+ * History.rdoc:
111
+ Update History file. [ci-skip]
112
+ [0d1921b825d7]
113
+
114
+ * Rakefile.cross:
115
+ Update Windows binary rubies to support 2.0 to 2.4
116
+ [3736e33ce71e]
117
+
118
+ * ext/pg_connection.c, ext/pg_result.c:
119
+ Change all Fixnum to Integer in documentation.
120
+
121
+ Fixnum are deprecated in Ruby-2.4.
122
+ [2e17f315848e]
123
+
124
+ * ext/pg_type_map.c:
125
+ Avoid compiler warnings about noreturn-functions:
126
+
127
+ ../../../../ext/pg_type_map.c: In function
128
+ ‘pg_typemap_fit_to_result’: ../../../../ext/pg_type_map.c:15:1:
129
+ warning: function might be candidate for attribute ‘noreturn’
130
+ [-Wsuggest-attribute=noreturn] pg_typemap_fit_to_result( VALUE self,
131
+ VALUE result )
132
+ [2af122820861]
133
+
134
+ * spec/pg/type_map_by_class_spec.rb:
135
+ Bignum,Fixnum and Integer are the same in Ruby-2.4.
136
+
137
+ Fixes #255 : https://bitbucket.org/ged/ruby-pg/issues/255
138
+ [a446dfaf9d8f]
139
+
140
+ * Rakefile, pg.gemspec:
141
+ Update rake-compiler and rake-compiler-dock
142
+
143
+ This adds support for Ruby-2.4 on Windows and Ruby version
144
+ constraints for binary gems.
145
+ [6ebcebaad39c]
146
+
147
+ * ext/pg_coder.c:
148
+ Fix method arguments for Coder#encode in documentation.
149
+ [ee79cce8b141]
150
+
151
+ 2016-12-04 Lars Kanis <lars@greiz-reinsdorf.de>
152
+
153
+ * History.rdoc, lib/pg/result.rb, spec/pg/result_spec.rb:
154
+ Fix Result#inspect on a cleared result.
155
+ [0c60865f718e]
156
+
157
+ 2016-11-09 Lars Kanis <lars@greiz-reinsdorf.de>
158
+
159
+ * Merge branch 'master' of github.com:larskanis/ruby-pg
160
+ [db7c584532e5]
161
+
162
+ 2016-11-09 Lars Kanis <kanis@comcard.de>
163
+
164
+ * Rakefile.cross:
165
+ Don't download gems in the rake-compiler-dock, but use the local
166
+ installed gems.
167
+
168
+ This saves traffic and avoids download issues.
169
+ [14e6fa84d31c]
170
+
171
+ * Rakefile.cross:
172
+ Update cross postgres and openssl versions.
173
+ [a6ec62e2b783]
174
+
175
+ * Rakefile:
176
+ Fetch the errorcodes from a specific release version.
177
+
178
+ This avoids introduction of errorcodes, which are not yet released
179
+ and possibly subject to change.
180
+ [b399dae9e988]
181
+
182
+ * ext/errorcodes.def, ext/errorcodes.txt:
183
+ Update errorcodes to PostgreSQL version 9.6.1
184
+ [c1b690f2b47d]
185
+
186
+ 2016-11-09 Michael Granger <ged@FaerieMUD.org>
187
+
188
+ * History.rdoc:
189
+ Merged with d62b04efb055
190
+ [cefe252948ed]
191
+
192
+ 2016-10-21 Lars Kanis <lars@greiz-reinsdorf.de>
193
+
194
+ * lib/pg/text_encoder.rb:
195
+ Fix typo in JSON#encode
196
+ [d62b04efb055]
197
+
198
+ * History.rdoc, lib/pg/text_decoder.rb, lib/pg/text_encoder.rb:
199
+ Use secure JSON methods for JSON (de)serialisation.
200
+
201
+ This fixes issue #248 : https://bitbucket.org/ged/ruby-pg/issues/248
202
+ [fe3e883bead2]
203
+
204
+ 2016-09-21 Michael Granger <ged@FaerieMUD.org>
205
+
206
+ * .hgtags:
207
+ Added tag v0.19.0 for changeset bd2aaa2c5797
208
+ [5ed7106cc770]
209
+
210
+ * .hgsigs:
211
+ Added signature for changeset 8beaa5d72670
212
+ [bd2aaa2c5797] [v0.19.0]
213
+
214
+ * History.rdoc, lib/pg.rb:
215
+ Bump the minor version, update history.
216
+ [8beaa5d72670]
217
+
1
218
  2016-09-04 Lars Kanis <lars@greiz-reinsdorf.de>
2
219
 
3
220
  * ext/pg_connection.c:
@@ -5,7 +222,7 @@
5
222
 
6
223
  We don't really need an Array at all, but storing the values on the
7
224
  stack is enough.
8
- [4d9c4ee44d11] [tip]
225
+ [4d9c4ee44d11]
9
226
 
10
227
  * ext/pg_connection.c:
11
228
  Use the asynchronous interface for setting the default_encoding.
data/History.rdoc CHANGED
@@ -1,3 +1,109 @@
1
+ == v1.1.0 [2018-08-24] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Deprecated (disable warnings per PG_SKIP_DEPRECATION_WARNING=1):
4
+ - Forwarding conn.exec to conn.exec_params is deprecated.
5
+ - Forwarding conn.exec_params to conn.exec is deprecated.
6
+ - Forwarding conn.async_exec to conn.async_exec_params.
7
+ - Forwarding conn.send_query to conn.send_query_params is deprecated.
8
+ - Forwarding conn.async_exec_params to conn.async_exec is deprecated.
9
+
10
+ PG::Connection enhancements:
11
+ - Provide PG::Connection#sync_* and PG::Connection#async_* query methods for explicit calling syncronous or asynchronous libpq API.
12
+ - Make PG::Connection#exec and siblings switchable between sync and async API per PG::Connection.async_api= and change the default to async flavors.
13
+ - Add async flavors of exec_params, prepare, exec_prepared, describe_prepared and describe_portal.
14
+ They are identical to their syncronous counterpart, but make use of PostgreSQL's async API.
15
+ - Replace `rb_thread_fd_select()` by faster `rb_wait_for_single_fd()` in `conn.block` and `conn.async_exec` .
16
+ - Add PG::Connection#discard_results .
17
+ - 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.
18
+
19
+ Result retrieval enhancements:
20
+ - Add PG::Result#tuple_values to retrieve all field values of a row as array.
21
+ - Add PG::Tuple, PG::Result#tuple_values and PG::Result#stream_each_tuple .
22
+ PG::Tuple offers a way to lazy cast result values.
23
+ - Estimate PG::Result size allocated by libpq and notify the garbage collector about it when running on Ruby-2.4 or newer.
24
+ - Make the estimated PG::Result size available to ObjectSpace.memsize_of(result) .
25
+
26
+ Type cast enhancements:
27
+ - Replace Ruby code by a faster C implementation of the SimpleDecoder's timestamp decode functions. github #20
28
+ - Interpret years with up to 7 digists and BC dates by timestamp decoder.
29
+ - Add text timestamp decoders for UTC vs. local timezone variations.
30
+ - Add text timestamp encoders for UTC timezone.
31
+ - Add decoders for binary timestamps: PG::BinaryDecoder::Timestamp and variations.
32
+ - Add PG::Coder#flags accessor to allow modifications of de- respectively encoder behaviour.
33
+ - Add a flag to raise TypeError for invalid input values to PG::TextDecoder::Array .
34
+ - Add a text decoder for inet/cidr written in C.
35
+ - Add a numeric decoder written in C.
36
+ - Ensure input text is zero terminated for text format in PG::Coder#decode .
37
+
38
+ Source code enhancements:
39
+ - Fix headers and permission bits of various repository files.
40
+
41
+ Bugfixes:
42
+ - Properly decode array with prepended dimensions. #272
43
+ For now dimension decorations are ignored, but a correct Array is returned.
44
+ - Array-Decoder: Avoid leaking memory when an Exception is raised while parsing. Fixes #279
45
+
46
+
47
+ == v1.0.0 [2018-01-10] Michael Granger <ged@FaerieMUD.org>
48
+
49
+ Deprecated:
50
+ - Deprecate Ruby older than 2.2.
51
+ - Deprecate Connection#socket in favor of #socket_io.
52
+
53
+ Removed:
54
+ - Remove compatibility code for Ruby < 2.0 and PostgreSQL < 9.2.
55
+ - Remove partial compatibility with Rubinius.
56
+ - Remove top-level constants PGconn, PGresult, and PGError.
57
+
58
+ Enhancements:
59
+ - Update error codes to PostgreSQL-10
60
+ - Update Windows binary gems to Ruby-2.5, PostgreSQL 10.1 and
61
+ OpenSSL 1.1.0g.
62
+
63
+ Bugfixes:
64
+ - Fix URI detection for connection strings. #265 (thanks to jjoos)
65
+ - MINGW: Workaround segfault due to GCC linker error in conjunction with MSVC.
66
+ This happens when linking to PostgreSQL-10.0-x64 from EnterpriseDB.
67
+
68
+ Documentation fixes:
69
+ - Add PostgreSQL version since when the given function is supported. #263
70
+ - Better documentation to `encoder` and `decoder` arguments of COPY related methods.
71
+
72
+
73
+ == v0.21.0 [2017-06-12] Michael Granger <ged@FaerieMUD.org>
74
+
75
+ Enhancements:
76
+ - Move add_dll_directory to the Runtime namespace for newest versions
77
+ of RubyInstaller.
78
+ - Deprecate PGconn, PGresult, and PGError top-level constants; a warning
79
+ will be output the first time one of them is used. They will be
80
+ removed in the upcoming 1.0 release.
81
+
82
+ Documentation fixes:
83
+ - Update the docs for PG::Result#cmd_tuples
84
+
85
+ New Samples:
86
+ - Add an example of the nicer #copy_data way of doing `COPY`.
87
+
88
+
89
+ == v0.20.0 [2017-03-10] Michael Granger <ged@FaerieMUD.org>
90
+
91
+ Enhancements:
92
+ - Update error codes to PostgreSQL-9.6
93
+ - Update Windows binary gems to Ruby-2.4, PostgreSQL 9.6.1 and
94
+ OpenSSL 1.0.2j.
95
+ - Add support for RubyInstaller2 to Windows binary gems.
96
+
97
+ Bugfixes:
98
+ - Use secure JSON methods for JSON (de)serialisation. #248
99
+ - Fix Result#inspect on a cleared result.
100
+ - Fix test case that failed on Ruby-2.4. #255
101
+
102
+ Documentation fixes:
103
+ - Talk about Integer instead of Fixnum.
104
+ - Fix method signature of Coder#encode.
105
+
106
+
1
107
  == v0.19.0 [2016-09-21] Michael Granger <ged@FaerieMUD.org>
2
108
 
3
109
  - Deprecate Ruby 1.9
data/Manifest.txt CHANGED
@@ -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,6 +44,7 @@ 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
@@ -50,31 +52,16 @@ lib/pg/exceptions.rb
50
52
  lib/pg/result.rb
51
53
  lib/pg/text_decoder.rb
52
54
  lib/pg/text_encoder.rb
55
+ lib/pg/tuple.rb
53
56
  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
57
  spec/data/expected_trace.out
73
58
  spec/data/random_binary_data
74
59
  spec/helpers.rb
75
60
  spec/pg/basic_type_mapping_spec.rb
76
61
  spec/pg/connection_spec.rb
62
+ spec/pg/connection_sync_spec.rb
77
63
  spec/pg/result_spec.rb
64
+ spec/pg/tuple_spec.rb
78
65
  spec/pg/type_map_by_class_spec.rb
79
66
  spec/pg/type_map_by_column_spec.rb
80
67
  spec/pg/type_map_by_mri_type_spec.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 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
 
@@ -31,19 +31,30 @@ A small example usage:
31
31
 
32
32
  == Build Status
33
33
 
34
- {<img src="https://travis-ci.org/ged/ruby-pg.png?branch=master" alt="Build Status Travis-CI" />}[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 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'
@@ -60,12 +60,12 @@ $hoespec = Hoe.spec 'pg' do
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.5', :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
70
  self.spec_extras[:extensions] = [ 'ext/extconf.rb' ]
71
71
 
@@ -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=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_4"
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}"
data/Rakefile.cross CHANGED
@@ -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.2h'
33
- self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '9.5.4'
32
+ self.openssl_version = ENV['OPENSSL_VERSION'] || '1.1.0h'
33
+ self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '10.4'
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
 
@@ -291,11 +287,12 @@ task 'gem:windows' => ['ChangeLog'] do
291
287
  # Copy gem signing key and certs to be accessable from the docker container
292
288
  mkdir_p 'build/gem'
293
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
294
  (cp build/gem/gem-*.pem ~/.gem/ || true) &&
298
- bundle install &&
299
- rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.6:2.0.0:1.9.3
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 MAKE="make -j`nproc`"
300
297
  EOT
301
298
  end
data/ext/errorcodes.def CHANGED
@@ -230,6 +230,10 @@
230
230
  VALUE klass = define_error_class( "NumericValueOutOfRange", "22" );
231
231
  register_error_class( "22003", klass );
232
232
  }
233
+ {
234
+ VALUE klass = define_error_class( "SequenceGeneratorLimitExceeded", "22" );
235
+ register_error_class( "2200H", klass );
236
+ }
233
237
  {
234
238
  VALUE klass = define_error_class( "StringDataLengthMismatch", "22" );
235
239
  register_error_class( "22026", klass );
@@ -373,6 +377,10 @@
373
377
  VALUE klass = define_error_class( "InFailedSqlTransaction", "25" );
374
378
  register_error_class( "25P02", klass );
375
379
  }
380
+ {
381
+ VALUE klass = define_error_class( "IdleInTransactionSessionTimeout", "25" );
382
+ register_error_class( "25P03", klass );
383
+ }
376
384
  {
377
385
  VALUE klass = define_error_class( "InvalidSqlStatementName", NULL );
378
386
  register_error_class( "26000", klass );
@@ -583,6 +591,10 @@
583
591
  VALUE klass = define_error_class( "WrongObjectType", "42" );
584
592
  register_error_class( "42809", klass );
585
593
  }
594
+ {
595
+ VALUE klass = define_error_class( "GeneratedAlways", "42" );
596
+ register_error_class( "428C9", klass );
597
+ }
586
598
  {
587
599
  VALUE klass = define_error_class( "UndefinedColumn", "42" );
588
600
  register_error_class( "42703", klass );
@@ -793,6 +805,11 @@
793
805
  VALUE klass = define_error_class( "DuplicateFile", "58" );
794
806
  register_error_class( "58P02", klass );
795
807
  }
808
+ {
809
+ VALUE klass = define_error_class( "SnapshotTooOld", NULL );
810
+ register_error_class( "72000", klass );
811
+ register_error_class( "72", klass );
812
+ }
796
813
  {
797
814
  VALUE klass = define_error_class( "ConfigFileError", NULL );
798
815
  register_error_class( "F0000", klass );
data/ext/errorcodes.rb CHANGED
@@ -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 }