diesel/pg/
metadata_lookup.rs

1// FIXME: Remove this attribute once false positive is resolved.
2#![allow(unused_parens)]
3// conditionally allow deprecated items to allow using the
4// "deprecated" table! macro
5#![cfg_attr(
6    any(feature = "huge-tables", feature = "large-tables"),
7    allow(deprecated)
8)]
9
10use super::backend::{FailedToLookupTypeError, InnerPgTypeMetadata};
11use super::{Pg, PgTypeMetadata};
12use crate::connection::{DefaultLoadingMode, LoadConnection};
13use crate::prelude::*;
14
15use std::borrow::Cow;
16use std::collections::HashMap;
17
18/// Determines the OID of types at runtime
19///
20/// Custom implementations of `Connection<Backend = Pg>` should not implement this trait directly.
21/// Instead `GetPgMetadataCache` should be implemented, afterwards the generic implementation will provide
22/// the necessary functions to perform the type lookup.
23#[cfg(feature = "postgres_backend")]
24pub trait PgMetadataLookup {
25    /// Determine the type metadata for the given `type_name`
26    ///
27    /// This function should only be used for user defined types, or types which
28    /// come from an extension. This function may perform a SQL query to look
29    /// up the type. For built-in types, a static OID should be preferred.
30    fn lookup_type(&mut self, type_name: &str, schema: Option<&str>) -> PgTypeMetadata;
31
32    /// Convert this lookup instance to a `std::any::Any` pointer
33    ///
34    /// Implementing this method is required to support `#[derive(MultiConnection)]`
35    // We provide a default implementation here, so that adding this method is no breaking
36    // change
37    #[diesel_derives::__diesel_public_if(
38        feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"
39    )]
40    fn as_any<'a>(&mut self) -> &mut (dyn std::any::Any + 'a)
41    where
42        Self: 'a,
43    {
44        ::core::panicking::panic("not implemented")unimplemented!()
45    }
46}
47
48impl<T> PgMetadataLookup for T
49where
50    T: Connection<Backend = Pg> + GetPgMetadataCache + LoadConnection<DefaultLoadingMode>,
51{
52    fn lookup_type(&mut self, type_name: &str, schema: Option<&str>) -> PgTypeMetadata {
53        let cache_key = PgMetadataCacheKey {
54            schema: schema.map(Cow::Borrowed),
55            type_name: Cow::Borrowed(type_name),
56        };
57
58        {
59            let metadata_cache = self.get_metadata_cache();
60
61            if let Some(metadata) = metadata_cache.lookup_type(&cache_key) {
62                return metadata;
63            }
64        }
65
66        let r = lookup_type(&cache_key, self);
67
68        match r {
69            Ok(type_metadata) => {
70                self.get_metadata_cache()
71                    .store_type(cache_key, type_metadata);
72                PgTypeMetadata(Ok(type_metadata))
73            }
74            Err(_e) => PgTypeMetadata(Err(FailedToLookupTypeError::new_internal(
75                cache_key.into_owned(),
76            ))),
77        }
78    }
79
80    fn as_any<'a>(&mut self) -> &mut (dyn std::any::Any + 'a)
81    where
82        Self: 'a,
83    {
84        self
85    }
86}
87
88/// Gets the `PgMetadataCache` for a `Connection<Backend=Pg>`
89/// so that the lookup of user defined types, or types which come from an extension can be cached.
90///
91/// Implementing this trait for a `Connection<Backend=Pg>` will cause `PgMetadataLookup` to be auto implemented.
92#[cfg_attr(
93    feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes",
94    cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes")
95)]
96pub trait GetPgMetadataCache {
97    /// Get the `PgMetadataCache`
98    fn get_metadata_cache(&mut self) -> &mut PgMetadataCache;
99}
100
101fn lookup_type<T: Connection<Backend = Pg> + LoadConnection<DefaultLoadingMode>>(
102    cache_key: &PgMetadataCacheKey<'_>,
103    conn: &mut T,
104) -> QueryResult<InnerPgTypeMetadata> {
105    let metadata_query = pg_type::table.select((pg_type::oid, pg_type::typarray));
106
107    let metadata = if let Some(schema) = cache_key.schema.as_deref() {
108        // We have an explicit type name and schema given here
109        // that should resolve to an unique type
110        metadata_query
111            .inner_join(pg_namespace::table)
112            .filter(pg_type::typname.eq(&cache_key.type_name))
113            .filter(pg_namespace::nspname.eq(schema))
114            .first(conn)?
115    } else {
116        // We don't have a schema here. A type with the same name could exists
117        // in more than one schema at once, even in more than one schema that
118        // is in the current search path. As we don't want to reimplement
119        // postgres name resolution here we just cast the time name to a concrete type
120        // and let postgres figure out the name resolution on it's own.
121        metadata_query
122            .filter(
123                pg_type::oid.eq(crate::dsl::sql("quote_ident(")
124                    .bind::<crate::sql_types::Text, _>(&cache_key.type_name)
125                    .sql(")::regtype::oid")),
126            )
127            .first(conn)?
128    };
129
130    Ok(metadata)
131}
132
133/// The key used to lookup cached type oid's inside of
134/// a [PgMetadataCache].
135#[derive(#[automatically_derived]
impl<'a> ::core::hash::Hash for PgMetadataCacheKey<'a> {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
        ::core::hash::Hash::hash(&self.schema, state);
        ::core::hash::Hash::hash(&self.type_name, state)
    }
}Hash, #[automatically_derived]
impl<'a> ::core::cmp::PartialEq for PgMetadataCacheKey<'a> {
    #[inline]
    fn eq(&self, other: &PgMetadataCacheKey<'a>) -> bool {
        self.schema == other.schema && self.type_name == other.type_name
    }
}PartialEq, #[automatically_derived]
impl<'a> ::core::cmp::Eq for PgMetadataCacheKey<'a> {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_receiver_is_total_eq(&self) -> () {
        let _: ::core::cmp::AssertParamIsEq<Option<Cow<'a, str>>>;
        let _: ::core::cmp::AssertParamIsEq<Cow<'a, str>>;
    }
}Eq, #[automatically_derived]
impl<'a> ::core::fmt::Debug for PgMetadataCacheKey<'a> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "PgMetadataCacheKey", "schema", &self.schema, "type_name",
            &&self.type_name)
    }
}Debug, #[automatically_derived]
impl<'a> ::core::clone::Clone for PgMetadataCacheKey<'a> {
    #[inline]
    fn clone(&self) -> PgMetadataCacheKey<'a> {
        PgMetadataCacheKey {
            schema: ::core::clone::Clone::clone(&self.schema),
            type_name: ::core::clone::Clone::clone(&self.type_name),
        }
    }
}Clone)]
136#[cfg_attr(
137    feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes",
138    cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes")
139)]
140pub struct PgMetadataCacheKey<'a> {
141    pub(in crate::pg) schema: Option<Cow<'a, str>>,
142    pub(in crate::pg) type_name: Cow<'a, str>,
143}
144
145impl<'a> PgMetadataCacheKey<'a> {
146    /// Construct a new cache key from an optional schema name and
147    /// a type name
148    pub fn new(schema: Option<Cow<'a, str>>, type_name: Cow<'a, str>) -> Self {
149        Self { schema, type_name }
150    }
151
152    /// Convert the possibly borrowed version of this metadata cache key
153    /// into a lifetime independent owned version
154    pub fn into_owned(self) -> PgMetadataCacheKey<'static> {
155        let PgMetadataCacheKey { schema, type_name } = self;
156        PgMetadataCacheKey {
157            schema: schema.map(|s| Cow::Owned(s.into_owned())),
158            type_name: Cow::Owned(type_name.into_owned()),
159        }
160    }
161}
162
163/// Cache for the [OIDs] of custom Postgres types
164///
165/// [OIDs]: https://www.postgresql.org/docs/current/static/datatype-oid.html
166#[allow(missing_debug_implementations)]
167#[derive(#[automatically_derived]
#[allow(missing_debug_implementations)]
impl ::core::default::Default for PgMetadataCache {
    #[inline]
    fn default() -> PgMetadataCache {
        PgMetadataCache { cache: ::core::default::Default::default() }
    }
}Default)]
168#[cfg_attr(
169    feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes",
170    cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes")
171)]
172pub struct PgMetadataCache {
173    cache: HashMap<PgMetadataCacheKey<'static>, InnerPgTypeMetadata>,
174}
175
176impl PgMetadataCache {
177    /// Construct a new `PgMetadataCache`
178    pub fn new() -> Self {
179        Default::default()
180    }
181
182    /// Lookup the OID of a custom type
183    pub fn lookup_type(&self, type_name: &PgMetadataCacheKey<'_>) -> Option<PgTypeMetadata> {
184        Some(PgTypeMetadata(Ok(*self.cache.get(type_name)?)))
185    }
186
187    /// Store the OID of a custom type
188    pub fn store_type(
189        &mut self,
190        type_name: PgMetadataCacheKey<'_>,
191        type_metadata: impl Into<InnerPgTypeMetadata>,
192    ) {
193        self.cache
194            .insert(type_name.into_owned(), type_metadata.into());
195    }
196}
197
198#[allow(unused_imports, dead_code, unreachable_pub, unused_qualifications)]
pub mod pg_type {
    use ::diesel;
    pub use self::columns::*;
    use diesel::sql_types::*;
    #[doc = r" Re-exports all of the columns of this table, as well as the"]
    #[doc = r" table struct renamed to the module name. This is meant to be"]
    #[doc = r" glob imported for functions which only deal with one table."]
    pub mod dsl {
        pub use super::columns::oid;
        pub use super::columns::typname;
        pub use super::columns::typarray;
        pub use super::columns::typnamespace;
        pub use super::table as pg_type;
    }
    #[allow(non_upper_case_globals, dead_code)]
    #[doc = r" A tuple of all of the columns on this table"]
    pub const all_columns: (oid, typname, typarray, typnamespace) =
        (oid, typname, typarray, typnamespace);
    #[allow(non_camel_case_types)]
    #[doc = r" The actual table struct"]
    #[doc = r""]
    #[doc = r" This is the type which provides the base methods of the query"]
    #[doc = r" builder, such as `.select` and `.filter`."]
    pub struct table;
    #[automatically_derived]
    #[allow(non_camel_case_types)]
    impl ::core::fmt::Debug for table {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::write_str(f, "table")
        }
    }
    #[automatically_derived]
    #[allow(non_camel_case_types)]
    impl ::core::clone::Clone for table {
        #[inline]
        fn clone(&self) -> table { *self }
    }
    #[automatically_derived]
    #[allow(non_camel_case_types)]
    impl ::core::marker::Copy for table { }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl diesel::query_builder::QueryId for table {
                type QueryId = table<>;
                const HAS_STATIC_QUERY_ID: bool = true;
                const IS_WINDOW_FUNCTION: bool = false;
            }
        };
    #[automatically_derived]
    #[allow(non_camel_case_types)]
    impl ::core::default::Default for table {
        #[inline]
        fn default() -> table { table {} }
    }
    impl table {
        #[allow(dead_code)]
        #[doc = r" Represents `table_name.*`, which is sometimes necessary"]
        #[doc =
        r" for efficient count queries. It cannot be used in place of"]
        #[doc = r" `all_columns`"]
        pub fn star(&self) -> star { star }
    }
    #[doc = r" The SQL type of all of the columns on this table"]
    pub type SqlType = (Oid, Text, Oid, Oid);
    #[doc = r" Helper type for representing a boxed query from this table"]
    pub type BoxedQuery<'a, DB, ST = SqlType> =
        diesel::internal::table_macro::BoxedSelectStatement<'a, ST,
        diesel::internal::table_macro::FromClause<table>, DB>;
    impl diesel::QuerySource for table {
        type FromClause =
            diesel::internal::table_macro::StaticQueryFragmentInstance<table>;
        type DefaultSelection = <Self as diesel::Table>::AllColumns;
        fn from_clause(&self) -> Self::FromClause {
            diesel::internal::table_macro::StaticQueryFragmentInstance::new()
        }
        fn default_selection(&self) -> Self::DefaultSelection {
            use diesel::Table;
            Self::all_columns()
        }
    }
    impl<DB> diesel::query_builder::QueryFragment<DB> for table where
        DB: diesel::backend::Backend,
        <table as
        diesel::internal::table_macro::StaticQueryFragment>::Component: diesel::query_builder::QueryFragment<DB>
        {
        fn walk_ast<'b>(&'b self,
            __diesel_internal_pass:
                diesel::query_builder::AstPass<'_, 'b, DB>)
            -> diesel::result::QueryResult<()> {
            <table as
                    diesel::internal::table_macro::StaticQueryFragment>::STATIC_COMPONENT.walk_ast(__diesel_internal_pass)
        }
    }
    impl diesel::internal::table_macro::StaticQueryFragment for table {
        type Component = diesel::internal::table_macro::Identifier<'static>;
        const STATIC_COMPONENT: &'static Self::Component =
            &diesel::internal::table_macro::Identifier("pg_type");
    }
    impl diesel::query_builder::AsQuery for table {
        type SqlType = SqlType;
        type Query =
            diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<Self>>;
        fn as_query(self) -> Self::Query {
            diesel::internal::table_macro::SelectStatement::simple(self)
        }
    }
    impl diesel::Table for table {
        type PrimaryKey = oid;
        type AllColumns = (oid, typname, typarray, typnamespace);
        fn primary_key(&self) -> Self::PrimaryKey { oid }
        fn all_columns() -> Self::AllColumns {
            (oid, typname, typarray, typnamespace)
        }
    }
    impl diesel::associations::HasTable for table {
        type Table = Self;
        fn table() -> Self::Table { table }
    }
    impl diesel::query_builder::IntoUpdateTarget for table {
        type WhereClause =
            <<Self as diesel::query_builder::AsQuery>::Query as
            diesel::query_builder::IntoUpdateTarget>::WhereClause;
        fn into_update_target(self)
            ->
                diesel::query_builder::UpdateTarget<Self::Table,
                Self::WhereClause> {
            use diesel::query_builder::AsQuery;
            let q:
                    diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<table>> =
                self.as_query();
            q.into_update_target()
        }
    }
    impl diesel::query_source::AppearsInFromClause<table> for table {
        type Count = diesel::query_source::Once;
    }
    impl<S> diesel::internal::table_macro::AliasAppearsInFromClause<S, table>
        for table where S: diesel::query_source::AliasSource<Target = table> {
        type Count = diesel::query_source::Never;
    }
    impl<S1, S2>
        diesel::internal::table_macro::AliasAliasAppearsInFromClause<table,
        S2, S1> for table where
        S1: diesel::query_source::AliasSource<Target = table>,
        S2: diesel::query_source::AliasSource<Target = table>,
        S1: diesel::internal::table_macro::AliasAliasAppearsInFromClauseSameTable<S2,
        table> {
        type Count =
            <S1 as
            diesel::internal::table_macro::AliasAliasAppearsInFromClauseSameTable<S2,
            table>>::Count;
    }
    impl<S>
        diesel::query_source::AppearsInFromClause<diesel::query_source::Alias<S>>
        for table where S: diesel::query_source::AliasSource {
        type Count = diesel::query_source::Never;
    }
    impl<S, C>
        diesel::internal::table_macro::FieldAliasMapperAssociatedTypesDisjointnessTrick<table,
        S, C> for table where
        S: diesel::query_source::AliasSource<Target = table> +
        ::std::clone::Clone, C: diesel::query_source::Column<Table = table> {
        type Out = diesel::query_source::AliasedField<S, C>;
        fn map(__diesel_internal_column: C,
            __diesel_internal_alias: &diesel::query_source::Alias<S>)
            -> Self::Out {
            __diesel_internal_alias.field(__diesel_internal_column)
        }
    }
    impl diesel::query_source::AppearsInFromClause<table> for
        diesel::internal::table_macro::NoFromClause {
        type Count = diesel::query_source::Never;
    }
    impl<Left, Right, Kind>
        diesel::JoinTo<diesel::internal::table_macro::Join<Left, Right, Kind>>
        for table where
        diesel::internal::table_macro::Join<Left, Right,
        Kind>: diesel::JoinTo<table>, Left: diesel::query_source::QuerySource,
        Right: diesel::query_source::QuerySource {
        type FromClause =
            diesel::internal::table_macro::Join<Left, Right, Kind>;
        type OnClause =
            <diesel::internal::table_macro::Join<Left, Right, Kind> as
            diesel::JoinTo<table>>::OnClause;
        fn join_target(__diesel_internal_rhs:
                diesel::internal::table_macro::Join<Left, Right, Kind>)
            -> (Self::FromClause, Self::OnClause) {
            let (_, __diesel_internal_on_clause) =
                diesel::internal::table_macro::Join::join_target(table);
            (__diesel_internal_rhs, __diesel_internal_on_clause)
        }
    }
    impl<Join, On>
        diesel::JoinTo<diesel::internal::table_macro::JoinOn<Join, On>> for
        table where
        diesel::internal::table_macro::JoinOn<Join, On>: diesel::JoinTo<table>
        {
        type FromClause = diesel::internal::table_macro::JoinOn<Join, On>;
        type OnClause =
            <diesel::internal::table_macro::JoinOn<Join, On> as
            diesel::JoinTo<table>>::OnClause;
        fn join_target(__diesel_internal_rhs:
                diesel::internal::table_macro::JoinOn<Join, On>)
            -> (Self::FromClause, Self::OnClause) {
            let (_, __diesel_internal_on_clause) =
                diesel::internal::table_macro::JoinOn::join_target(table);
            (__diesel_internal_rhs, __diesel_internal_on_clause)
        }
    }
    impl<F, S, D, W, O, L, Of, G>
        diesel::JoinTo<diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<F>,
        S, D, W, O, L, Of, G>> for table where
        diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<F>,
        S, D, W, O, L, Of, G>: diesel::JoinTo<table>,
        F: diesel::query_source::QuerySource {
        type FromClause =
            diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<F>,
            S, D, W, O, L, Of, G>;
        type OnClause =
            <diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<F>,
            S, D, W, O, L, Of, G> as diesel::JoinTo<table>>::OnClause;
        fn join_target(__diesel_internal_rhs:
                diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<F>,
                S, D, W, O, L, Of, G>) -> (Self::FromClause, Self::OnClause) {
            let (_, __diesel_internal_on_clause) =
                diesel::internal::table_macro::SelectStatement::join_target(table);
            (__diesel_internal_rhs, __diesel_internal_on_clause)
        }
    }
    impl<'a, QS, ST, DB>
        diesel::JoinTo<diesel::internal::table_macro::BoxedSelectStatement<'a,
        diesel::internal::table_macro::FromClause<QS>, ST, DB>> for table
        where
        diesel::internal::table_macro::BoxedSelectStatement<'a,
        diesel::internal::table_macro::FromClause<QS>, ST,
        DB>: diesel::JoinTo<table>, QS: diesel::query_source::QuerySource {
        type FromClause =
            diesel::internal::table_macro::BoxedSelectStatement<'a,
            diesel::internal::table_macro::FromClause<QS>, ST, DB>;
        type OnClause =
            <diesel::internal::table_macro::BoxedSelectStatement<'a,
            diesel::internal::table_macro::FromClause<QS>, ST, DB> as
            diesel::JoinTo<table>>::OnClause;
        fn join_target(__diesel_internal_rhs:
                diesel::internal::table_macro::BoxedSelectStatement<'a,
                diesel::internal::table_macro::FromClause<QS>, ST, DB>)
            -> (Self::FromClause, Self::OnClause) {
            let (_, __diesel_internal_on_clause) =
                diesel::internal::table_macro::BoxedSelectStatement::join_target(table);
            (__diesel_internal_rhs, __diesel_internal_on_clause)
        }
    }
    impl<S> diesel::JoinTo<diesel::query_source::Alias<S>> for table where
        diesel::query_source::Alias<S>: diesel::JoinTo<table> {
        type FromClause = diesel::query_source::Alias<S>;
        type OnClause =
            <diesel::query_source::Alias<S> as
            diesel::JoinTo<table>>::OnClause;
        fn join_target(__diesel_internal_rhs: diesel::query_source::Alias<S>)
            -> (Self::FromClause, Self::OnClause) {
            let (_, __diesel_internal_on_clause) =
                diesel::query_source::Alias::<S>::join_target(table);
            (__diesel_internal_rhs, __diesel_internal_on_clause)
        }
    }
    impl<T> diesel::insertable::Insertable<T> for table where
        <table as
        diesel::query_builder::AsQuery>::Query: diesel::insertable::Insertable<T>
        {
        type Values =
            <<table as diesel::query_builder::AsQuery>::Query as
            diesel::insertable::Insertable<T>>::Values;
        fn values(self) -> Self::Values {
            use diesel::query_builder::AsQuery;
            self.as_query().values()
        }
    }
    impl<'a, T> diesel::insertable::Insertable<T> for &'a table where
        table: diesel::insertable::Insertable<T> {
        type Values = <table as diesel::insertable::Insertable<T>>::Values;
        fn values(self) -> Self::Values { (*self).values() }
    }
    impl<S> diesel::JoinTo<diesel::query_builder::Only<S>> for table where
        diesel::query_builder::Only<S>: diesel::JoinTo<table> {
        type FromClause = diesel::query_builder::Only<S>;
        type OnClause =
            <diesel::query_builder::Only<S> as
            diesel::JoinTo<table>>::OnClause;
        fn join_target(__diesel_internal_rhs: diesel::query_builder::Only<S>)
            -> (Self::FromClause, Self::OnClause) {
            let (_, __diesel_internal_on_clause) =
                diesel::query_builder::Only::<S>::join_target(table);
            (__diesel_internal_rhs, __diesel_internal_on_clause)
        }
    }
    impl diesel::query_source::AppearsInFromClause<diesel::query_builder::Only<table>>
        for table {
        type Count = diesel::query_source::Once;
    }
    impl diesel::query_source::AppearsInFromClause<table> for
        diesel::query_builder::Only<table> {
        type Count = diesel::query_source::Once;
    }
    impl<S, TSM> diesel::JoinTo<diesel::query_builder::Tablesample<S, TSM>>
        for table where
        diesel::query_builder::Tablesample<S, TSM>: diesel::JoinTo<table>,
        TSM: diesel::internal::table_macro::TablesampleMethod {
        type FromClause = diesel::query_builder::Tablesample<S, TSM>;
        type OnClause =
            <diesel::query_builder::Tablesample<S, TSM> as
            diesel::JoinTo<table>>::OnClause;
        fn join_target(__diesel_internal_rhs:
                diesel::query_builder::Tablesample<S, TSM>)
            -> (Self::FromClause, Self::OnClause) {
            let (_, __diesel_internal_on_clause) =
                diesel::query_builder::Tablesample::<S,
                        TSM>::join_target(table);
            (__diesel_internal_rhs, __diesel_internal_on_clause)
        }
    }
    impl<TSM>
        diesel::query_source::AppearsInFromClause<diesel::query_builder::Tablesample<table,
        TSM>> for table where
        TSM: diesel::internal::table_macro::TablesampleMethod {
        type Count = diesel::query_source::Once;
    }
    impl<TSM> diesel::query_source::AppearsInFromClause<table> for
        diesel::query_builder::Tablesample<table, TSM> where
        TSM: diesel::internal::table_macro::TablesampleMethod {
        type Count = diesel::query_source::Once;
    }
    #[doc = r" Contains all of the columns of this table"]
    pub mod columns {
        use ::diesel;
        use super::table;
        use diesel::sql_types::*;
        #[allow(non_camel_case_types, dead_code)]
        #[doc = r" Represents `table_name.*`, which is sometimes needed for"]
        #[doc = r" efficient count queries. It cannot be used in place of"]
        #[doc = r" `all_columns`, and has a `SqlType` of `()` to prevent it"]
        #[doc = r" being used that way"]
        pub struct star;
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::fmt::Debug for star {
            #[inline]
            fn fmt(&self, f: &mut ::core::fmt::Formatter)
                -> ::core::fmt::Result {
                ::core::fmt::Formatter::write_str(f, "star")
            }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::clone::Clone for star {
            #[inline]
            fn clone(&self) -> star { *self }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::marker::Copy for star { }
        const _: () =
            {
                use diesel;
                #[allow(non_camel_case_types)]
                impl diesel::query_builder::QueryId for star {
                    type QueryId = star<>;
                    const HAS_STATIC_QUERY_ID: bool = true;
                    const IS_WINDOW_FUNCTION: bool = false;
                }
            };
        impl<__GB> diesel::expression::ValidGrouping<__GB> for star where
            (oid, typname, typarray,
            typnamespace): diesel::expression::ValidGrouping<__GB> {
            type IsAggregate =
                <(oid, typname, typarray, typnamespace) as
                diesel::expression::ValidGrouping<__GB>>::IsAggregate;
        }
        impl diesel::Expression for star {
            type SqlType =
                diesel::expression::expression_types::NotSelectable;
        }
        impl<DB: diesel::backend::Backend>
            diesel::query_builder::QueryFragment<DB> for star where
            <table as
            diesel::QuerySource>::FromClause: diesel::query_builder::QueryFragment<DB>
            {
            #[allow(non_snake_case)]
            fn walk_ast<'b>(&'b self,
                mut __diesel_internal_out:
                    diesel::query_builder::AstPass<'_, 'b, DB>)
                -> diesel::result::QueryResult<()> {
                use diesel::QuerySource;
                if !__diesel_internal_out.should_skip_from() {
                    const FROM_CLAUSE:
                        diesel::internal::table_macro::StaticQueryFragmentInstance<table>
                        =
                        diesel::internal::table_macro::StaticQueryFragmentInstance::new();
                    FROM_CLAUSE.walk_ast(__diesel_internal_out.reborrow())?;
                    __diesel_internal_out.push_sql(".");
                }
                __diesel_internal_out.push_sql("*");
                Ok(())
            }
        }
        impl diesel::SelectableExpression<table> for star {}
        impl diesel::AppearsOnTable<table> for star {}
        #[allow(non_camel_case_types, dead_code)]
        pub struct oid;
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::fmt::Debug for oid {
            #[inline]
            fn fmt(&self, f: &mut ::core::fmt::Formatter)
                -> ::core::fmt::Result {
                ::core::fmt::Formatter::write_str(f, "oid")
            }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::clone::Clone for oid {
            #[inline]
            fn clone(&self) -> oid { *self }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::marker::Copy for oid { }
        const _: () =
            {
                use diesel;
                #[allow(non_camel_case_types)]
                impl diesel::query_builder::QueryId for oid {
                    type QueryId = oid<>;
                    const HAS_STATIC_QUERY_ID: bool = true;
                    const IS_WINDOW_FUNCTION: bool = false;
                }
            };
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::default::Default for oid {
            #[inline]
            fn default() -> oid { oid {} }
        }
        impl diesel::expression::Expression for oid {
            type SqlType = Oid;
        }
        impl<DB> diesel::query_builder::QueryFragment<DB> for oid where
            DB: diesel::backend::Backend,
            diesel::internal::table_macro::StaticQueryFragmentInstance<table>: diesel::query_builder::QueryFragment<DB>
            {
            #[allow(non_snake_case)]
            fn walk_ast<'b>(&'b self,
                mut __diesel_internal_out:
                    diesel::query_builder::AstPass<'_, 'b, DB>)
                -> diesel::result::QueryResult<()> {
                if !__diesel_internal_out.should_skip_from() {
                    const FROM_CLAUSE:
                        diesel::internal::table_macro::StaticQueryFragmentInstance<table>
                        =
                        diesel::internal::table_macro::StaticQueryFragmentInstance::new();
                    FROM_CLAUSE.walk_ast(__diesel_internal_out.reborrow())?;
                    __diesel_internal_out.push_sql(".");
                }
                __diesel_internal_out.push_identifier("oid")
            }
        }
        impl diesel::SelectableExpression<super::table> for oid {}
        impl<QS> diesel::AppearsOnTable<QS> for oid where
            QS: diesel::query_source::AppearsInFromClause<super::table, Count
            = diesel::query_source::Once> {}
        impl<Left, Right>
            diesel::SelectableExpression<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::LeftOuter>> for oid where
            oid: diesel::AppearsOnTable<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::LeftOuter>>,
            Self: diesel::SelectableExpression<Left>,
            Right: diesel::query_source::AppearsInFromClause<super::table,
            Count = diesel::query_source::Never> +
            diesel::query_source::QuerySource,
            Left: diesel::query_source::QuerySource {}
        impl<Left, Right>
            diesel::SelectableExpression<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::Inner>> for oid where
            oid: diesel::AppearsOnTable<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::Inner>>,
            Left: diesel::query_source::AppearsInFromClause<super::table> +
            diesel::query_source::QuerySource,
            Right: diesel::query_source::AppearsInFromClause<super::table> +
            diesel::query_source::QuerySource,
            (Left::Count,
            Right::Count): diesel::internal::table_macro::Pick<Left, Right>,
            Self: diesel::SelectableExpression<<(Left::Count, Right::Count) as
            diesel::internal::table_macro::Pick<Left, Right>>::Selection> {}
        impl<Join, On>
            diesel::SelectableExpression<diesel::internal::table_macro::JoinOn<Join,
            On>> for oid where oid: diesel::SelectableExpression<Join> +
            diesel::AppearsOnTable<diesel::internal::table_macro::JoinOn<Join,
            On>> {}
        impl<From>
            diesel::SelectableExpression<diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<From>>>
            for oid where From: diesel::query_source::QuerySource,
            oid: diesel::SelectableExpression<From> +
            diesel::AppearsOnTable<diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<From>>>
            {}
        impl<__GB> diesel::expression::ValidGrouping<__GB> for oid where
            __GB: diesel::expression::IsContainedInGroupBy<oid, Output =
            diesel::expression::is_contained_in_group_by::Yes> {
            type IsAggregate = diesel::expression::is_aggregate::Yes;
        }
        impl diesel::expression::ValidGrouping<()> for oid {
            type IsAggregate = diesel::expression::is_aggregate::No;
        }
        impl diesel::expression::IsContainedInGroupBy<oid> for oid {
            type Output = diesel::expression::is_contained_in_group_by::Yes;
        }
        impl diesel::query_source::Column for oid {
            type Table = super::table;
            const NAME: &'static str = "oid";
        }
        impl<T> diesel::EqAll<T> for oid where
            T: diesel::expression::AsExpression<Oid>,
            diesel::dsl::Eq<oid,
            T::Expression>: diesel::Expression<SqlType =
            diesel::sql_types::Bool> {
            type Output = diesel::dsl::Eq<Self, T::Expression>;
            fn eq_all(self, __diesel_internal_rhs: T) -> Self::Output {
                use diesel::expression_methods::ExpressionMethods;
                self.eq(__diesel_internal_rhs)
            }
        }
        impl diesel::query_source::AppearsInFromClause<diesel::query_builder::Only<super::table>>
            for oid {
            type Count = diesel::query_source::Once;
        }
        impl diesel::SelectableExpression<diesel::query_builder::Only<super::table>>
            for oid {}
        impl<TSM>
            diesel::query_source::AppearsInFromClause<diesel::query_builder::Tablesample<super::table,
            TSM>> for oid where
            TSM: diesel::internal::table_macro::TablesampleMethod {
            type Count = diesel::query_source::Once;
        }
        impl<TSM>
            diesel::SelectableExpression<diesel::query_builder::Tablesample<super::table,
            TSM>> for oid where
            TSM: diesel::internal::table_macro::TablesampleMethod {}
        #[allow(non_camel_case_types, dead_code)]
        pub struct typname;
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::fmt::Debug for typname {
            #[inline]
            fn fmt(&self, f: &mut ::core::fmt::Formatter)
                -> ::core::fmt::Result {
                ::core::fmt::Formatter::write_str(f, "typname")
            }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::clone::Clone for typname {
            #[inline]
            fn clone(&self) -> typname { *self }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::marker::Copy for typname { }
        const _: () =
            {
                use diesel;
                #[allow(non_camel_case_types)]
                impl diesel::query_builder::QueryId for typname {
                    type QueryId = typname<>;
                    const HAS_STATIC_QUERY_ID: bool = true;
                    const IS_WINDOW_FUNCTION: bool = false;
                }
            };
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::default::Default for typname {
            #[inline]
            fn default() -> typname { typname {} }
        }
        impl diesel::expression::Expression for typname {
            type SqlType = Text;
        }
        impl<DB> diesel::query_builder::QueryFragment<DB> for typname where
            DB: diesel::backend::Backend,
            diesel::internal::table_macro::StaticQueryFragmentInstance<table>: diesel::query_builder::QueryFragment<DB>
            {
            #[allow(non_snake_case)]
            fn walk_ast<'b>(&'b self,
                mut __diesel_internal_out:
                    diesel::query_builder::AstPass<'_, 'b, DB>)
                -> diesel::result::QueryResult<()> {
                if !__diesel_internal_out.should_skip_from() {
                    const FROM_CLAUSE:
                        diesel::internal::table_macro::StaticQueryFragmentInstance<table>
                        =
                        diesel::internal::table_macro::StaticQueryFragmentInstance::new();
                    FROM_CLAUSE.walk_ast(__diesel_internal_out.reborrow())?;
                    __diesel_internal_out.push_sql(".");
                }
                __diesel_internal_out.push_identifier("typname")
            }
        }
        impl diesel::SelectableExpression<super::table> for typname {}
        impl<QS> diesel::AppearsOnTable<QS> for typname where
            QS: diesel::query_source::AppearsInFromClause<super::table, Count
            = diesel::query_source::Once> {}
        impl<Left, Right>
            diesel::SelectableExpression<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::LeftOuter>> for typname
            where
            typname: diesel::AppearsOnTable<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::LeftOuter>>,
            Self: diesel::SelectableExpression<Left>,
            Right: diesel::query_source::AppearsInFromClause<super::table,
            Count = diesel::query_source::Never> +
            diesel::query_source::QuerySource,
            Left: diesel::query_source::QuerySource {}
        impl<Left, Right>
            diesel::SelectableExpression<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::Inner>> for typname where
            typname: diesel::AppearsOnTable<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::Inner>>,
            Left: diesel::query_source::AppearsInFromClause<super::table> +
            diesel::query_source::QuerySource,
            Right: diesel::query_source::AppearsInFromClause<super::table> +
            diesel::query_source::QuerySource,
            (Left::Count,
            Right::Count): diesel::internal::table_macro::Pick<Left, Right>,
            Self: diesel::SelectableExpression<<(Left::Count, Right::Count) as
            diesel::internal::table_macro::Pick<Left, Right>>::Selection> {}
        impl<Join, On>
            diesel::SelectableExpression<diesel::internal::table_macro::JoinOn<Join,
            On>> for typname where
            typname: diesel::SelectableExpression<Join> +
            diesel::AppearsOnTable<diesel::internal::table_macro::JoinOn<Join,
            On>> {}
        impl<From>
            diesel::SelectableExpression<diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<From>>>
            for typname where From: diesel::query_source::QuerySource,
            typname: diesel::SelectableExpression<From> +
            diesel::AppearsOnTable<diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<From>>>
            {}
        impl<__GB> diesel::expression::ValidGrouping<__GB> for typname where
            __GB: diesel::expression::IsContainedInGroupBy<typname, Output =
            diesel::expression::is_contained_in_group_by::Yes> {
            type IsAggregate = diesel::expression::is_aggregate::Yes;
        }
        impl diesel::expression::ValidGrouping<()> for typname {
            type IsAggregate = diesel::expression::is_aggregate::No;
        }
        impl diesel::expression::IsContainedInGroupBy<typname> for typname {
            type Output = diesel::expression::is_contained_in_group_by::Yes;
        }
        impl diesel::query_source::Column for typname {
            type Table = super::table;
            const NAME: &'static str = "typname";
        }
        impl<T> diesel::EqAll<T> for typname where
            T: diesel::expression::AsExpression<Text>,
            diesel::dsl::Eq<typname,
            T::Expression>: diesel::Expression<SqlType =
            diesel::sql_types::Bool> {
            type Output = diesel::dsl::Eq<Self, T::Expression>;
            fn eq_all(self, __diesel_internal_rhs: T) -> Self::Output {
                use diesel::expression_methods::ExpressionMethods;
                self.eq(__diesel_internal_rhs)
            }
        }
        impl diesel::query_source::AppearsInFromClause<diesel::query_builder::Only<super::table>>
            for typname {
            type Count = diesel::query_source::Once;
        }
        impl diesel::SelectableExpression<diesel::query_builder::Only<super::table>>
            for typname {}
        impl<TSM>
            diesel::query_source::AppearsInFromClause<diesel::query_builder::Tablesample<super::table,
            TSM>> for typname where
            TSM: diesel::internal::table_macro::TablesampleMethod {
            type Count = diesel::query_source::Once;
        }
        impl<TSM>
            diesel::SelectableExpression<diesel::query_builder::Tablesample<super::table,
            TSM>> for typname where
            TSM: diesel::internal::table_macro::TablesampleMethod {}
        #[allow(non_camel_case_types, dead_code)]
        pub struct typarray;
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::fmt::Debug for typarray {
            #[inline]
            fn fmt(&self, f: &mut ::core::fmt::Formatter)
                -> ::core::fmt::Result {
                ::core::fmt::Formatter::write_str(f, "typarray")
            }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::clone::Clone for typarray {
            #[inline]
            fn clone(&self) -> typarray { *self }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::marker::Copy for typarray { }
        const _: () =
            {
                use diesel;
                #[allow(non_camel_case_types)]
                impl diesel::query_builder::QueryId for typarray {
                    type QueryId = typarray<>;
                    const HAS_STATIC_QUERY_ID: bool = true;
                    const IS_WINDOW_FUNCTION: bool = false;
                }
            };
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::default::Default for typarray {
            #[inline]
            fn default() -> typarray { typarray {} }
        }
        impl diesel::expression::Expression for typarray {
            type SqlType = Oid;
        }
        impl<DB> diesel::query_builder::QueryFragment<DB> for typarray where
            DB: diesel::backend::Backend,
            diesel::internal::table_macro::StaticQueryFragmentInstance<table>: diesel::query_builder::QueryFragment<DB>
            {
            #[allow(non_snake_case)]
            fn walk_ast<'b>(&'b self,
                mut __diesel_internal_out:
                    diesel::query_builder::AstPass<'_, 'b, DB>)
                -> diesel::result::QueryResult<()> {
                if !__diesel_internal_out.should_skip_from() {
                    const FROM_CLAUSE:
                        diesel::internal::table_macro::StaticQueryFragmentInstance<table>
                        =
                        diesel::internal::table_macro::StaticQueryFragmentInstance::new();
                    FROM_CLAUSE.walk_ast(__diesel_internal_out.reborrow())?;
                    __diesel_internal_out.push_sql(".");
                }
                __diesel_internal_out.push_identifier("typarray")
            }
        }
        impl diesel::SelectableExpression<super::table> for typarray {}
        impl<QS> diesel::AppearsOnTable<QS> for typarray where
            QS: diesel::query_source::AppearsInFromClause<super::table, Count
            = diesel::query_source::Once> {}
        impl<Left, Right>
            diesel::SelectableExpression<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::LeftOuter>> for typarray
            where
            typarray: diesel::AppearsOnTable<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::LeftOuter>>,
            Self: diesel::SelectableExpression<Left>,
            Right: diesel::query_source::AppearsInFromClause<super::table,
            Count = diesel::query_source::Never> +
            diesel::query_source::QuerySource,
            Left: diesel::query_source::QuerySource {}
        impl<Left, Right>
            diesel::SelectableExpression<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::Inner>> for typarray where
            typarray: diesel::AppearsOnTable<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::Inner>>,
            Left: diesel::query_source::AppearsInFromClause<super::table> +
            diesel::query_source::QuerySource,
            Right: diesel::query_source::AppearsInFromClause<super::table> +
            diesel::query_source::QuerySource,
            (Left::Count,
            Right::Count): diesel::internal::table_macro::Pick<Left, Right>,
            Self: diesel::SelectableExpression<<(Left::Count, Right::Count) as
            diesel::internal::table_macro::Pick<Left, Right>>::Selection> {}
        impl<Join, On>
            diesel::SelectableExpression<diesel::internal::table_macro::JoinOn<Join,
            On>> for typarray where
            typarray: diesel::SelectableExpression<Join> +
            diesel::AppearsOnTable<diesel::internal::table_macro::JoinOn<Join,
            On>> {}
        impl<From>
            diesel::SelectableExpression<diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<From>>>
            for typarray where From: diesel::query_source::QuerySource,
            typarray: diesel::SelectableExpression<From> +
            diesel::AppearsOnTable<diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<From>>>
            {}
        impl<__GB> diesel::expression::ValidGrouping<__GB> for typarray where
            __GB: diesel::expression::IsContainedInGroupBy<typarray, Output =
            diesel::expression::is_contained_in_group_by::Yes> {
            type IsAggregate = diesel::expression::is_aggregate::Yes;
        }
        impl diesel::expression::ValidGrouping<()> for typarray {
            type IsAggregate = diesel::expression::is_aggregate::No;
        }
        impl diesel::expression::IsContainedInGroupBy<typarray> for typarray {
            type Output = diesel::expression::is_contained_in_group_by::Yes;
        }
        impl diesel::query_source::Column for typarray {
            type Table = super::table;
            const NAME: &'static str = "typarray";
        }
        impl<T> diesel::EqAll<T> for typarray where
            T: diesel::expression::AsExpression<Oid>,
            diesel::dsl::Eq<typarray,
            T::Expression>: diesel::Expression<SqlType =
            diesel::sql_types::Bool> {
            type Output = diesel::dsl::Eq<Self, T::Expression>;
            fn eq_all(self, __diesel_internal_rhs: T) -> Self::Output {
                use diesel::expression_methods::ExpressionMethods;
                self.eq(__diesel_internal_rhs)
            }
        }
        impl diesel::query_source::AppearsInFromClause<diesel::query_builder::Only<super::table>>
            for typarray {
            type Count = diesel::query_source::Once;
        }
        impl diesel::SelectableExpression<diesel::query_builder::Only<super::table>>
            for typarray {}
        impl<TSM>
            diesel::query_source::AppearsInFromClause<diesel::query_builder::Tablesample<super::table,
            TSM>> for typarray where
            TSM: diesel::internal::table_macro::TablesampleMethod {
            type Count = diesel::query_source::Once;
        }
        impl<TSM>
            diesel::SelectableExpression<diesel::query_builder::Tablesample<super::table,
            TSM>> for typarray where
            TSM: diesel::internal::table_macro::TablesampleMethod {}
        #[allow(non_camel_case_types, dead_code)]
        pub struct typnamespace;
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::fmt::Debug for typnamespace {
            #[inline]
            fn fmt(&self, f: &mut ::core::fmt::Formatter)
                -> ::core::fmt::Result {
                ::core::fmt::Formatter::write_str(f, "typnamespace")
            }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::clone::Clone for typnamespace {
            #[inline]
            fn clone(&self) -> typnamespace { *self }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::marker::Copy for typnamespace { }
        const _: () =
            {
                use diesel;
                #[allow(non_camel_case_types)]
                impl diesel::query_builder::QueryId for typnamespace {
                    type QueryId = typnamespace<>;
                    const HAS_STATIC_QUERY_ID: bool = true;
                    const IS_WINDOW_FUNCTION: bool = false;
                }
            };
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::default::Default for typnamespace {
            #[inline]
            fn default() -> typnamespace { typnamespace {} }
        }
        impl diesel::expression::Expression for typnamespace {
            type SqlType = Oid;
        }
        impl<DB> diesel::query_builder::QueryFragment<DB> for typnamespace
            where DB: diesel::backend::Backend,
            diesel::internal::table_macro::StaticQueryFragmentInstance<table>: diesel::query_builder::QueryFragment<DB>
            {
            #[allow(non_snake_case)]
            fn walk_ast<'b>(&'b self,
                mut __diesel_internal_out:
                    diesel::query_builder::AstPass<'_, 'b, DB>)
                -> diesel::result::QueryResult<()> {
                if !__diesel_internal_out.should_skip_from() {
                    const FROM_CLAUSE:
                        diesel::internal::table_macro::StaticQueryFragmentInstance<table>
                        =
                        diesel::internal::table_macro::StaticQueryFragmentInstance::new();
                    FROM_CLAUSE.walk_ast(__diesel_internal_out.reborrow())?;
                    __diesel_internal_out.push_sql(".");
                }
                __diesel_internal_out.push_identifier("typnamespace")
            }
        }
        impl diesel::SelectableExpression<super::table> for typnamespace {}
        impl<QS> diesel::AppearsOnTable<QS> for typnamespace where
            QS: diesel::query_source::AppearsInFromClause<super::table, Count
            = diesel::query_source::Once> {}
        impl<Left, Right>
            diesel::SelectableExpression<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::LeftOuter>> for typnamespace
            where
            typnamespace: diesel::AppearsOnTable<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::LeftOuter>>,
            Self: diesel::SelectableExpression<Left>,
            Right: diesel::query_source::AppearsInFromClause<super::table,
            Count = diesel::query_source::Never> +
            diesel::query_source::QuerySource,
            Left: diesel::query_source::QuerySource {}
        impl<Left, Right>
            diesel::SelectableExpression<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::Inner>> for typnamespace
            where
            typnamespace: diesel::AppearsOnTable<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::Inner>>,
            Left: diesel::query_source::AppearsInFromClause<super::table> +
            diesel::query_source::QuerySource,
            Right: diesel::query_source::AppearsInFromClause<super::table> +
            diesel::query_source::QuerySource,
            (Left::Count,
            Right::Count): diesel::internal::table_macro::Pick<Left, Right>,
            Self: diesel::SelectableExpression<<(Left::Count, Right::Count) as
            diesel::internal::table_macro::Pick<Left, Right>>::Selection> {}
        impl<Join, On>
            diesel::SelectableExpression<diesel::internal::table_macro::JoinOn<Join,
            On>> for typnamespace where
            typnamespace: diesel::SelectableExpression<Join> +
            diesel::AppearsOnTable<diesel::internal::table_macro::JoinOn<Join,
            On>> {}
        impl<From>
            diesel::SelectableExpression<diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<From>>>
            for typnamespace where From: diesel::query_source::QuerySource,
            typnamespace: diesel::SelectableExpression<From> +
            diesel::AppearsOnTable<diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<From>>>
            {}
        impl<__GB> diesel::expression::ValidGrouping<__GB> for typnamespace
            where
            __GB: diesel::expression::IsContainedInGroupBy<typnamespace,
            Output = diesel::expression::is_contained_in_group_by::Yes> {
            type IsAggregate = diesel::expression::is_aggregate::Yes;
        }
        impl diesel::expression::ValidGrouping<()> for typnamespace {
            type IsAggregate = diesel::expression::is_aggregate::No;
        }
        impl diesel::expression::IsContainedInGroupBy<typnamespace> for
            typnamespace {
            type Output = diesel::expression::is_contained_in_group_by::Yes;
        }
        impl diesel::query_source::Column for typnamespace {
            type Table = super::table;
            const NAME: &'static str = "typnamespace";
        }
        impl<T> diesel::EqAll<T> for typnamespace where
            T: diesel::expression::AsExpression<Oid>,
            diesel::dsl::Eq<typnamespace,
            T::Expression>: diesel::Expression<SqlType =
            diesel::sql_types::Bool> {
            type Output = diesel::dsl::Eq<Self, T::Expression>;
            fn eq_all(self, __diesel_internal_rhs: T) -> Self::Output {
                use diesel::expression_methods::ExpressionMethods;
                self.eq(__diesel_internal_rhs)
            }
        }
        impl diesel::query_source::AppearsInFromClause<diesel::query_builder::Only<super::table>>
            for typnamespace {
            type Count = diesel::query_source::Once;
        }
        impl diesel::SelectableExpression<diesel::query_builder::Only<super::table>>
            for typnamespace {}
        impl<TSM>
            diesel::query_source::AppearsInFromClause<diesel::query_builder::Tablesample<super::table,
            TSM>> for typnamespace where
            TSM: diesel::internal::table_macro::TablesampleMethod {
            type Count = diesel::query_source::Once;
        }
        impl<TSM>
            diesel::SelectableExpression<diesel::query_builder::Tablesample<super::table,
            TSM>> for typnamespace where
            TSM: diesel::internal::table_macro::TablesampleMethod {}
        impl diesel::expression::IsContainedInGroupBy<oid> for typname {
            type Output = diesel::expression::is_contained_in_group_by::No;
        }
        impl diesel::expression::IsContainedInGroupBy<typname> for oid {
            type Output = diesel::expression::is_contained_in_group_by::Yes;
        }
        impl diesel::expression::IsContainedInGroupBy<oid> for typarray {
            type Output = diesel::expression::is_contained_in_group_by::No;
        }
        impl diesel::expression::IsContainedInGroupBy<typarray> for oid {
            type Output = diesel::expression::is_contained_in_group_by::Yes;
        }
        impl diesel::expression::IsContainedInGroupBy<oid> for typnamespace {
            type Output = diesel::expression::is_contained_in_group_by::No;
        }
        impl diesel::expression::IsContainedInGroupBy<typnamespace> for oid {
            type Output = diesel::expression::is_contained_in_group_by::Yes;
        }
        impl diesel::expression::IsContainedInGroupBy<typname> for typarray {
            type Output = diesel::expression::is_contained_in_group_by::No;
        }
        impl diesel::expression::IsContainedInGroupBy<typarray> for typname {
            type Output = diesel::expression::is_contained_in_group_by::No;
        }
        impl diesel::expression::IsContainedInGroupBy<typname> for
            typnamespace {
            type Output = diesel::expression::is_contained_in_group_by::No;
        }
        impl diesel::expression::IsContainedInGroupBy<typnamespace> for
            typname {
            type Output = diesel::expression::is_contained_in_group_by::No;
        }
        impl diesel::expression::IsContainedInGroupBy<typarray> for
            typnamespace {
            type Output = diesel::expression::is_contained_in_group_by::No;
        }
        impl diesel::expression::IsContainedInGroupBy<typnamespace> for
            typarray {
            type Output = diesel::expression::is_contained_in_group_by::No;
        }
    }
}table! {
199    pg_type (oid) {
200        oid -> Oid,
201        typname -> Text,
202        typarray -> Oid,
203        typnamespace -> Oid,
204    }
205}
206
207#[allow(unused_imports, dead_code, unreachable_pub, unused_qualifications)]
pub mod pg_namespace {
    use ::diesel;
    pub use self::columns::*;
    use diesel::sql_types::*;
    #[doc = r" Re-exports all of the columns of this table, as well as the"]
    #[doc = r" table struct renamed to the module name. This is meant to be"]
    #[doc = r" glob imported for functions which only deal with one table."]
    pub mod dsl {
        pub use super::columns::oid;
        pub use super::columns::nspname;
        pub use super::table as pg_namespace;
    }
    #[allow(non_upper_case_globals, dead_code)]
    #[doc = r" A tuple of all of the columns on this table"]
    pub const all_columns: (oid, nspname) = (oid, nspname);
    #[allow(non_camel_case_types)]
    #[doc = r" The actual table struct"]
    #[doc = r""]
    #[doc = r" This is the type which provides the base methods of the query"]
    #[doc = r" builder, such as `.select` and `.filter`."]
    pub struct table;
    #[automatically_derived]
    #[allow(non_camel_case_types)]
    impl ::core::fmt::Debug for table {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::write_str(f, "table")
        }
    }
    #[automatically_derived]
    #[allow(non_camel_case_types)]
    impl ::core::clone::Clone for table {
        #[inline]
        fn clone(&self) -> table { *self }
    }
    #[automatically_derived]
    #[allow(non_camel_case_types)]
    impl ::core::marker::Copy for table { }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl diesel::query_builder::QueryId for table {
                type QueryId = table<>;
                const HAS_STATIC_QUERY_ID: bool = true;
                const IS_WINDOW_FUNCTION: bool = false;
            }
        };
    #[automatically_derived]
    #[allow(non_camel_case_types)]
    impl ::core::default::Default for table {
        #[inline]
        fn default() -> table { table {} }
    }
    impl table {
        #[allow(dead_code)]
        #[doc = r" Represents `table_name.*`, which is sometimes necessary"]
        #[doc =
        r" for efficient count queries. It cannot be used in place of"]
        #[doc = r" `all_columns`"]
        pub fn star(&self) -> star { star }
    }
    #[doc = r" The SQL type of all of the columns on this table"]
    pub type SqlType = (Oid, Text);
    #[doc = r" Helper type for representing a boxed query from this table"]
    pub type BoxedQuery<'a, DB, ST = SqlType> =
        diesel::internal::table_macro::BoxedSelectStatement<'a, ST,
        diesel::internal::table_macro::FromClause<table>, DB>;
    impl diesel::QuerySource for table {
        type FromClause =
            diesel::internal::table_macro::StaticQueryFragmentInstance<table>;
        type DefaultSelection = <Self as diesel::Table>::AllColumns;
        fn from_clause(&self) -> Self::FromClause {
            diesel::internal::table_macro::StaticQueryFragmentInstance::new()
        }
        fn default_selection(&self) -> Self::DefaultSelection {
            use diesel::Table;
            Self::all_columns()
        }
    }
    impl<DB> diesel::query_builder::QueryFragment<DB> for table where
        DB: diesel::backend::Backend,
        <table as
        diesel::internal::table_macro::StaticQueryFragment>::Component: diesel::query_builder::QueryFragment<DB>
        {
        fn walk_ast<'b>(&'b self,
            __diesel_internal_pass:
                diesel::query_builder::AstPass<'_, 'b, DB>)
            -> diesel::result::QueryResult<()> {
            <table as
                    diesel::internal::table_macro::StaticQueryFragment>::STATIC_COMPONENT.walk_ast(__diesel_internal_pass)
        }
    }
    impl diesel::internal::table_macro::StaticQueryFragment for table {
        type Component = diesel::internal::table_macro::Identifier<'static>;
        const STATIC_COMPONENT: &'static Self::Component =
            &diesel::internal::table_macro::Identifier("pg_namespace");
    }
    impl diesel::query_builder::AsQuery for table {
        type SqlType = SqlType;
        type Query =
            diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<Self>>;
        fn as_query(self) -> Self::Query {
            diesel::internal::table_macro::SelectStatement::simple(self)
        }
    }
    impl diesel::Table for table {
        type PrimaryKey = oid;
        type AllColumns = (oid, nspname);
        fn primary_key(&self) -> Self::PrimaryKey { oid }
        fn all_columns() -> Self::AllColumns { (oid, nspname) }
    }
    impl diesel::associations::HasTable for table {
        type Table = Self;
        fn table() -> Self::Table { table }
    }
    impl diesel::query_builder::IntoUpdateTarget for table {
        type WhereClause =
            <<Self as diesel::query_builder::AsQuery>::Query as
            diesel::query_builder::IntoUpdateTarget>::WhereClause;
        fn into_update_target(self)
            ->
                diesel::query_builder::UpdateTarget<Self::Table,
                Self::WhereClause> {
            use diesel::query_builder::AsQuery;
            let q:
                    diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<table>> =
                self.as_query();
            q.into_update_target()
        }
    }
    impl diesel::query_source::AppearsInFromClause<table> for table {
        type Count = diesel::query_source::Once;
    }
    impl<S> diesel::internal::table_macro::AliasAppearsInFromClause<S, table>
        for table where S: diesel::query_source::AliasSource<Target = table> {
        type Count = diesel::query_source::Never;
    }
    impl<S1, S2>
        diesel::internal::table_macro::AliasAliasAppearsInFromClause<table,
        S2, S1> for table where
        S1: diesel::query_source::AliasSource<Target = table>,
        S2: diesel::query_source::AliasSource<Target = table>,
        S1: diesel::internal::table_macro::AliasAliasAppearsInFromClauseSameTable<S2,
        table> {
        type Count =
            <S1 as
            diesel::internal::table_macro::AliasAliasAppearsInFromClauseSameTable<S2,
            table>>::Count;
    }
    impl<S>
        diesel::query_source::AppearsInFromClause<diesel::query_source::Alias<S>>
        for table where S: diesel::query_source::AliasSource {
        type Count = diesel::query_source::Never;
    }
    impl<S, C>
        diesel::internal::table_macro::FieldAliasMapperAssociatedTypesDisjointnessTrick<table,
        S, C> for table where
        S: diesel::query_source::AliasSource<Target = table> +
        ::std::clone::Clone, C: diesel::query_source::Column<Table = table> {
        type Out = diesel::query_source::AliasedField<S, C>;
        fn map(__diesel_internal_column: C,
            __diesel_internal_alias: &diesel::query_source::Alias<S>)
            -> Self::Out {
            __diesel_internal_alias.field(__diesel_internal_column)
        }
    }
    impl diesel::query_source::AppearsInFromClause<table> for
        diesel::internal::table_macro::NoFromClause {
        type Count = diesel::query_source::Never;
    }
    impl<Left, Right, Kind>
        diesel::JoinTo<diesel::internal::table_macro::Join<Left, Right, Kind>>
        for table where
        diesel::internal::table_macro::Join<Left, Right,
        Kind>: diesel::JoinTo<table>, Left: diesel::query_source::QuerySource,
        Right: diesel::query_source::QuerySource {
        type FromClause =
            diesel::internal::table_macro::Join<Left, Right, Kind>;
        type OnClause =
            <diesel::internal::table_macro::Join<Left, Right, Kind> as
            diesel::JoinTo<table>>::OnClause;
        fn join_target(__diesel_internal_rhs:
                diesel::internal::table_macro::Join<Left, Right, Kind>)
            -> (Self::FromClause, Self::OnClause) {
            let (_, __diesel_internal_on_clause) =
                diesel::internal::table_macro::Join::join_target(table);
            (__diesel_internal_rhs, __diesel_internal_on_clause)
        }
    }
    impl<Join, On>
        diesel::JoinTo<diesel::internal::table_macro::JoinOn<Join, On>> for
        table where
        diesel::internal::table_macro::JoinOn<Join, On>: diesel::JoinTo<table>
        {
        type FromClause = diesel::internal::table_macro::JoinOn<Join, On>;
        type OnClause =
            <diesel::internal::table_macro::JoinOn<Join, On> as
            diesel::JoinTo<table>>::OnClause;
        fn join_target(__diesel_internal_rhs:
                diesel::internal::table_macro::JoinOn<Join, On>)
            -> (Self::FromClause, Self::OnClause) {
            let (_, __diesel_internal_on_clause) =
                diesel::internal::table_macro::JoinOn::join_target(table);
            (__diesel_internal_rhs, __diesel_internal_on_clause)
        }
    }
    impl<F, S, D, W, O, L, Of, G>
        diesel::JoinTo<diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<F>,
        S, D, W, O, L, Of, G>> for table where
        diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<F>,
        S, D, W, O, L, Of, G>: diesel::JoinTo<table>,
        F: diesel::query_source::QuerySource {
        type FromClause =
            diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<F>,
            S, D, W, O, L, Of, G>;
        type OnClause =
            <diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<F>,
            S, D, W, O, L, Of, G> as diesel::JoinTo<table>>::OnClause;
        fn join_target(__diesel_internal_rhs:
                diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<F>,
                S, D, W, O, L, Of, G>) -> (Self::FromClause, Self::OnClause) {
            let (_, __diesel_internal_on_clause) =
                diesel::internal::table_macro::SelectStatement::join_target(table);
            (__diesel_internal_rhs, __diesel_internal_on_clause)
        }
    }
    impl<'a, QS, ST, DB>
        diesel::JoinTo<diesel::internal::table_macro::BoxedSelectStatement<'a,
        diesel::internal::table_macro::FromClause<QS>, ST, DB>> for table
        where
        diesel::internal::table_macro::BoxedSelectStatement<'a,
        diesel::internal::table_macro::FromClause<QS>, ST,
        DB>: diesel::JoinTo<table>, QS: diesel::query_source::QuerySource {
        type FromClause =
            diesel::internal::table_macro::BoxedSelectStatement<'a,
            diesel::internal::table_macro::FromClause<QS>, ST, DB>;
        type OnClause =
            <diesel::internal::table_macro::BoxedSelectStatement<'a,
            diesel::internal::table_macro::FromClause<QS>, ST, DB> as
            diesel::JoinTo<table>>::OnClause;
        fn join_target(__diesel_internal_rhs:
                diesel::internal::table_macro::BoxedSelectStatement<'a,
                diesel::internal::table_macro::FromClause<QS>, ST, DB>)
            -> (Self::FromClause, Self::OnClause) {
            let (_, __diesel_internal_on_clause) =
                diesel::internal::table_macro::BoxedSelectStatement::join_target(table);
            (__diesel_internal_rhs, __diesel_internal_on_clause)
        }
    }
    impl<S> diesel::JoinTo<diesel::query_source::Alias<S>> for table where
        diesel::query_source::Alias<S>: diesel::JoinTo<table> {
        type FromClause = diesel::query_source::Alias<S>;
        type OnClause =
            <diesel::query_source::Alias<S> as
            diesel::JoinTo<table>>::OnClause;
        fn join_target(__diesel_internal_rhs: diesel::query_source::Alias<S>)
            -> (Self::FromClause, Self::OnClause) {
            let (_, __diesel_internal_on_clause) =
                diesel::query_source::Alias::<S>::join_target(table);
            (__diesel_internal_rhs, __diesel_internal_on_clause)
        }
    }
    impl<T> diesel::insertable::Insertable<T> for table where
        <table as
        diesel::query_builder::AsQuery>::Query: diesel::insertable::Insertable<T>
        {
        type Values =
            <<table as diesel::query_builder::AsQuery>::Query as
            diesel::insertable::Insertable<T>>::Values;
        fn values(self) -> Self::Values {
            use diesel::query_builder::AsQuery;
            self.as_query().values()
        }
    }
    impl<'a, T> diesel::insertable::Insertable<T> for &'a table where
        table: diesel::insertable::Insertable<T> {
        type Values = <table as diesel::insertable::Insertable<T>>::Values;
        fn values(self) -> Self::Values { (*self).values() }
    }
    impl<S> diesel::JoinTo<diesel::query_builder::Only<S>> for table where
        diesel::query_builder::Only<S>: diesel::JoinTo<table> {
        type FromClause = diesel::query_builder::Only<S>;
        type OnClause =
            <diesel::query_builder::Only<S> as
            diesel::JoinTo<table>>::OnClause;
        fn join_target(__diesel_internal_rhs: diesel::query_builder::Only<S>)
            -> (Self::FromClause, Self::OnClause) {
            let (_, __diesel_internal_on_clause) =
                diesel::query_builder::Only::<S>::join_target(table);
            (__diesel_internal_rhs, __diesel_internal_on_clause)
        }
    }
    impl diesel::query_source::AppearsInFromClause<diesel::query_builder::Only<table>>
        for table {
        type Count = diesel::query_source::Once;
    }
    impl diesel::query_source::AppearsInFromClause<table> for
        diesel::query_builder::Only<table> {
        type Count = diesel::query_source::Once;
    }
    impl<S, TSM> diesel::JoinTo<diesel::query_builder::Tablesample<S, TSM>>
        for table where
        diesel::query_builder::Tablesample<S, TSM>: diesel::JoinTo<table>,
        TSM: diesel::internal::table_macro::TablesampleMethod {
        type FromClause = diesel::query_builder::Tablesample<S, TSM>;
        type OnClause =
            <diesel::query_builder::Tablesample<S, TSM> as
            diesel::JoinTo<table>>::OnClause;
        fn join_target(__diesel_internal_rhs:
                diesel::query_builder::Tablesample<S, TSM>)
            -> (Self::FromClause, Self::OnClause) {
            let (_, __diesel_internal_on_clause) =
                diesel::query_builder::Tablesample::<S,
                        TSM>::join_target(table);
            (__diesel_internal_rhs, __diesel_internal_on_clause)
        }
    }
    impl<TSM>
        diesel::query_source::AppearsInFromClause<diesel::query_builder::Tablesample<table,
        TSM>> for table where
        TSM: diesel::internal::table_macro::TablesampleMethod {
        type Count = diesel::query_source::Once;
    }
    impl<TSM> diesel::query_source::AppearsInFromClause<table> for
        diesel::query_builder::Tablesample<table, TSM> where
        TSM: diesel::internal::table_macro::TablesampleMethod {
        type Count = diesel::query_source::Once;
    }
    #[doc = r" Contains all of the columns of this table"]
    pub mod columns {
        use ::diesel;
        use super::table;
        use diesel::sql_types::*;
        #[allow(non_camel_case_types, dead_code)]
        #[doc = r" Represents `table_name.*`, which is sometimes needed for"]
        #[doc = r" efficient count queries. It cannot be used in place of"]
        #[doc = r" `all_columns`, and has a `SqlType` of `()` to prevent it"]
        #[doc = r" being used that way"]
        pub struct star;
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::fmt::Debug for star {
            #[inline]
            fn fmt(&self, f: &mut ::core::fmt::Formatter)
                -> ::core::fmt::Result {
                ::core::fmt::Formatter::write_str(f, "star")
            }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::clone::Clone for star {
            #[inline]
            fn clone(&self) -> star { *self }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::marker::Copy for star { }
        const _: () =
            {
                use diesel;
                #[allow(non_camel_case_types)]
                impl diesel::query_builder::QueryId for star {
                    type QueryId = star<>;
                    const HAS_STATIC_QUERY_ID: bool = true;
                    const IS_WINDOW_FUNCTION: bool = false;
                }
            };
        impl<__GB> diesel::expression::ValidGrouping<__GB> for star where
            (oid, nspname): diesel::expression::ValidGrouping<__GB> {
            type IsAggregate =
                <(oid, nspname) as
                diesel::expression::ValidGrouping<__GB>>::IsAggregate;
        }
        impl diesel::Expression for star {
            type SqlType =
                diesel::expression::expression_types::NotSelectable;
        }
        impl<DB: diesel::backend::Backend>
            diesel::query_builder::QueryFragment<DB> for star where
            <table as
            diesel::QuerySource>::FromClause: diesel::query_builder::QueryFragment<DB>
            {
            #[allow(non_snake_case)]
            fn walk_ast<'b>(&'b self,
                mut __diesel_internal_out:
                    diesel::query_builder::AstPass<'_, 'b, DB>)
                -> diesel::result::QueryResult<()> {
                use diesel::QuerySource;
                if !__diesel_internal_out.should_skip_from() {
                    const FROM_CLAUSE:
                        diesel::internal::table_macro::StaticQueryFragmentInstance<table>
                        =
                        diesel::internal::table_macro::StaticQueryFragmentInstance::new();
                    FROM_CLAUSE.walk_ast(__diesel_internal_out.reborrow())?;
                    __diesel_internal_out.push_sql(".");
                }
                __diesel_internal_out.push_sql("*");
                Ok(())
            }
        }
        impl diesel::SelectableExpression<table> for star {}
        impl diesel::AppearsOnTable<table> for star {}
        #[allow(non_camel_case_types, dead_code)]
        pub struct oid;
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::fmt::Debug for oid {
            #[inline]
            fn fmt(&self, f: &mut ::core::fmt::Formatter)
                -> ::core::fmt::Result {
                ::core::fmt::Formatter::write_str(f, "oid")
            }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::clone::Clone for oid {
            #[inline]
            fn clone(&self) -> oid { *self }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::marker::Copy for oid { }
        const _: () =
            {
                use diesel;
                #[allow(non_camel_case_types)]
                impl diesel::query_builder::QueryId for oid {
                    type QueryId = oid<>;
                    const HAS_STATIC_QUERY_ID: bool = true;
                    const IS_WINDOW_FUNCTION: bool = false;
                }
            };
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::default::Default for oid {
            #[inline]
            fn default() -> oid { oid {} }
        }
        impl diesel::expression::Expression for oid {
            type SqlType = Oid;
        }
        impl<DB> diesel::query_builder::QueryFragment<DB> for oid where
            DB: diesel::backend::Backend,
            diesel::internal::table_macro::StaticQueryFragmentInstance<table>: diesel::query_builder::QueryFragment<DB>
            {
            #[allow(non_snake_case)]
            fn walk_ast<'b>(&'b self,
                mut __diesel_internal_out:
                    diesel::query_builder::AstPass<'_, 'b, DB>)
                -> diesel::result::QueryResult<()> {
                if !__diesel_internal_out.should_skip_from() {
                    const FROM_CLAUSE:
                        diesel::internal::table_macro::StaticQueryFragmentInstance<table>
                        =
                        diesel::internal::table_macro::StaticQueryFragmentInstance::new();
                    FROM_CLAUSE.walk_ast(__diesel_internal_out.reborrow())?;
                    __diesel_internal_out.push_sql(".");
                }
                __diesel_internal_out.push_identifier("oid")
            }
        }
        impl diesel::SelectableExpression<super::table> for oid {}
        impl<QS> diesel::AppearsOnTable<QS> for oid where
            QS: diesel::query_source::AppearsInFromClause<super::table, Count
            = diesel::query_source::Once> {}
        impl<Left, Right>
            diesel::SelectableExpression<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::LeftOuter>> for oid where
            oid: diesel::AppearsOnTable<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::LeftOuter>>,
            Self: diesel::SelectableExpression<Left>,
            Right: diesel::query_source::AppearsInFromClause<super::table,
            Count = diesel::query_source::Never> +
            diesel::query_source::QuerySource,
            Left: diesel::query_source::QuerySource {}
        impl<Left, Right>
            diesel::SelectableExpression<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::Inner>> for oid where
            oid: diesel::AppearsOnTable<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::Inner>>,
            Left: diesel::query_source::AppearsInFromClause<super::table> +
            diesel::query_source::QuerySource,
            Right: diesel::query_source::AppearsInFromClause<super::table> +
            diesel::query_source::QuerySource,
            (Left::Count,
            Right::Count): diesel::internal::table_macro::Pick<Left, Right>,
            Self: diesel::SelectableExpression<<(Left::Count, Right::Count) as
            diesel::internal::table_macro::Pick<Left, Right>>::Selection> {}
        impl<Join, On>
            diesel::SelectableExpression<diesel::internal::table_macro::JoinOn<Join,
            On>> for oid where oid: diesel::SelectableExpression<Join> +
            diesel::AppearsOnTable<diesel::internal::table_macro::JoinOn<Join,
            On>> {}
        impl<From>
            diesel::SelectableExpression<diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<From>>>
            for oid where From: diesel::query_source::QuerySource,
            oid: diesel::SelectableExpression<From> +
            diesel::AppearsOnTable<diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<From>>>
            {}
        impl<__GB> diesel::expression::ValidGrouping<__GB> for oid where
            __GB: diesel::expression::IsContainedInGroupBy<oid, Output =
            diesel::expression::is_contained_in_group_by::Yes> {
            type IsAggregate = diesel::expression::is_aggregate::Yes;
        }
        impl diesel::expression::ValidGrouping<()> for oid {
            type IsAggregate = diesel::expression::is_aggregate::No;
        }
        impl diesel::expression::IsContainedInGroupBy<oid> for oid {
            type Output = diesel::expression::is_contained_in_group_by::Yes;
        }
        impl diesel::query_source::Column for oid {
            type Table = super::table;
            const NAME: &'static str = "oid";
        }
        impl<T> diesel::EqAll<T> for oid where
            T: diesel::expression::AsExpression<Oid>,
            diesel::dsl::Eq<oid,
            T::Expression>: diesel::Expression<SqlType =
            diesel::sql_types::Bool> {
            type Output = diesel::dsl::Eq<Self, T::Expression>;
            fn eq_all(self, __diesel_internal_rhs: T) -> Self::Output {
                use diesel::expression_methods::ExpressionMethods;
                self.eq(__diesel_internal_rhs)
            }
        }
        impl diesel::query_source::AppearsInFromClause<diesel::query_builder::Only<super::table>>
            for oid {
            type Count = diesel::query_source::Once;
        }
        impl diesel::SelectableExpression<diesel::query_builder::Only<super::table>>
            for oid {}
        impl<TSM>
            diesel::query_source::AppearsInFromClause<diesel::query_builder::Tablesample<super::table,
            TSM>> for oid where
            TSM: diesel::internal::table_macro::TablesampleMethod {
            type Count = diesel::query_source::Once;
        }
        impl<TSM>
            diesel::SelectableExpression<diesel::query_builder::Tablesample<super::table,
            TSM>> for oid where
            TSM: diesel::internal::table_macro::TablesampleMethod {}
        #[allow(non_camel_case_types, dead_code)]
        pub struct nspname;
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::fmt::Debug for nspname {
            #[inline]
            fn fmt(&self, f: &mut ::core::fmt::Formatter)
                -> ::core::fmt::Result {
                ::core::fmt::Formatter::write_str(f, "nspname")
            }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::clone::Clone for nspname {
            #[inline]
            fn clone(&self) -> nspname { *self }
        }
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::marker::Copy for nspname { }
        const _: () =
            {
                use diesel;
                #[allow(non_camel_case_types)]
                impl diesel::query_builder::QueryId for nspname {
                    type QueryId = nspname<>;
                    const HAS_STATIC_QUERY_ID: bool = true;
                    const IS_WINDOW_FUNCTION: bool = false;
                }
            };
        #[automatically_derived]
        #[allow(non_camel_case_types, dead_code)]
        impl ::core::default::Default for nspname {
            #[inline]
            fn default() -> nspname { nspname {} }
        }
        impl diesel::expression::Expression for nspname {
            type SqlType = Text;
        }
        impl<DB> diesel::query_builder::QueryFragment<DB> for nspname where
            DB: diesel::backend::Backend,
            diesel::internal::table_macro::StaticQueryFragmentInstance<table>: diesel::query_builder::QueryFragment<DB>
            {
            #[allow(non_snake_case)]
            fn walk_ast<'b>(&'b self,
                mut __diesel_internal_out:
                    diesel::query_builder::AstPass<'_, 'b, DB>)
                -> diesel::result::QueryResult<()> {
                if !__diesel_internal_out.should_skip_from() {
                    const FROM_CLAUSE:
                        diesel::internal::table_macro::StaticQueryFragmentInstance<table>
                        =
                        diesel::internal::table_macro::StaticQueryFragmentInstance::new();
                    FROM_CLAUSE.walk_ast(__diesel_internal_out.reborrow())?;
                    __diesel_internal_out.push_sql(".");
                }
                __diesel_internal_out.push_identifier("nspname")
            }
        }
        impl diesel::SelectableExpression<super::table> for nspname {}
        impl<QS> diesel::AppearsOnTable<QS> for nspname where
            QS: diesel::query_source::AppearsInFromClause<super::table, Count
            = diesel::query_source::Once> {}
        impl<Left, Right>
            diesel::SelectableExpression<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::LeftOuter>> for nspname
            where
            nspname: diesel::AppearsOnTable<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::LeftOuter>>,
            Self: diesel::SelectableExpression<Left>,
            Right: diesel::query_source::AppearsInFromClause<super::table,
            Count = diesel::query_source::Never> +
            diesel::query_source::QuerySource,
            Left: diesel::query_source::QuerySource {}
        impl<Left, Right>
            diesel::SelectableExpression<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::Inner>> for nspname where
            nspname: diesel::AppearsOnTable<diesel::internal::table_macro::Join<Left,
            Right, diesel::internal::table_macro::Inner>>,
            Left: diesel::query_source::AppearsInFromClause<super::table> +
            diesel::query_source::QuerySource,
            Right: diesel::query_source::AppearsInFromClause<super::table> +
            diesel::query_source::QuerySource,
            (Left::Count,
            Right::Count): diesel::internal::table_macro::Pick<Left, Right>,
            Self: diesel::SelectableExpression<<(Left::Count, Right::Count) as
            diesel::internal::table_macro::Pick<Left, Right>>::Selection> {}
        impl<Join, On>
            diesel::SelectableExpression<diesel::internal::table_macro::JoinOn<Join,
            On>> for nspname where
            nspname: diesel::SelectableExpression<Join> +
            diesel::AppearsOnTable<diesel::internal::table_macro::JoinOn<Join,
            On>> {}
        impl<From>
            diesel::SelectableExpression<diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<From>>>
            for nspname where From: diesel::query_source::QuerySource,
            nspname: diesel::SelectableExpression<From> +
            diesel::AppearsOnTable<diesel::internal::table_macro::SelectStatement<diesel::internal::table_macro::FromClause<From>>>
            {}
        impl<__GB> diesel::expression::ValidGrouping<__GB> for nspname where
            __GB: diesel::expression::IsContainedInGroupBy<nspname, Output =
            diesel::expression::is_contained_in_group_by::Yes> {
            type IsAggregate = diesel::expression::is_aggregate::Yes;
        }
        impl diesel::expression::ValidGrouping<()> for nspname {
            type IsAggregate = diesel::expression::is_aggregate::No;
        }
        impl diesel::expression::IsContainedInGroupBy<nspname> for nspname {
            type Output = diesel::expression::is_contained_in_group_by::Yes;
        }
        impl diesel::query_source::Column for nspname {
            type Table = super::table;
            const NAME: &'static str = "nspname";
        }
        impl<T> diesel::EqAll<T> for nspname where
            T: diesel::expression::AsExpression<Text>,
            diesel::dsl::Eq<nspname,
            T::Expression>: diesel::Expression<SqlType =
            diesel::sql_types::Bool> {
            type Output = diesel::dsl::Eq<Self, T::Expression>;
            fn eq_all(self, __diesel_internal_rhs: T) -> Self::Output {
                use diesel::expression_methods::ExpressionMethods;
                self.eq(__diesel_internal_rhs)
            }
        }
        impl diesel::query_source::AppearsInFromClause<diesel::query_builder::Only<super::table>>
            for nspname {
            type Count = diesel::query_source::Once;
        }
        impl diesel::SelectableExpression<diesel::query_builder::Only<super::table>>
            for nspname {}
        impl<TSM>
            diesel::query_source::AppearsInFromClause<diesel::query_builder::Tablesample<super::table,
            TSM>> for nspname where
            TSM: diesel::internal::table_macro::TablesampleMethod {
            type Count = diesel::query_source::Once;
        }
        impl<TSM>
            diesel::SelectableExpression<diesel::query_builder::Tablesample<super::table,
            TSM>> for nspname where
            TSM: diesel::internal::table_macro::TablesampleMethod {}
        impl diesel::expression::IsContainedInGroupBy<oid> for nspname {
            type Output = diesel::expression::is_contained_in_group_by::No;
        }
        impl diesel::expression::IsContainedInGroupBy<nspname> for oid {
            type Output = diesel::expression::is_contained_in_group_by::Yes;
        }
    }
}table! {
208    pg_namespace (oid) {
209        oid -> Oid,
210        nspname -> Text,
211    }
212}
213
214impl crate::JoinTo<pg_type::table> for pg_namespace::table {
    type FromClause = pg_type::table;
    type OnClause =
        crate::dsl::Eq<crate::internal::table_macro::NullableExpression<pg_type::typnamespace>,
        crate::internal::table_macro::NullableExpression<<pg_namespace::table
        as crate::query_source::Table>::PrimaryKey>>;
    fn join_target(rhs: pg_type::table)
        -> (Self::FromClause, Self::OnClause) {
        use crate::{ExpressionMethods, NullableExpressionMethods};
        (rhs,
            pg_type::typnamespace.nullable().eq(<pg_namespace::table as
                            crate::query_source::Table>::primary_key(&pg_namespace::table).nullable()))
    }
}joinable!(pg_type -> pg_namespace(typnamespace));
215impl crate::query_source::TableNotEqual<pg_type::table> for
    pg_namespace::table {}
impl crate::query_source::TableNotEqual<pg_namespace::table> for
    pg_type::table {}
impl crate::query_source::TableNotEqual<pg_type::table> for
    crate::query_builder::Only<pg_namespace::table> {}
impl crate::query_source::TableNotEqual<pg_namespace::table> for
    crate::query_builder::Only<pg_type::table> {}
impl crate::query_source::TableNotEqual<crate::query_builder::Only<pg_type::table>>
    for pg_namespace::table {}
impl crate::query_source::TableNotEqual<crate::query_builder::Only<pg_namespace::table>>
    for pg_type::table {}
impl<TSM> crate::query_source::TableNotEqual<pg_type::table> for
    crate::query_builder::Tablesample<pg_namespace::table, TSM> where
    TSM: crate::internal::table_macro::TablesampleMethod {}
impl<TSM> crate::query_source::TableNotEqual<pg_namespace::table> for
    crate::query_builder::Tablesample<pg_type::table, TSM> where
    TSM: crate::internal::table_macro::TablesampleMethod {}
impl<TSM>
    crate::query_source::TableNotEqual<crate::query_builder::Tablesample<pg_type::table,
    TSM>> for pg_namespace::table where
    TSM: crate::internal::table_macro::TablesampleMethod {}
impl<TSM>
    crate::query_source::TableNotEqual<crate::query_builder::Tablesample<pg_namespace::table,
    TSM>> for pg_type::table where
    TSM: crate::internal::table_macro::TablesampleMethod {}allow_tables_to_appear_in_same_query!(pg_type, pg_namespace);
216
217#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod pg_my_temp_schema_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct pg_my_temp_schema {}
    #[automatically_derived]
    impl ::core::fmt::Debug for pg_my_temp_schema {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::write_str(f, "pg_my_temp_schema")
        }
    }
    #[automatically_derived]
    impl ::core::clone::Clone for pg_my_temp_schema {
        #[inline]
        fn clone(&self) -> pg_my_temp_schema { *self }
    }
    #[automatically_derived]
    impl ::core::marker::Copy for pg_my_temp_schema { }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl diesel::query_builder::QueryId for pg_my_temp_schema {
                type QueryId = pg_my_temp_schema<>;
                const HAS_STATIC_QUERY_ID: bool = true;
                const IS_WINDOW_FUNCTION: bool = false;
            }
        };
    #[doc = "The return type of [`pg_my_temp_schema()`](super::fn_name)"]
    pub type HelperType = pg_my_temp_schema<>;
    impl Expression for pg_my_temp_schema where  {
        type SqlType = Oid;
    }
    impl<__DieselInternal> SelectableExpression<__DieselInternal> for
        pg_my_temp_schema where Self: AppearsOnTable<__DieselInternal> {}
    impl<__DieselInternal> AppearsOnTable<__DieselInternal> for
        pg_my_temp_schema where Self: Expression {}
    impl<__DieselInternal> FunctionFragment<__DieselInternal> for
        pg_my_temp_schema where __DieselInternal: diesel::backend::Backend {
        const FUNCTION_NAME: &'static str = "pg_my_temp_schema";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            Ok(())
        }
    }
    impl<__DieselInternal> QueryFragment<__DieselInternal> for
        pg_my_temp_schema where __DieselInternal: diesel::backend::Backend {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<__DieselInternal>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived();
    const _: () =
        {
            use diesel;
            impl<__GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived {
                type IsAggregate = diesel::expression::is_aggregate::Never;
            }
        };
    impl<__DieselInternal> ValidGrouping<__DieselInternal> for
        pg_my_temp_schema where __Derived<>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}#[declare_sql_function]
218extern "SQL" {
219    fn pg_my_temp_schema() -> Oid;
220}