//! Meta layer information around pg_type

/// A Postgres type. Similar structure as pg_catalog.pg_type.
/// <https://www.postgresql.org/docs/14/catalog-pg-type.html>
#[derive(Debug)]
pub struct PgType<'a> {
    pub oid: u32,
    /// Data type name
    pub typname: &'a str,
    // Name of the type when converted to regtype
    pub regtype: &'a str,
    /// The OID of the namespace that contains this type. references pg_namespace.oid
    pub typnamespace: u32,
    /// Owner of the type. references pg_authid.oid
    pub typowner: u32,
    /// For a fixed-size type, typlen is the number of bytes in the internal representation of the type. But for a variable-length type, typlen is negative. -1 indicates a “varlena” type (one that has a length word), -2 indicates a null-terminated C string.
    pub typlen: i16,
    pub typbyval: bool,
    pub typtype: &'a str,
    pub typcategory: &'a str,
    pub typisprefered: bool,
    pub typisdefined: bool,
    pub typrelid: u32,
    pub typsubscript: &'static str,
    pub typelem: u32,
    pub typarray: u32,
    pub typalign: &'static str,
    pub typstorage: &'static str,
    pub typbasetype: u32,
    pub typreceive: &'static str,
    pub typreceive_oid: u32,
}

impl PgType<'_> {
    pub fn get_typinput(&self) -> String {
        if let Some(ty_id) = PgTypeId::from_oid(self.oid) {
            // TODO: It requires additional verification
            match ty_id {
                PgTypeId::ARRAYTEXT
                | PgTypeId::ARRAYINT2
                | PgTypeId::ARRAYINT4
                | PgTypeId::ARRAYINT8
                | PgTypeId::ARRAYFLOAT4
                | PgTypeId::ARRAYFLOAT8
                | PgTypeId::ARRAYBOOL
                | PgTypeId::ARRAYBYTEA => "array_in".to_string(),
                PgTypeId::TIMESTAMP
                | PgTypeId::TIMESTAMPTZ
                | PgTypeId::DATE
                | PgTypeId::TIME
                | PgTypeId::TIMETZ => self.typname.to_owned() + "_in",
                PgTypeId::TSMULTIRANGE
                | PgTypeId::NUMMULTIRANGE
                | PgTypeId::DATEMULTIRANGE
                | PgTypeId::INT4MULTIRANGE
                | PgTypeId::INT8MULTIRANGE => "multirange_in".to_string(),
                PgTypeId::MONEY => "cash_in".to_string(),
                PgTypeId::PGCLASS | PgTypeId::PGNAMESPACE => "record_in".to_string(),
                _ => self.typname.to_owned() + "in",
            }
        } else {
            "record_in".to_string()
        }
    }

    pub const fn is_binary_supported(&self) -> bool {
        // Right now, We assume that all types have binary encoding support
        true
    }
}

macro_rules! define_pg_types {
    ($($NAME:ident ($OID:expr) { $($KEY:ident: $VALUE:expr,)* },)*) => {
        #[derive(Debug, Clone, Copy)]
        #[repr(u32)]
        pub enum PgTypeId {
            UNSPECIFIED = 0,
            $($NAME = $OID,)*
        }

        impl PgTypeId {
            pub const fn from_oid(oid: u32) -> Option<Self> {
                match oid {
                    0 => Some(Self::UNSPECIFIED),
                    $($OID => Some(Self::$NAME),)*
                    _ => None,
                }
            }
        }

        impl<'a> PgType<'a> {
            pub const fn get_by_tid(oid: PgTypeId) -> &'static PgType<'static> {
                match oid {
                    PgTypeId::UNSPECIFIED => UNSPECIFIED,
                    $(PgTypeId::$NAME => $NAME,)*
                }
            }

            pub const fn get_all() -> &'static [&'static PgType<'static>] {
                &[
                    $($NAME,)*
                ]
            }
        }

        $(
            const $NAME: &PgType = &PgType {
                oid: PgTypeId::$NAME as u32,
                $($KEY: $VALUE,)*
            };
        )*
    }
}

const UNSPECIFIED: &PgType = &PgType {
    oid: 0,
    typname: "unspecified",
    regtype: "",
    typnamespace: 11,
    typowner: 10,
    typlen: 1,
    typbyval: true,
    typtype: "b",
    typcategory: "B",
    typisprefered: true,
    typisdefined: true,
    typrelid: 0,
    typsubscript: "-",
    typelem: 0,
    typarray: 0,
    typalign: "-",
    typstorage: "-",
    typbasetype: 0,
    typreceive: "",
    typreceive_oid: 0,
};

define_pg_types![
    BOOL (16) {
        typname: "bool",
        regtype: "boolean",
        typnamespace: 11,
        typowner: 10,
        typlen: 1,
        typbyval: true,
        typtype: "b",
        typcategory: "B",
        typisprefered: true,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1000,
        typalign: "c",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "boolrecv",
        typreceive_oid: 2436,
    },

    BYTEA (17) {
        typname: "bytea",
        regtype: "bytea",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "U",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1001,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "bytearecv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    NAME (19) {
        typname: "name",
        regtype: "name",
        typnamespace: 11,
        typowner: 10,
        typlen: 64,
        typbyval: false,
        typtype: "b",
        typcategory: "S",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "raw_array_subscript_handler",
        typelem: 0,
        typarray: 1003,
        typalign: "c",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "namerecv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    INT8 (20) {
        typname: "int8",
        regtype: "bigint",
        typnamespace: 11,
        typowner: 10,
        typlen: 8,
        typbyval: true,
        typtype: "b",
        typcategory: "N",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1016,
        typalign: "d",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "int8recv",
        typreceive_oid: 2408,
    },

    INT2 (21) {
        typname: "int2",
        regtype: "smallint",
        typnamespace: 11,
        typowner: 10,
        typlen: 2,
        typbyval: true,
        typtype: "b",
        typcategory: "N",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1005,
        typalign: "s",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "int2recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    INT4 (23) {
        typname: "int4",
        regtype: "integer",
        typnamespace: 11,
        typowner: 10,
        typlen: 4,
        typbyval: true,
        typtype: "b",
        typcategory: "N",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1007,
        typalign: "i",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "int4recv",
        typreceive_oid: 2406,
    },

    TEXT (25) {
        typname: "text",
        regtype: "text",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "S",
        typisprefered: true,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1009,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "textrecv",
        typreceive_oid: 2414,
    },

    OID (26) {
        typname: "oid",
        regtype: "oid",
        typnamespace: 11,
        typowner: 10,
        typlen: 4,
        typbyval: true,
        typtype: "b",
        typcategory: "N",
        typisprefered: true,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1028,
        typalign: "i",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "oidrecv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    TID (27) {
        typname: "tid",
        regtype: "tid",
        typnamespace: 11,
        typowner: 10,
        typlen: 6,
        typbyval: false,
        typtype: "b",
        typcategory: "U",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1010,
        typalign: "s",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "tidrecv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    PGCLASS (83) {
        typname: "pg_class",
        regtype: "pg_class",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "c",
        typcategory: "C",
        typisprefered: false,
        typisdefined: true,
        typrelid: 1259,
        typsubscript: "-",
        typelem: 0,
        typarray: 273,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "record_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYPGCLASS (273) {
        typname: "_pg_class",
        regtype: "pg_class[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 83,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    FLOAT4 (700) {
        typname: "float4",
        regtype: "real",
        typnamespace: 11,
        typowner: 10,
        typlen: 4,
        typbyval: true,
        typtype: "b",
        typcategory: "N",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1021,
        typalign: "i",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "float4recv",
        typreceive_oid: 2424,
    },

    FLOAT8 (701) {
        typname: "float8",
        regtype: "double precision",
        typnamespace: 11,
        typowner: 10,
        typlen: 8,
        typbyval: true,
        typtype: "b",
        typcategory: "N",
        typisprefered: true,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1022,
        typalign: "d",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "float8recv",
        typreceive_oid: 2426,
    },

    MONEY (790) {
        typname: "money",
        regtype: "money",
        typnamespace: 11,
        typowner: 10,
        typlen: 8,
        typbyval: true,
        typtype: "b",
        typcategory: "N",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 791,
        typalign: "d",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "cash_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYMONEY (791) {
        typname: "_money",
        regtype: "money[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 790,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    INET (869) {
        typname: "inet",
        regtype: "inet",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "I",
        typisprefered: true,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1041,
        typalign: "i",
        typstorage: "m",
        typbasetype: 0,
        typreceive: "inet_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYBOOL (1000) {
        typname: "_bool",
        regtype: "boolean[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 16,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYBYTEA (1001) {
        typname: "_bytea",
        regtype: "bytea[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 17,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYNAME (1003) {
        typname: "_name",
        regtype: "name[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 19,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYINT2 (1005) {
        typname: "_int2",
        regtype: "smallint[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 21,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYINT4 (1007) {
        typname: "_int4",
        regtype: "integer[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 23,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYTEXT (1009) {
        typname: "_text",
        regtype: "text[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 25,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYTID (1010) {
        typname: "_tid",
        regtype: "tid[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 27,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYBPCHAR (1014) {
        typname: "_bpchar",
        regtype: "character[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 1042,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYVARCHAR (1015) {
        typname: "_varchar",
        regtype: "character varying[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 1043,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYINT8 (1016) {
        typname: "_int8",
        regtype: "bigint[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 20,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYFLOAT4 (1021) {
        typname: "_float4",
        regtype: "real[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 700,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYFLOAT8 (1022) {
        typname: "_float8",
        regtype: "double precision[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 701,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYOID (1028) {
        typname: "_oid",
        regtype: "oid[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 26,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ACLITEM (1033) {
        typname: "aclitem",
        regtype: "aclitem",
        typnamespace: 11,
        typowner: 10,
        typlen: 12,
        typbyval: false,
        typtype: "b",
        typcategory: "U",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1034,
        typalign: "i",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "-",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYACLITEM (1034) {
        typname: "_aclitem",
        regtype: "aclitem[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 1033,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYINET (1041) {
        typname: "_inet",
        regtype: "inet[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 869,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    BPCHAR (1042) {
        typname: "bpchar",
        regtype: "character",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "S",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1014,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "bpcharrecv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    VARCHAR (1043) {
        typname: "varchar",
        regtype: "character varying",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "S",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1015,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "varcharrecv",
        typreceive_oid: 2432,
    },

    DATE (1082) {
        typname: "date",
        regtype: "date",
        typnamespace: 11,
        typowner: 10,
        typlen: 4,
        typbyval: true,
        typtype: "b",
        typcategory: "D",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1182,
        typalign: "i",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "date_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    TIME (1083) {
        typname: "time",
        regtype: "time without time zone",
        typnamespace: 11,
        typowner: 10,
        typlen: 8,
        typbyval: true,
        typtype: "b",
        typcategory: "D",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1183,
        typalign: "d",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "time_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    TIMESTAMP (1114) {
        typname: "timestamp",
        regtype: "timestamp without time zone",
        typnamespace: 11,
        typowner: 10,
        typlen: 8,
        typbyval: true,
        typtype: "b",
        typcategory: "D",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1115,
        typalign: "d",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "timestamp_recv",
        typreceive_oid: 2474,
    },

    ARRAYTIMESTAMP (1115) {
        typname: "_timestamp",
        regtype: "timestamp without time zone[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 1114,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYDATE (1182) {
        typname: "_date",
        regtype: "date[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 1082,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYTIME (1183) {
        typname: "_time",
        regtype: "time without time zone[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 1083,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    TIMESTAMPTZ (1184) {
        typname: "timestamptz",
        regtype: "timestamp with time zone",
        typnamespace: 11,
        typowner: 10,
        typlen: 8,
        typbyval: true,
        typtype: "b",
        typcategory: "D",
        typisprefered: true,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1185,
        typalign: "d",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "timestamptz_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYTIMESTAMPTZ (1185) {
        typname: "_timestamptz",
        regtype: "timestamp with time zone[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 1184,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    INTERVAL (1186) {
        typname: "interval",
        regtype: "interval",
        typnamespace: 11,
        typowner: 10,
        typlen: 16,
        typbyval: false,
        typtype: "b",
        typcategory: "T",
        typisprefered: true,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1187,
        typalign: "d",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "interval_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYINTERVAL (1187) {
        typname: "_interval",
        regtype: "interval[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 1186,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYNUMERIC (1231) {
        typname: "_numeric",
        regtype: "numeric[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 1700,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    TIMETZ (1266) {
        typname: "timetz",
        regtype: "time with time zone",
        typnamespace: 11,
        typowner: 10,
        typlen: 12,
        typbyval: false,
        typtype: "b",
        typcategory: "D",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1270,
        typalign: "d",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "timetz_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYTIMETZ (1270) {
        typname: "_timetz",
        regtype: "time with time zone[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 1266,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    NUMERIC (1700) {
        typname: "numeric",
        regtype: "numeric",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "N",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 1231,
        typalign: "i",
        typstorage: "m",
        typbasetype: 0,
        typreceive: "numeric_recv",
        typreceive_oid: 2460,
    },

    RECORD (2249) {
        typname: "record",
        regtype: "record",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "p",
        typcategory: "P",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 2287,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "record_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ANYARRAY (2277) {
        typname: "anyarray",
        regtype: "anyarray",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "p",
        typcategory: "P",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "anyarray_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ANYELEMENT (2283) {
        typname: "anyelement",
        regtype: "anyelement",
        typnamespace: 11,
        typowner: 10,
        typlen: 4,
        typbyval: true,
        typtype: "p",
        typcategory: "P",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 0,
        typalign: "i",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "-",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYRECORD (2287) {
        typname: "_record",
        regtype: "record[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "p",
        typcategory: "P",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 2249,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    PGLSN (3220) {
        typname: "pg_lsn",
        regtype: "pg_lsn",
        typnamespace: 11,
        typowner: 10,
        typlen: 8,
        typbyval: true,
        typtype: "b",
        typcategory: "U",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 3221,
        typalign: "d",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "pg_lsn_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYPGLSN (3221) {
        typname: "_pg_lsn",
        regtype: "pg_lsn[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 3220,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ANYENUM (3500) {
        typname: "anyenum",
        regtype: "anyenum",
        typnamespace: 11,
        typowner: 10,
        typlen: 4,
        typbyval: true,
        typtype: "p",
        typcategory: "P",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 0,
        typalign: "i",
        typstorage: "p",
        typbasetype: 0,
        typreceive: "-",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ANYRANGE (3831) {
        typname: "anyrange",
        regtype: "anyrange",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "p",
        typcategory: "P",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "-",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    INT4RANGE (3904) {
        typname: "int4range",
        regtype: "int4range",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "r",
        typcategory: "R",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 3905,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "range_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYINT4RANGE (3905) {
        typname: "_int4range",
        regtype: "int4range[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 3904,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    NUMRANGE (3906) {
        typname: "numrange",
        regtype: "numrange",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "r",
        typcategory: "R",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 3907,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "range_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYNUMRANGE (3907) {
        typname: "_numrange",
        regtype: "numrange[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 3906,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    TSRANGE (3908) {
        typname: "tsrange",
        regtype: "tsrange",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "r",
        typcategory: "R",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 3909,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "range_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYTSRANGE (3909) {
        typname: "_tsrange",
        regtype: "tsrange[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 3908,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    TSTZRANGE (3910) {
        typname: "tstzrange",
        regtype: "tstzrange",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "r",
        typcategory: "R",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 3911,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "range_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYTSTZRANGE (3911) {
        typname: "_tstzrange",
        regtype: "tstzrange[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 3910,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    DATERANGE (3912) {
        typname: "daterange",
        regtype: "daterange",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "r",
        typcategory: "R",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 3913,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "range_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYDATERANGE (3913) {
        typname: "_daterange",
        regtype: "daterange[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 3912,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    INT8RANGE (3926) {
        typname: "int8range",
        regtype: "int8range",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "r",
        typcategory: "R",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 3927,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "range_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYINT8RANGE (3927) {
        typname: "_int8range",
        regtype: "int8range[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 3926,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    INT4MULTIRANGE (4451) {
        typname: "int4multirange",
        regtype: "int4multirange",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "r",
        typcategory: "R",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 6150,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "multirange_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    NUMMULTIRANGE (4532) {
        typname: "nummultirange",
        regtype: "nummultirange",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "m",
        typcategory: "R",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 6151,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "multirange_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    TSMULTIRANGE (4533) {
        typname: "tsmultirange",
        regtype: "tsmultirange",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "m",
        typcategory: "R",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 6152,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "multirange_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    DATEMULTIRANGE (4535) {
        typname: "datemultirange",
        regtype: "datemultirange",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "m",
        typcategory: "R",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 6155,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "multirange_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    INT8MULTIRANGE (4536) {
        typname: "int8multirange",
        regtype: "int8multirange",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "m",
        typcategory: "R",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 6157,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "multirange_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYINT4MULTIRANGE (6150) {
        typname: "_int4multirange",
        regtype: "int4multirange[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 4451,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYNUMMULTIRANGE (6151) {
        typname: "_nummultirange",
        regtype: "nummultirange[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 4532,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYTSMULTIRANGE (6152) {
        typname: "_tsmultirange",
        regtype: "tsmultirange[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 4533,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYDATEMULTIRANGE (6155) {
        typname: "_datemultirange",
        regtype: "datemultirange[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 4535,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYINT8MULTIRANGE (6157) {
        typname: "_int8multirange",
        regtype: "int8multirange[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 4536,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYPGAM (10014) {
        typname: "_pg_am",
        regtype: "pg_am[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 10015,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    PGAM (10015) {
        typname: "pg_am",
        regtype: "pg_am",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "c",
        typcategory: "C",
        typisprefered: false,
        typisdefined: true,
        typrelid: 2601,
        typsubscript: "-",
        typelem: 0,
        typarray: 10014,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "record_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYPGLANGUAGE (10020) {
        typname: "_pg_language",
        regtype: "pg_language[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 10021,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    PGLANGUAGE (10021) {
        typname: "pg_language",
        regtype: "pg_language",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "c",
        typcategory: "C",
        typisprefered: false,
        typisdefined: true,
        typrelid: 2612,
        typsubscript: "-",
        typelem: 0,
        typarray: 10020,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "record_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYPGEVENTTRIGGER (10038) {
        typname: "_pg_event_trigger",
        regtype: "pg_event_trigger[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 10039,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    PGEVENTTRIGGER (10039) {
        typname: "pg_event_trigger",
        regtype: "pg_event_trigger",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "c",
        typcategory: "C",
        typisprefered: false,
        typisdefined: true,
        typrelid: 3466,
        typsubscript: "-",
        typelem: 0,
        typarray: 10038,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "record_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYPGCAST (10042) {
        typname: "_pg_cast",
        regtype: "pg_cast[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 10043,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    PGCAST (10043) {
        typname: "pg_cast",
        regtype: "pg_cast",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "c",
        typcategory: "C",
        typisprefered: false,
        typisdefined: true,
        typrelid: 2605,
        typsubscript: "-",
        typelem: 0,
        typarray: 10042,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "record_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYPGEXTENSION (10073) {
        typname: "_pg_extension",
        regtype: "pg_extension[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 10074,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    PGEXTENSION (10074) {
        typname: "pg_extension",
        regtype: "pg_extension",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "c",
        typcategory: "C",
        typisprefered: false,
        typisdefined: true,
        typrelid: 3079,
        typsubscript: "-",
        typelem: 0,
        typarray: 10073,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "record_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYPGFOREIGNDATAWRAPPER (10075) {
        typname: "_pg_foreign_data_wrapper",
        regtype: "pg_foreign_data_wrapper[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 10076,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    PGFOREIGNDATAWRAPPER (10076) {
        typname: "pg_foreign_data_wrapper",
        regtype: "pg_foreign_data_wrapper",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "c",
        typcategory: "C",
        typisprefered: false,
        typisdefined: true,
        typrelid: 2328,
        typsubscript: "-",
        typelem: 0,
        typarray: 10075,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "record_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYPGFOREIGNSERVER (10077) {
        typname: "_pg_foreign_server",
        regtype: "pg_foreign_server[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 10078,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    PGFOREIGNSERVER (10078) {
        typname: "pg_foreign_server",
        regtype: "pg_foreign_server",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "c",
        typcategory: "C",
        typisprefered: false,
        typisdefined: true,
        typrelid: 1417,
        typsubscript: "-",
        typelem: 0,
        typarray: 10077,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "record_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYPGCONSTRAINT (12002) {
        typname: "_pg_constraint",
        regtype: "pg_constraint[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 12003,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    PGCONSTRAINT (12003) {
        typname: "pg_constraint",
        regtype: "pg_constraint",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "c",
        typcategory: "C",
        typisprefered: false,
        typisdefined: true,
        typrelid: 2606,
        typsubscript: "-",
        typelem: 0,
        typarray: 12002,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "record_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    ARRAYPGNAMESPACE (12046) {
        typname: "_pg_namespace",
        regtype: "pg_namespace[]",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "b",
        typcategory: "A",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "array_subscript_handler",
        typelem: 12047,
        typarray: 0,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "array_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    PGNAMESPACE (12047) {
        typname: "pg_namespace",
        regtype: "pg_namespace",
        typnamespace: 11,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "c",
        typcategory: "C",
        typisprefered: false,
        typisdefined: true,
        typrelid: 2615,
        typsubscript: "-",
        typelem: 0,
        typarray: 12046,
        typalign: "d",
        typstorage: "x",
        typbasetype: 0,
        typreceive: "record_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    CHARACTERDATA (13408) {
        typname: "character_data",
        regtype: "information_schema.character_data",
        typnamespace: 13000,
        typowner: 10,
        typlen: -1,
        typbyval: false,
        typtype: "d",
        typcategory: "S",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 0,
        typalign: "i",
        typstorage: "x",
        typbasetype: 1043,
        typreceive: "domain_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },

    SQLIDENTIFIER (13410) {
        typname: "sql_identifier",
        regtype: "information_schema.sql_identifier",
        typnamespace: 13000,
        typowner: 10,
        typlen: 64,
        typbyval: false,
        typtype: "d",
        typcategory: "S",
        typisprefered: false,
        typisdefined: true,
        typrelid: 0,
        typsubscript: "-",
        typelem: 0,
        typarray: 0,
        typalign: "c",
        typstorage: "p",
        typbasetype: 19,
        typreceive: "domain_recv",
        // TODO: Get from pg_proc
        typreceive_oid: 0,
    },
];

impl PgTypeId {
    pub const fn to_type(self) -> &'static PgType<'static> {
        PgType::get_by_tid(self)
    }
}
