pg 1.3.5 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bb3782224d0c471417ceaa47d1355d5a06be2590fb3671fde73882346db0c5c
4
- data.tar.gz: cd728b238d0b174f02a31c38afbd990177f81eec8516a1c953ee7bade1ddb4c6
3
+ metadata.gz: b41083be640213b535bce480cc5001eb076fb805a36dece37ad143e3d0528d09
4
+ data.tar.gz: 1ec6569ed34148a889cdee8d4f1ffbfd9d303929d6b96b752060ffcca84560df
5
5
  SHA512:
6
- metadata.gz: d7b3ad8293281fb830274dc0e3d6e3c59c1dca85ea4f112f0aaf3a7629f61e315747f1e6ecad96e7a9528d42eeb3baafb819b7360d02acfc636ae7cb2d24ef42
7
- data.tar.gz: f2476f2c7b1950346adf87c3675b838b9c57c909d6d787b50f4cf418ccb51296a02677faac7910378a665daa087f2aa552375f72ca42ba428e539cf07e80392c
6
+ metadata.gz: 82f8662a194ba0e49afde6b29b9cf87c0dcaef3328c4f04693f785e5cb2b405e686f14a23a4d52ad1d875e4fca4d52f98865da3fd36ff0b10c994080b1cd8cd3
7
+ data.tar.gz: 87ed2d9a1a0e1ce7792126468baa6d7ab3af377edd39855d6a3753554439ff24adb86467d0ea1c6f75f386df96cb16f4649d553da860b1c099a5fd61c36c8787
checksums.yaml.gz.sig CHANGED
Binary file
@@ -45,7 +45,7 @@ jobs:
45
45
  include:
46
46
  - ruby: "3.1"
47
47
  platform: "x64-mingw-ucrt"
48
- PGVERSION: 14.2-1-windows-x64
48
+ PGVERSION: 15.1-1-windows-x64
49
49
  - ruby: "2.5"
50
50
  platform: "x64-mingw32"
51
51
  PGVERSION: 10.20-1-windows
@@ -83,4 +83,4 @@ jobs:
83
83
  - run: bundle install
84
84
  - run: gem install --local pg-*${{ matrix.platform }}.gem --verbose
85
85
  - name: Run specs
86
- run: ruby -rpg -S rspec spec/**/*_spec.rb
86
+ run: ruby -rpg -S rspec -fd spec/**/*_spec.rb
@@ -31,15 +31,15 @@ jobs:
31
31
  include:
32
32
  - os: windows
33
33
  ruby: "head"
34
- PGVERSION: 14.2-1-windows-x64
35
- PGVER: "14"
34
+ PGVERSION: 15.1-1-windows-x64
35
+ PGVER: "15"
36
36
  - os: windows
37
37
  ruby: "2.5"
38
38
  PGVERSION: 9.4.26-1-windows-x64
39
39
  PGVER: "9.4"
40
40
  - os: ubuntu
41
41
  ruby: "head"
42
- PGVER: "14"
42
+ PGVER: "15"
43
43
  - os: ubuntu
44
44
  ruby: "3.1"
45
45
  PGVER: "12"
@@ -51,16 +51,17 @@ jobs:
51
51
  PGVER: "13"
52
52
  - os: ubuntu
53
53
  ruby: "truffleruby-head"
54
- PGVER: "14"
54
+ PGVER: "15"
55
55
  - os: macos
56
56
  ruby: "head"
57
- PGVERSION: 14.2-1-osx
58
- PGVER: "14"
57
+ PGVERSION: 15.1-1-osx
58
+ PGVER: "15"
59
59
 
60
60
  runs-on: ${{ matrix.os }}-latest
61
61
  env:
62
62
  PGVERSION: ${{ matrix.PGVERSION }}
63
63
  PGVER: ${{ matrix.PGVER }}
64
+ MAKE: make -j2 V=1
64
65
 
65
66
  steps:
66
67
  - uses: actions/checkout@v2
@@ -107,8 +108,9 @@ jobs:
107
108
  if: matrix.os == 'macos'
108
109
  run: |
109
110
  wget https://get.enterprisedb.com/postgresql/postgresql-$PGVERSION-binaries.zip && \
110
- unzip postgresql-$PGVERSION-binaries.zip && \
111
- echo `pwd`/pgsql/bin >> $GITHUB_PATH
111
+ sudo mkdir -p /Library/PostgreSQL && \
112
+ sudo unzip postgresql-$PGVERSION-binaries.zip -d /Library/PostgreSQL/$PGVER && \
113
+ echo /Library/PostgreSQL/$PGVER/bin >> $GITHUB_PATH
112
114
 
113
115
  - run: gem update --system
114
116
  - run: bundle install
data/History.rdoc CHANGED
@@ -1,3 +1,68 @@
1
+ == v1.4.5 [2022-11-17] Lars Kanis <lars@greiz-reinsdorf.de>
2
+
3
+ - Return the libpq default port when blank in conninfo. #492
4
+ - Add PG::DEF_PGPORT constant and use it in specs. #492
5
+ - Fix name resolution when empty or `nil` port is given.
6
+ - Update error codes to PostgreSQL-15.
7
+ - Update Windows fat binary gem to PostgreSQL-15.1 AND OpenSSL-1.1.1s.
8
+
9
+
10
+ == v1.4.4 [2022-10-11] Lars Kanis <lars@greiz-reinsdorf.de>
11
+
12
+ - Revert to let libpq do the host iteration while connecting. #485
13
+ Ensure that parameter `connect_timeout` is still respected.
14
+ - Handle multiple hosts in the connection string, where only one host has writable session. #476
15
+ - Add some useful information to PG::Connection#inspect. #487
16
+ - Support new pgresult_stream_any API in sequel_pg-1.17.0. #481
17
+ - Update Windows fat binary gem to PostgreSQL-14.5.
18
+
19
+
20
+ == v1.4.3 [2022-08-09] Lars Kanis <lars@greiz-reinsdorf.de>
21
+
22
+ - Avoid memory bloat possible in put_copy_data in pg-1.4.0 to 1.4.2. #473
23
+ - Use Encoding::BINARY for JOHAB, removing some useless code. #472
24
+
25
+
26
+ == v1.4.2 [2022-07-27] Lars Kanis <lars@greiz-reinsdorf.de>
27
+
28
+ Bugfixes:
29
+
30
+ - Properly handle empty host parameter when connecting. #471
31
+ - Update Windows fat binary gem to OpenSSL-1.1.1q.
32
+
33
+
34
+ == v1.4.1 [2022-06-24] Lars Kanis <lars@greiz-reinsdorf.de>
35
+
36
+ Bugfixes:
37
+
38
+ - Fix another ruby-2.7 keyword warning. #465
39
+ - Allow PG::Error to be created without arguments. #466
40
+
41
+
42
+ == v1.4.0 [2022-06-20] Lars Kanis <lars@greiz-reinsdorf.de>
43
+
44
+ Added:
45
+
46
+ - Add PG::Connection#hostaddr, present since PostgreSQL-12. #453
47
+ - Add PG::Connection.conninfo_parse to wrap PQconninfoParse. #453
48
+
49
+ Bugfixes:
50
+
51
+ - Try IPv6 and IPv4 addresses, if DNS resolves to both. #452
52
+ - Re-add block-call semantics to PG::Connection.new accidently removed in pg-1.3.0. #454
53
+ - Handle client error after all data consumed in #copy_data for output. #455
54
+ - Avoid spurious keyword argument warning on Ruby 2.7. #456
55
+ - Change connection setup to respect connect_timeout parameter. #459
56
+ - Fix indefinite hang in case of connection error on Windows #458
57
+ - Set connection attribute of PG::Error in various places where it was missing. #461
58
+ - Fix transaction leak on early break/return. #463
59
+ - Update Windows fat binary gem to OpenSSL-1.1.1o and PostgreSQL-14.4.
60
+
61
+ Enhancements:
62
+
63
+ - Don't flush at each put_copy_data call, but flush at get_result. #462
64
+
65
+
1
66
  == v1.3.5 [2022-03-31] Lars Kanis <lars@greiz-reinsdorf.de>
2
67
 
3
68
  Bugfixes:
data/README.rdoc CHANGED
@@ -171,12 +171,31 @@ The following type maps are prefilled with type mappings from the PG::BasicTypeR
171
171
  To report bugs, suggest features, or check out the source with Git,
172
172
  {check out the project page}[https://github.com/ged/ruby-pg].
173
173
 
174
- After checking out the source, run:
174
+ After checking out the source, install all dependencies:
175
175
 
176
- $ rake newb
176
+ $ bundle install
177
177
 
178
- This task will install any missing dependencies, run the tests/specs, and
179
- generate the API documentation.
178
+ Cleanup extension files, packaging files, test databases:
179
+
180
+ $ rake clean
181
+
182
+ Compile extension:
183
+
184
+ $ rake compile
185
+
186
+ Run tests/specs with PostgreSQL tools like `initdb` in the path:
187
+
188
+ $ PATH=$PATH:/usr/lib/postgresql/14/bin rake test
189
+
190
+ Or run a specific test with the line number:
191
+
192
+ $ PATH=$PATH:/usr/lib/postgresql/14/bin rspec -Ilib -fd spec/pg/connection_spec.rb:455
193
+
194
+ Generate the API documentation:
195
+
196
+ $ rake docs
197
+
198
+ Make sure, that all bugs and new features are verified by tests.
180
199
 
181
200
  The current maintainers are Michael Granger <ged@FaerieMUD.org> and
182
201
  Lars Kanis <lars@greiz-reinsdorf.de>.
@@ -184,7 +203,7 @@ Lars Kanis <lars@greiz-reinsdorf.de>.
184
203
 
185
204
  == Copying
186
205
 
187
- Copyright (c) 1997-2019 by the authors.
206
+ Copyright (c) 1997-2022 by the authors.
188
207
 
189
208
  * Jeff Davis <ruby-pg@j-davis.com>
190
209
  * Guy Decoux (ts) <decoux@moulon.inra.fr>
data/Rakefile CHANGED
@@ -16,14 +16,14 @@ LIBDIR = BASEDIR + 'lib'
16
16
  EXTDIR = BASEDIR + 'ext'
17
17
  PKGDIR = BASEDIR + 'pkg'
18
18
  TMPDIR = BASEDIR + 'tmp'
19
- TESTDIR = BASEDIR + "tmp_test_specs"
19
+ TESTDIR = BASEDIR + "tmp_test_*"
20
20
 
21
21
  DLEXT = RbConfig::CONFIG['DLEXT']
22
22
  EXT = LIBDIR + "pg_ext.#{DLEXT}"
23
23
 
24
24
  GEMSPEC = 'pg.gemspec'
25
25
 
26
- CLOBBER.include( TESTDIR.to_s )
26
+ CLEAN.include( TESTDIR.to_s )
27
27
  CLEAN.include( PKGDIR.to_s, TMPDIR.to_s )
28
28
  CLEAN.include "lib/*/libpq.dll"
29
29
  CLEAN.include "lib/pg_ext.*"
@@ -92,7 +92,7 @@ end
92
92
 
93
93
  desc "Update list of server error codes"
94
94
  task :update_error_codes do
95
- URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=refs/tags/REL_14_0"
95
+ URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=refs/tags/REL_15_0"
96
96
 
97
97
  ERRORCODES_TXT = "ext/errorcodes.txt"
98
98
  sh "wget #{URL_ERRORCODES_TXT.inspect} -O #{ERRORCODES_TXT.inspect} || curl #{URL_ERRORCODES_TXT.inspect} -o #{ERRORCODES_TXT.inspect}"
data/Rakefile.cross CHANGED
@@ -31,8 +31,8 @@ class CrossLibrary < OpenStruct
31
31
  self.host_platform = toolchain
32
32
 
33
33
  # Cross-compilation constants
34
- self.openssl_version = ENV['OPENSSL_VERSION'] || '1.1.1m'
35
- self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '14.2'
34
+ self.openssl_version = ENV['OPENSSL_VERSION'] || '1.1.1s'
35
+ self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '15.1'
36
36
 
37
37
  # Check if symlinks work in the current working directory.
38
38
  # This fails, if rake-compiler-dock is running on a Windows box.
data/ext/errorcodes.def CHANGED
@@ -366,6 +366,10 @@
366
366
  VALUE klass = define_error_class( "SqlJsonScalarRequired", "22" );
367
367
  register_error_class( "2203F", klass );
368
368
  }
369
+ {
370
+ VALUE klass = define_error_class( "SqlJsonItemCannotBeCastToTargetType", "22" );
371
+ register_error_class( "2203G", klass );
372
+ }
369
373
  {
370
374
  VALUE klass = define_error_class( "IntegrityConstraintViolation", NULL );
371
375
  register_error_class( "23000", 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-2021, PostgreSQL Global Development Group
5
+ # Copyright (c) 2003-2022, 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
@@ -222,6 +222,7 @@ Section: Class 22 - Data Exception
222
222
  2203D E ERRCODE_TOO_MANY_JSON_ARRAY_ELEMENTS too_many_json_array_elements
223
223
  2203E E ERRCODE_TOO_MANY_JSON_OBJECT_MEMBERS too_many_json_object_members
224
224
  2203F E ERRCODE_SQL_JSON_SCALAR_REQUIRED sql_json_scalar_required
225
+ 2203G E ERRCODE_SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE sql_json_item_cannot_be_cast_to_target_type
225
226
 
226
227
  Section: Class 23 - Integrity Constraint Violation
227
228
 
data/ext/extconf.rb CHANGED
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require 'pp'
4
2
  require 'mkmf'
5
3
 
@@ -169,32 +167,3 @@ end
169
167
  create_header()
170
168
  create_makefile( "pg_ext" )
171
169
 
172
-
173
- def message!(important_message)
174
- message important_message
175
- if !$stdout.tty? && File.chardev?('/dev/tty')
176
- File.open('/dev/tty', 'w') do |tty|
177
- tty.print important_message
178
- end
179
- end
180
- rescue
181
- end
182
-
183
- if "2022-04-01" == Time.now.strftime("%Y-%m-%d")
184
- message! <<-EOM
185
- ===================================================================
186
- HEADS UP! Prepare for pg-1.4.2022 ! 🎉🎉🎉
187
-
188
- Now that psycopg3 has most of the features of ruby-pg, we plan to
189
- switch to using it as our foundation for the next pg release.
190
- It will run through pycall and requires a working python setup.
191
- This will minimize our development and maintenance efforts, since
192
- it allows us to use one and the same code base for both programming
193
- languages - ruby and python. 👏😃
194
-
195
- And we follow the recent merge of the Django and Rails teams! ❤️
196
-
197
- Stay up-to-date at https://github.com/ged/ruby-pg/issues/449
198
- ===================================================================
199
- EOM
200
- end
data/ext/pg.c CHANGED
@@ -47,7 +47,6 @@
47
47
  */
48
48
 
49
49
  #include "pg.h"
50
- #include "pg_config.h"
51
50
 
52
51
  int pg_skip_deprecation_warning;
53
52
  VALUE rb_mPG;
@@ -127,26 +126,6 @@ const char * const (pg_enc_pg2ruby_mapping[][2]) = {
127
126
  static struct st_table *enc_pg2ruby;
128
127
 
129
128
 
130
- /*
131
- * Look up the JOHAB encoding, creating it as a dummy encoding if it's not
132
- * already defined.
133
- */
134
- static rb_encoding *
135
- pg_find_or_create_johab(void)
136
- {
137
- static const char * const aliases[] = { "JOHAB", "Windows-1361", "CP1361" };
138
- int enc_index;
139
- size_t i;
140
-
141
- for (i = 0; i < sizeof(aliases)/sizeof(aliases[0]); ++i) {
142
- enc_index = rb_enc_find_index(aliases[i]);
143
- if (enc_index > 0) return rb_enc_from_index(enc_index);
144
- }
145
-
146
- enc_index = rb_define_dummy_encoding(aliases[0]);
147
- return rb_enc_from_index(enc_index);
148
- }
149
-
150
129
  /*
151
130
  * Return the given PostgreSQL encoding ID as an rb_encoding.
152
131
  *
@@ -187,10 +166,6 @@ pg_get_pg_encname_as_rb_encoding( const char *pg_encname )
187
166
  return rb_enc_find( pg_enc_pg2ruby_mapping[i][1] );
188
167
  }
189
168
 
190
- /* JOHAB isn't a builtin encoding, so make up a dummy encoding if it's seen */
191
- if ( strncmp(pg_encname, "JOHAB", 5) == 0 )
192
- return pg_find_or_create_johab();
193
-
194
169
  /* Fallthrough to ASCII-8BIT */
195
170
  return rb_ascii8bit_encoding();
196
171
  }
@@ -377,7 +352,7 @@ pg_s_init_ssl(VALUE self, VALUE do_ssl)
377
352
  **************************************************************************/
378
353
 
379
354
  void
380
- Init_pg_ext()
355
+ Init_pg_ext(void)
381
356
  {
382
357
  if( RTEST(rb_eval_string("ENV['PG_SKIP_DEPRECATION_WARNING']")) ){
383
358
  /* Set all bits to disable all deprecation warnings. */
@@ -704,6 +679,9 @@ Init_pg_ext()
704
679
  rb_define_const(rb_mPGconstants, "INVALID_OID", INT2FIX(InvalidOid));
705
680
  rb_define_const(rb_mPGconstants, "InvalidOid", INT2FIX(InvalidOid));
706
681
 
682
+ /* PostgreSQL compiled in default port */
683
+ rb_define_const(rb_mPGconstants, "DEF_PGPORT", INT2FIX(DEF_PGPORT));
684
+
707
685
  /* Add the constants to the toplevel namespace */
708
686
  rb_include_module( rb_mPG, rb_mPGconstants );
709
687
 
data/ext/pg.h CHANGED
@@ -57,6 +57,7 @@
57
57
  #endif
58
58
 
59
59
  /* PostgreSQL headers */
60
+ #include "pg_config.h"
60
61
  #include "libpq-fe.h"
61
62
  #include "libpq/libpq-fs.h" /* large-object interface */
62
63
  #include "pg_config_manual.h"
@@ -205,7 +205,7 @@ pg_bin_dec_timestamp(t_pg_coder *conv, const char *val, int len, int tuple, int
205
205
  */
206
206
 
207
207
  void
208
- init_pg_binary_decoder()
208
+ init_pg_binary_decoder(void)
209
209
  {
210
210
  /* This module encapsulates all decoder classes with binary input format */
211
211
  rb_mPG_BinaryDecoder = rb_define_module_under( rb_mPG, "BinaryDecoder" );
@@ -139,7 +139,7 @@ pg_bin_enc_from_base64(t_pg_coder *conv, VALUE value, char *out, VALUE *intermed
139
139
  }
140
140
 
141
141
  void
142
- init_pg_binary_encoder()
142
+ init_pg_binary_encoder(void)
143
143
  {
144
144
  /* This module encapsulates all encoder classes with binary output format */
145
145
  rb_mPG_BinaryEncoder = rb_define_module_under( rb_mPG, "BinaryEncoder" );
data/ext/pg_coder.c CHANGED
@@ -537,7 +537,7 @@ pg_coder_dec_func(t_pg_coder *this, int binary)
537
537
 
538
538
 
539
539
  void
540
- init_pg_coder()
540
+ init_pg_coder(void)
541
541
  {
542
542
  s_id_encode = rb_intern("encode");
543
543
  s_id_decode = rb_intern("decode");