Skip to content

Commit 352b7d0

Browse files
committed
[postgres] preliminary (temp) fix for Marshal.dump broken since 1.3.8 (fixes #573)
1 parent a427d05 commit 352b7d0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/arjdbc/postgresql/column.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,24 @@ def infinity(options = {})
327327
::Float::INFINITY * (options[:negative] ? -1 : 1)
328328
end if AR4_COMPAT
329329

330+
private
331+
332+
# TODO marshaling worked in 1.3.7 ,,, got broken in 1.3.8 (due @adapter)
333+
# but the fix introduced in 1.3.10 causes backwards (1.3) incompatibility
334+
# ... for now should be fine - there's likely more refactoring to happen!
335+
336+
def marshal_dump
337+
# NOTE: disabled oid_type ... due range warnings (maybe they're fine) :
338+
# unknown OID 3904: failed to recognize type of 'int4_range'. It will be treated as String.
339+
#oid_type if respond_to?(:oid_type)
340+
@adapter = nil
341+
instance_variables.map { |var| [ var, instance_variable_get(var) ] }
342+
end
343+
344+
def marshal_load(data)
345+
data.each { |pair| instance_variable_set( pair[0], pair[1] ) }
346+
end
347+
330348
# @note Based on *active_record/connection_adapters/postgresql/cast.rb* (4.0).
331349
module Cast
332350

0 commit comments

Comments
 (0)