From 1dcbed8f8682f26700ba64593ef38f01947d7967 Mon Sep 17 00:00:00 2001 From: StrikeW Date: Fri, 25 Oct 2024 16:16:46 +0800 Subject: [PATCH] fix(pg-cdc): handle citext data type and other string compatible data types (#19103) --- src/common/src/types/from_sql.rs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/common/src/types/from_sql.rs b/src/common/src/types/from_sql.rs index ba1d49892c602..76746bbb871fb 100644 --- a/src/common/src/types/from_sql.rs +++ b/src/common/src/types/from_sql.rs @@ -36,10 +36,22 @@ impl<'a> FromSql<'a> for ScalarImpl { Type::JSONB => ScalarImpl::from(JsonbVal::from_sql(ty, raw)?), Type::INTERVAL => ScalarImpl::from(Interval::from_sql(ty, raw)?), Type::BYTEA => ScalarImpl::from(Vec::::from_sql(ty, raw)?.into_boxed_slice()), - Type::VARCHAR | Type::TEXT => ScalarImpl::from(String::from_sql(ty, raw)?), + Type::VARCHAR | Type::TEXT | Type::BPCHAR => { + ScalarImpl::from(String::from_sql(ty, raw)?) + } + ref ty + if (ty.name() == "citext" + || ty.name() == "ltree" + || ty.name() == "lquery" + || ty.name() == "ltxtquery") => + { + ScalarImpl::from(String::from_sql(ty, raw)?) + } // Serial, Int256, Struct, List and Decimal are not supported here // Note: The Decimal type is specially handled in the `ScalarAdapter`. - _ => bail_not_implemented!("the postgres decoding for {ty} is unsupported"), + _ => { + bail_not_implemented!("the postgres decoding for {ty} is unsupported") + } }) } @@ -61,6 +73,10 @@ impl<'a> FromSql<'a> for ScalarImpl { | Type::BYTEA | Type::VARCHAR | Type::TEXT - ) + | Type::BPCHAR + ) || (ty.name() == "citext" + || ty.name() == "ltree" + || ty.name() == "lquery" + || ty.name() == "ltxtquery") } }