diff --git a/lib/pg/basic_type_registry.rb b/lib/pg/basic_type_registry.rb index a3a164d30..4a6daaa70 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 fc74ab03f..1bdcfa8f4 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 + it "should do anonymous record type conversions" do + [0].each do |format| + 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 + it "should do inet type conversions" do [0].each do |format| vals = [