diff --git a/lib/pg/basic_type_registry.rb b/lib/pg/basic_type_registry.rb index a3a164d3..4a6daaa7 100644 --- a/lib/pg/basic_type_registry.rb +++ b/lib/pg/basic_type_registry.rb @@ -278,6 +278,7 @@ def register_default_types register_type 0, 'inet', PG::TextEncoder::Inet, PG::TextDecoder::Inet alias_type 0, 'cidr', 'inet' + register_type 0, 'record', PG::TextEncoder::Record, PG::TextDecoder::Record register_type 1, 'int2', PG::BinaryEncoder::Int2, PG::BinaryDecoder::Integer diff --git a/spec/pg/basic_type_map_for_results_spec.rb b/spec/pg/basic_type_map_for_results_spec.rb index 85fffbcb..04e46abc 100644 --- a/spec/pg/basic_type_map_for_results_spec.rb +++ b/spec/pg/basic_type_map_for_results_spec.rb @@ -316,6 +316,16 @@ end end + [0].each do |format| + it "should do format #{format} anonymous record type conversions" do + res = @conn.exec_params( "SELECT 6, ROW(123, 'str', true, null), 7 + ", [], format ) + expect( res.getvalue(0,0) ).to eq( 6 ) + expect( res.getvalue(0,1) ).to eq( ["123", "str", "t", nil] ) + expect( res.getvalue(0,2) ).to eq( 7 ) + end + end + [0].each do |format| it "should do format #{format} inet type conversions" do vals = [