@@ -455,10 +455,12 @@ impl InnerConnection {
455
455
456
456
fn setup_typeinfo_query ( & mut self ) -> result:: Result < ( ) , ConnectError > {
457
457
match self . raw_prepare ( TYPEINFO_QUERY ,
458
- "SELECT t.typname, t.typelem, r.rngsubtype \
458
+ "SELECT t.typname, t.typelem, r.rngsubtype, n.nspname \
459
459
FROM pg_catalog.pg_type t \
460
460
LEFT OUTER JOIN pg_catalog.pg_range r \
461
461
ON r.rngtypid = t.oid \
462
+ INNER JOIN pg_catalog.pg_namespace n \
463
+ ON t.typnamespace = n.oid \
462
464
WHERE t.oid = $1") {
463
465
Ok ( ..) => return Ok ( ( ) ) ,
464
466
Err ( Error :: IoError ( e) ) => return Err ( ConnectError :: IoError ( e) ) ,
@@ -469,9 +471,11 @@ impl InnerConnection {
469
471
}
470
472
471
473
match self . raw_prepare ( TYPEINFO_QUERY ,
472
- "SELECT typname, typelem, NULL::OID \
473
- FROM pg_catalog.pg_type \
474
- WHERE oid = $1") {
474
+ "SELECT t.typname, t.typelem, NULL::OID, n.nspname \
475
+ FROM pg_catalog.pg_type t \
476
+ INNER JOIN pg_catalog.pg_namespace n \
477
+ ON t.typnamespace = n.oid \
478
+ WHERE t.oid = $1") {
475
479
Ok ( ..) => Ok ( ( ) ) ,
476
480
Err ( Error :: IoError ( e) ) => Err ( ConnectError :: IoError ( e) ) ,
477
481
Err ( Error :: DbError ( e) ) => Err ( ConnectError :: DbError ( e) ) ,
@@ -696,7 +700,7 @@ impl InnerConnection {
696
700
}
697
701
_ => bad_response ! ( self )
698
702
}
699
- let ( name, elem_oid, rngsubtype) : ( String , Oid , Option < Oid > ) =
703
+ let ( name, elem_oid, rngsubtype, schema ) : ( String , Oid , Option < Oid > , String ) =
700
704
match try!( self . read_message ( ) ) {
701
705
DataRow { row } => {
702
706
let ctx = SessionInfo :: new ( self ) ;
@@ -708,6 +712,9 @@ impl InnerConnection {
708
712
& ctx) ) ,
709
713
try!( FromSql :: from_sql_nullable ( & Type :: Oid ,
710
714
row[ 2 ] . as_ref ( ) . map ( |r| & * * r) . as_mut ( ) ,
715
+ & ctx) ) ,
716
+ try!( FromSql :: from_sql_nullable ( & Type :: Name ,
717
+ row[ 3 ] . as_ref ( ) . map ( |r| & * * r) . as_mut ( ) ,
711
718
& ctx) ) )
712
719
}
713
720
ErrorResponse { fields } => {
@@ -735,7 +742,7 @@ impl InnerConnection {
735
742
}
736
743
} ;
737
744
738
- let type_ = Type :: Other ( Box :: new ( Other :: new ( name, oid, kind) ) ) ;
745
+ let type_ = Type :: Other ( Box :: new ( Other :: new ( name, oid, kind, schema ) ) ) ;
739
746
self . unknown_types . insert ( oid, type_. clone ( ) ) ;
740
747
Ok ( type_)
741
748
}
@@ -1337,7 +1344,7 @@ impl<'a> GenericConnection for Transaction<'a> {
1337
1344
}
1338
1345
1339
1346
trait OtherNew {
1340
- fn new ( name : String , oid : Oid , kind : Kind ) -> Other ;
1347
+ fn new ( name : String , oid : Oid , kind : Kind , schema : String ) -> Other ;
1341
1348
}
1342
1349
1343
1350
trait DbErrorNew {
0 commit comments