pg 1.5.2 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79eb5b70c2045456b11a407f31913f728593cb196090f7bc1e94f012e1e37070
4
- data.tar.gz: d6b9f0685a71e45482cb9c776fc8e092e7aa810d6a74364eb809f217a8cd09f1
3
+ metadata.gz: 7cbac60d76e50f034bb84d601d55d816cd3d3b8c05a3067b9ccd3103fc293699
4
+ data.tar.gz: e9e5d36b50bd17e8cfd3d2191a0bbc499ca09a466f9c73dc81c2799be82a3346
5
5
  SHA512:
6
- metadata.gz: 8125aac41396b831d5a1986a80ceee2376c79ebc9ce5607c5739f7285ee0e4069dbd636b98ba51722b251f210c6295199bcd8589af7b77a9816a4156d190fa22
7
- data.tar.gz: feed68644345ae49bd4d1f2ce62571ea25ef8c8e7d032552096575a832b67595a84b18de09c6bdb9d007d3a845837ee9a6e031b746aa212d342580ab89bd793b
6
+ metadata.gz: b9bc096fb5410cc044f0f5fb7f688d8047fcc5c7ea8ff025bb6ada32f92288f1f6c076da157e8812aa01a47fe2b025798bafa92aab7fd1294bfcc60f03e53f09
7
+ data.tar.gz: 120f870057de3c7552e4beef0c81dd90e5ce03a4557bf3b01d518197596dfa149c7612375028451c0b07f6714567ee5e2c80040ec9470226d045e6b9fc3153eb
checksums.yaml.gz.sig CHANGED
Binary file
data/History.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## v1.5.3 [2023-04-28] Lars Kanis <lars@greiz-reinsdorf.de>
2
+
3
+ - Fix possible segfault when creating a new PG::Result with type map. [#530](https://github.com/ged/ruby-pg/pull/530)
4
+ - Add category to deprecation warnings of Coder.new, so that they are suppressed for most users. [#528](https://github.com/ged/ruby-pg/pull/528)
5
+
6
+
7
+ ## v1.5.2 [2023-04-26] Lars Kanis <lars@greiz-reinsdorf.de>
8
+
9
+ - Fix regression in copy_data regarding binary format when using no coder. [#527](https://github.com/ged/ruby-pg/pull/527)
10
+
11
+
1
12
  ## v1.5.1 [2023-04-24] Lars Kanis <lars@greiz-reinsdorf.de>
2
13
 
3
14
  - Don't overwrite flags of timestamp coders. [#524](https://github.com/ged/ruby-pg/pull/524)
data/ext/pg_result.c CHANGED
@@ -208,12 +208,16 @@ pg_new_result2(PGresult *result, VALUE rb_pgconn)
208
208
 
209
209
  this = (t_pg_result *)xmalloc(sizeof(*this) + sizeof(*this->fnames) * nfields);
210
210
  this->pgresult = result;
211
+ /* Initialize connection and typemap prior to any object allocations,
212
+ * to make sure valid objects are marked. */
213
+ this->connection = rb_pgconn;
214
+ this->typemap = pg_typemap_all_strings;
215
+ this->p_typemap = RTYPEDDATA_DATA( this->typemap );
211
216
  this->nfields = -1;
212
217
  this->tuple_hash = Qnil;
213
218
  this->field_map = Qnil;
214
219
  this->flags = 0;
215
220
  self = TypedData_Wrap_Struct(rb_cPGresult, &pgresult_type, this);
216
- RB_OBJ_WRITE(self, &this->connection, rb_pgconn);
217
221
 
218
222
  if( result ){
219
223
  t_pg_connection *p_conn = pg_get_connection(rb_pgconn);
@@ -227,8 +231,6 @@ pg_new_result2(PGresult *result, VALUE rb_pgconn)
227
231
  this->p_typemap = RTYPEDDATA_DATA( this->typemap );
228
232
  this->flags = p_conn->flags;
229
233
  } else {
230
- RB_OBJ_WRITE(self, &this->typemap, pg_typemap_all_strings);
231
- this->p_typemap = RTYPEDDATA_DATA( this->typemap );
232
234
  this->enc_idx = rb_locale_encindex();
233
235
  }
234
236
 
@@ -391,7 +393,7 @@ pg_result_clear(VALUE self)
391
393
  *
392
394
  */
393
395
  VALUE
394
- pg_result_freeze(VALUE self)
396
+ static pg_result_freeze(VALUE self)
395
397
  {
396
398
  t_pg_result *this = pgresult_get_this(self);
397
399
 
@@ -405,7 +407,7 @@ pg_result_freeze(VALUE self)
405
407
  *
406
408
  * Returns +true+ if the backend result memory has been freed.
407
409
  */
408
- VALUE
410
+ static VALUE
409
411
  pgresult_cleared_p( VALUE self )
410
412
  {
411
413
  t_pg_result *this = pgresult_get_this(self);
@@ -422,7 +424,7 @@ pgresult_cleared_p( VALUE self )
422
424
  * All other Result objects are automatically cleared by the GC when the object is no longer in use or manually by PG::Result#clear .
423
425
  *
424
426
  */
425
- VALUE
427
+ static VALUE
426
428
  pgresult_autoclear_p( VALUE self )
427
429
  {
428
430
  t_pg_result *this = pgresult_get_this(self);
@@ -1422,8 +1424,9 @@ pgresult_type_map_set(VALUE self, VALUE typemap)
1422
1424
  /* Check type of method param */
1423
1425
  TypedData_Get_Struct(typemap, t_typemap, &pg_typemap_type, p_typemap);
1424
1426
 
1425
- RB_OBJ_WRITE(self, &this->typemap, p_typemap->funcs.fit_to_result( typemap, self ));
1426
- this->p_typemap = RTYPEDDATA_DATA( this->typemap );
1427
+ typemap = p_typemap->funcs.fit_to_result( typemap, self );
1428
+ RB_OBJ_WRITE(self, &this->typemap, typemap);
1429
+ this->p_typemap = RTYPEDDATA_DATA( typemap );
1427
1430
 
1428
1431
  return typemap;
1429
1432
  }
@@ -287,9 +287,7 @@ pg_tmbc_init(VALUE self, VALUE conv_ary)
287
287
  t_pg_coder *p_coder;
288
288
  /* Check argument type and store the coder pointer */
289
289
  TypedData_Get_Struct(obj, t_pg_coder, &pg_coder_type, p_coder);
290
- if( p_coder ){
291
- RB_OBJ_WRITTEN(self, Qnil, p_coder->coder_obj);
292
- }
290
+ RB_OBJ_WRITTEN(self, Qnil, p_coder->coder_obj);
293
291
  this->convs[i].cconv = p_coder;
294
292
  }
295
293
  }
@@ -6,19 +6,19 @@ module PG
6
6
  # Convenience classes for timezone options
7
7
  class TimestampUtc < Timestamp
8
8
  def initialize(hash={}, **kwargs)
9
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
9
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
10
10
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_UTC)
11
11
  end
12
12
  end
13
13
  class TimestampUtcToLocal < Timestamp
14
14
  def initialize(hash={}, **kwargs)
15
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
15
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
16
16
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_LOCAL)
17
17
  end
18
18
  end
19
19
  class TimestampLocal < Timestamp
20
20
  def initialize(hash={}, **kwargs)
21
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
21
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
22
22
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_LOCAL | PG::Coder::TIMESTAMP_APP_LOCAL)
23
23
  end
24
24
  end
@@ -6,13 +6,13 @@ module PG
6
6
  # Convenience classes for timezone options
7
7
  class TimestampUtc < Timestamp
8
8
  def initialize(hash={}, **kwargs)
9
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
9
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
10
10
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_UTC)
11
11
  end
12
12
  end
13
13
  class TimestampLocal < Timestamp
14
14
  def initialize(hash={}, **kwargs)
15
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
15
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
16
16
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_LOCAL)
17
17
  end
18
18
  end
data/lib/pg/coder.rb CHANGED
@@ -7,7 +7,7 @@ module PG
7
7
 
8
8
  module BinaryFormatting
9
9
  def initialize(hash={}, **kwargs)
10
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
10
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
11
11
  super(format: 1, **hash, **kwargs)
12
12
  end
13
13
  end
@@ -15,7 +15,7 @@ module PG
15
15
 
16
16
  # Create a new coder object based on the attribute Hash.
17
17
  def initialize(hash=nil, **kwargs)
18
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" if hash
18
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) if hash
19
19
 
20
20
  (hash || kwargs).each do |key, val|
21
21
  send("#{key}=", val)
@@ -6,19 +6,19 @@ module PG
6
6
  # Convenience classes for timezone options
7
7
  class TimestampUtc < Timestamp
8
8
  def initialize(hash={}, **kwargs)
9
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
9
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
10
10
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_UTC)
11
11
  end
12
12
  end
13
13
  class TimestampUtcToLocal < Timestamp
14
14
  def initialize(hash={}, **kwargs)
15
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
15
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
16
16
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_LOCAL)
17
17
  end
18
18
  end
19
19
  class TimestampLocal < Timestamp
20
20
  def initialize(hash={}, **kwargs)
21
- warn "PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}" unless hash.empty?
21
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
22
22
  super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_LOCAL | PG::Coder::TIMESTAMP_APP_LOCAL)
23
23
  end
24
24
  end
data/lib/pg/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module PG
2
2
  # Library version
3
- VERSION = '1.5.2'
3
+ VERSION = '1.5.3'
4
4
  end
data/lib/pg.rb CHANGED
@@ -115,4 +115,15 @@ module PG
115
115
  require 'pg/tuple'
116
116
  autoload :VERSION, 'pg/version'
117
117
 
118
+
119
+ # Avoid "uninitialized constant Truffle::WarningOperations" on Truffleruby up to 22.3.1
120
+ if RUBY_ENGINE=="truffleruby" && !defined?(Truffle::WarningOperations)
121
+ module TruffleFixWarn
122
+ def warn(str, category=nil)
123
+ super(str)
124
+ end
125
+ end
126
+ Warning.extend(TruffleFixWarn)
127
+ end
128
+
118
129
  end # module PG
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
@@ -34,7 +34,7 @@ cert_chain:
34
34
  Dzx/gFSOrRoCt2mXNgrmcAfr386AfaMvCh7cXqdxZwmVo7ILZCYXck0pajvubsDd
35
35
  NUIIFkVXvd1odFyK9LF1RFAtxn/iAmpx
36
36
  -----END CERTIFICATE-----
37
- date: 2023-04-26 00:00:00.000000000 Z
37
+ date: 2023-04-28 00:00:00.000000000 Z
38
38
  dependencies: []
39
39
  description: Pg is the Ruby interface to the PostgreSQL RDBMS. It works with PostgreSQL
40
40
  9.3 and later.
metadata.gz.sig CHANGED
Binary file