From 864e5a27be288230ed6afefc53c33b1a37505be6 Mon Sep 17 00:00:00 2001 From: Nick Marino Date: Tue, 29 Aug 2023 17:49:26 -0400 Subject: [PATCH] psql-srv: Use passthrough when decoding unsupported text format params This ties together the last couple of commits that add support for sending text passthrough parameters, and actually starts using it so that we can proxy unsupported types for parameters in text mode. Fixes: #266 Fixes: REA-3183 Release-Note-Core: Fix proxying of Postgres queries that use the Postgres text protocol to send query parameters when those parameters use types that aren't natively supported by ReadySet. Change-Id: Ia9116b0cbd8e237963fce59c543b57f678c5871f Reviewed-on: https://gerrit.readyset.name/c/readyset/+/5932 Tested-by: Buildkite CI Reviewed-by: Dan Wilbanks --- psql-srv/src/codec/decoder.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/psql-srv/src/codec/decoder.rs b/psql-srv/src/codec/decoder.rs index a6f333bf55..079b66626b 100644 --- a/psql-srv/src/codec/decoder.rs +++ b/psql-srv/src/codec/decoder.rs @@ -470,7 +470,11 @@ fn get_text_value(src: &mut Bytes, t: &Type) -> Result { Type::BIT => get_bitvec_from_str(text_str).map(PsqlValue::Bit), Type::VARBIT => get_bitvec_from_str(text_str).map(PsqlValue::VarBit), ref t if t.name() == "citext" => Ok(PsqlValue::Text(text_str.into())), - _ => Err(Error::UnsupportedType(t.clone())), + _ => Ok(PsqlValue::PassThrough(readyset_data::PassThrough { + ty: t.clone(), + format: PassThroughFormat::Text, + data: text.as_bytes().to_vec().into_boxed_slice(), + })), } }