diff --git a/encode.go b/encode.go index 73cafb89..65cbb9b9 100644 --- a/encode.go +++ b/encode.go @@ -92,7 +92,7 @@ func binaryDecode(parameterStatus *parameterStatus, s []byte, typ oid.Oid) inter func textDecode(parameterStatus *parameterStatus, s []byte, typ oid.Oid) interface{} { switch typ { - case oid.T_char, oid.T_varchar, oid.T_text: + case oid.T_char, oid.T_bpchar, oid.T_varchar, oid.T_text: return string(s) case oid.T_bytea: b, err := parseBytea(s) diff --git a/encode_test.go b/encode_test.go index 813643c2..5fc5fe4f 100644 --- a/encode_test.go +++ b/encode_test.go @@ -607,7 +607,7 @@ func TestBinaryByteSliceToInt(t *testing.T) { func TestTextDecodeIntoString(t *testing.T) { input := []byte("hello world") want := string(input) - for _, typ := range []oid.Oid{oid.T_char, oid.T_varchar, oid.T_text} { + for _, typ := range []oid.Oid{oid.T_char, oid.T_bpchar, oid.T_varchar, oid.T_text} { got := decode(¶meterStatus{}, input, typ, formatText) if got != want { t.Errorf("invalid string decoding output for %T(%+v), got %v but expected %v", typ, typ, got, want)