@@ -258,12 +258,36 @@ pub fn rows_to_arrow(rows: &[Row], projected_schema: &Option<SchemaRef>) -> Resu
258258 Type :: OID => {
259259 handle_primitive_type ! ( builder, Type :: OID , UInt32Builder , u32 , row, i) ;
260260 }
261+ Type :: XID => {
262+ let Some ( builder) = builder else {
263+ return NoBuilderForIndexSnafu { index : i } . fail ( ) ;
264+ } ;
265+ let Some ( builder) = builder. as_any_mut ( ) . downcast_mut :: < UInt32Builder > ( ) else {
266+ return FailedToDowncastBuilderSnafu {
267+ postgres_type : format ! ( "{postgres_type}" ) ,
268+ }
269+ . fail ( ) ;
270+ } ;
271+ let v = row
272+ . try_get :: < usize , Option < XidFromSql > > ( i)
273+ . with_context ( |_| FailedToGetRowValueSnafu { pg_type : Type :: XID } ) ?;
274+
275+ match v {
276+ Some ( v) => {
277+ builder. append_value ( v. xid ) ;
278+ }
279+ None => builder. append_null ( ) ,
280+ }
281+ }
261282 Type :: FLOAT4 => {
262283 handle_primitive_type ! ( builder, Type :: FLOAT4 , Float32Builder , f32 , row, i) ;
263284 }
264285 Type :: FLOAT8 => {
265286 handle_primitive_type ! ( builder, Type :: FLOAT8 , Float64Builder , f64 , row, i) ;
266287 }
288+ Type :: CHAR => {
289+ handle_primitive_type ! ( builder, Type :: CHAR , Int8Builder , i8 , row, i) ;
290+ }
267291 Type :: TEXT => {
268292 handle_primitive_type ! ( builder, Type :: TEXT , StringBuilder , & str , row, i) ;
269293 }
@@ -645,6 +669,14 @@ pub fn rows_to_arrow(rows: &[Row], projected_schema: &Option<SchemaRef>) -> Resu
645669 ListBuilder <Int64Builder >,
646670 i64
647671 ) ,
672+ Type :: OID_ARRAY => handle_primitive_array_type ! (
673+ Type :: OID_ARRAY ,
674+ builder,
675+ row,
676+ i,
677+ ListBuilder <UInt32Builder >,
678+ u32
679+ ) ,
648680 Type :: FLOAT4_ARRAY => handle_primitive_array_type ! (
649681 Type :: FLOAT4_ARRAY ,
650682 builder,
@@ -841,9 +873,10 @@ fn map_column_type_to_data_type(column_type: &Type) -> Option<DataType> {
841873 Type :: INT2 => Some ( DataType :: Int16 ) ,
842874 Type :: INT4 => Some ( DataType :: Int32 ) ,
843875 Type :: INT8 | Type :: MONEY => Some ( DataType :: Int64 ) ,
844- Type :: OID => Some ( DataType :: UInt32 ) ,
876+ Type :: OID | Type :: XID => Some ( DataType :: UInt32 ) ,
845877 Type :: FLOAT4 => Some ( DataType :: Float32 ) ,
846878 Type :: FLOAT8 => Some ( DataType :: Float64 ) ,
879+ Type :: CHAR => Some ( DataType :: Int8 ) ,
847880 Type :: TEXT | Type :: VARCHAR | Type :: BPCHAR | Type :: UUID | Type :: NAME => Some ( DataType :: Utf8 ) ,
848881 Type :: BYTEA => Some ( DataType :: Binary ) ,
849882 Type :: BOOL => Some ( DataType :: Boolean ) ,
@@ -859,6 +892,7 @@ fn map_column_type_to_data_type(column_type: &Type) -> Option<DataType> {
859892 Arc :: new ( Field :: new ( "item" , DataType :: Float64 , true ) ) ,
860893 2 ,
861894 ) ) ,
895+ Type :: PG_NODE_TREE => Some ( DataType :: Utf8 ) ,
862896 Type :: INT2_ARRAY => Some ( DataType :: List ( Arc :: new ( Field :: new (
863897 "item" ,
864898 DataType :: Int16 ,
@@ -874,6 +908,11 @@ fn map_column_type_to_data_type(column_type: &Type) -> Option<DataType> {
874908 DataType :: Int64 ,
875909 true ,
876910 ) ) ) ) ,
911+ Type :: OID_ARRAY => Some ( DataType :: List ( Arc :: new ( Field :: new (
912+ "item" ,
913+ DataType :: UInt32 ,
914+ true ,
915+ ) ) ) ) ,
877916 Type :: FLOAT4_ARRAY => Some ( DataType :: List ( Arc :: new ( Field :: new (
878917 "item" ,
879918 DataType :: Float32 ,
@@ -1126,6 +1165,25 @@ impl<'a> FromSql<'a> for GeometryFromSql<'a> {
11261165 }
11271166}
11281167
1168+ struct XidFromSql {
1169+ xid : u32 ,
1170+ }
1171+
1172+ impl < ' a > FromSql < ' a > for XidFromSql {
1173+ fn from_sql (
1174+ _ty : & Type ,
1175+ raw : & ' a [ u8 ] ,
1176+ ) -> Result < Self , Box < dyn std:: error:: Error + Sync + Send > > {
1177+ let mut cursor = std:: io:: Cursor :: new ( raw) ;
1178+ let xid = cursor. read_u32 :: < BigEndian > ( ) ?;
1179+ Ok ( XidFromSql { xid } )
1180+ }
1181+
1182+ fn accepts ( ty : & Type ) -> bool {
1183+ matches ! ( * ty, Type :: XID )
1184+ }
1185+ }
1186+
11291187fn get_decimal_column_precision_and_scale (
11301188 column_name : & str ,
11311189 projected_schema : & SchemaRef ,
0 commit comments