@@ -464,7 +464,8 @@ impl InnerConnection {
464
464
#[ cfg_attr( rustfmt, rustfmt_skip) ]
465
465
fn setup_typeinfo_query ( & mut self ) -> result:: Result < ( ) , ConnectError > {
466
466
match self . raw_prepare ( TYPEINFO_QUERY ,
467
- "SELECT t.typname, t.typelem, r.rngsubtype, t.typbasetype, n.nspname \
467
+ "SELECT t.typname, t.typtype, t.typelem, r.rngsubtype, \
468
+ t.typbasetype, n.nspname \
468
469
FROM pg_catalog.pg_type t \
469
470
LEFT OUTER JOIN pg_catalog.pg_range r ON \
470
471
r.rngtypid = t.oid \
@@ -480,7 +481,8 @@ impl InnerConnection {
480
481
}
481
482
482
483
match self . raw_prepare ( TYPEINFO_QUERY ,
483
- "SELECT t.typname, t.typelem, NULL::OID, t.typbasetype, n.nspname \
484
+ "SELECT t.typname, t.typtype, t.typelem, NULL::OID, t.typbasetype, \
485
+ n.nspname \
484
486
FROM pg_catalog.pg_type t \
485
487
INNER JOIN pg_catalog.pg_namespace n \
486
488
ON t.typnamespace = n.oid \
@@ -751,26 +753,29 @@ impl InnerConnection {
751
753
}
752
754
_ => bad_response ! ( self ) ,
753
755
}
754
- let ( name, elem_oid, rngsubtype, basetype, schema) = match try!( self . read_message ( ) ) {
756
+ let ( name, type_ , elem_oid, rngsubtype, basetype, schema) = match try!( self . read_message ( ) ) {
755
757
DataRow { row } => {
756
758
let ctx = SessionInfo :: new ( self ) ;
757
759
let name = try!( String :: from_sql ( & Type :: Name ,
758
760
& mut & * * row[ 0 ] . as_ref ( ) . unwrap ( ) ,
759
761
& ctx) ) ;
762
+ let type_ = try!( i8:: from_sql ( & Type :: Char ,
763
+ & mut & * * row[ 1 ] . as_ref ( ) . unwrap ( ) ,
764
+ & ctx) ) ;
760
765
let elem_oid = try!( Oid :: from_sql ( & Type :: Oid ,
761
- & mut & * * row[ 1 ] . as_ref ( ) . unwrap ( ) ,
766
+ & mut & * * row[ 2 ] . as_ref ( ) . unwrap ( ) ,
762
767
& ctx) ) ;
763
- let rngsubtype = match row[ 2 ] {
768
+ let rngsubtype = match row[ 3 ] {
764
769
Some ( ref data) => try!( Option :: < Oid > :: from_sql ( & Type :: Oid , & mut & * * data, & ctx) ) ,
765
770
None => try!( Option :: < Oid > :: from_sql_null ( & Type :: Oid , & ctx) ) ,
766
771
} ;
767
772
let basetype = try!( Oid :: from_sql ( & Type :: Oid ,
768
- & mut & * * row[ 3 ] . as_ref ( ) . unwrap ( ) ,
773
+ & mut & * * row[ 4 ] . as_ref ( ) . unwrap ( ) ,
769
774
& ctx) ) ;
770
775
let schema = try!( String :: from_sql ( & Type :: Name ,
771
- & mut & * * row[ 4 ] . as_ref ( ) . unwrap ( ) ,
776
+ & mut & * * row[ 5 ] . as_ref ( ) . unwrap ( ) ,
772
777
& ctx) ) ;
773
- ( name, elem_oid, rngsubtype, basetype, schema)
778
+ ( name, type_ , elem_oid, rngsubtype, basetype, schema)
774
779
}
775
780
ErrorResponse { fields } => {
776
781
try!( self . wait_for_ready ( ) ) ;
@@ -788,7 +793,11 @@ impl InnerConnection {
788
793
}
789
794
try!( self . wait_for_ready ( ) ) ;
790
795
791
- let kind = if basetype != 0 {
796
+ let kind = if type_ == b'e' as i8 {
797
+ Kind :: Enum
798
+ } else if type_ == b'p' as i8 {
799
+ Kind :: Pseudo
800
+ } else if basetype != 0 {
792
801
Kind :: Domain ( try!( self . get_type ( basetype) ) )
793
802
} else if elem_oid != 0 {
794
803
Kind :: Array ( try!( self . get_type ( elem_oid) ) )
0 commit comments