@@ -14,7 +14,6 @@ use pgwire::api::results::{FieldInfo, QueryResponse};
1414use pgwire:: api:: Type ;
1515use pgwire:: error:: { ErrorInfo , PgWireError , PgWireResult } ;
1616use pgwire:: messages:: data:: DataRow ;
17- use postgres_types:: Kind ;
1817use rust_decimal:: prelude:: ToPrimitive ;
1918use rust_decimal:: Decimal ;
2019
@@ -66,10 +65,10 @@ pub(crate) fn into_pg_type(df_type: &DataType) -> PgWireResult<Type> {
6665 DataType :: Float64 => Type :: FLOAT8_ARRAY ,
6766 DataType :: Utf8 => Type :: VARCHAR_ARRAY ,
6867 DataType :: LargeUtf8 => Type :: TEXT_ARRAY ,
69- struct_type @ DataType :: Struct ( _) => Type :: new (
68+ DataType :: Struct ( _) => Type :: new (
7069 Type :: RECORD_ARRAY . name ( ) . into ( ) ,
7170 Type :: RECORD_ARRAY . oid ( ) ,
72- Kind :: Array ( into_pg_type ( struct_type ) ? ) ,
71+ Type :: RECORD_ARRAY . kind ( ) . clone ( ) ,
7372 Type :: RECORD_ARRAY . schema ( ) . into ( ) ,
7473 ) ,
7574 list_type => {
@@ -90,16 +89,12 @@ pub(crate) fn into_pg_type(df_type: &DataType) -> PgWireResult<Type> {
9089 . reduce ( |a, b| a + ", " + & b)
9190 . map ( |x| format ! ( "({x})" ) )
9291 . unwrap_or ( "()" . to_string ( ) ) ;
93- let kind = Kind :: Composite (
94- fields
95- . iter ( )
96- . map ( |x| {
97- into_pg_type ( x. data_type ( ) )
98- . map ( |_type| postgres_types:: Field :: new ( x. name ( ) . clone ( ) , _type) )
99- } )
100- . collect :: < Result < Vec < _ > , PgWireError > > ( ) ?,
101- ) ;
102- Type :: new ( name, Type :: RECORD . oid ( ) , kind, Type :: RECORD . schema ( ) . into ( ) )
92+ Type :: new (
93+ name,
94+ Type :: RECORD . oid ( ) ,
95+ Type :: RECORD . kind ( ) . clone ( ) ,
96+ Type :: RECORD . schema ( ) . into ( ) ,
97+ )
10398 }
10499 _ => {
105100 return Err ( PgWireError :: UserError ( Box :: new ( ErrorInfo :: new (
0 commit comments