Skip to main content

PgType

Struct PgType 

Source
pub struct PgType {
Show 36 fields pub oid: SmolStr, pub typname: SmolStr, pub typnamespace: SmolStr, pub typowner: SmolStr, pub typlen: i16, pub typbyval: bool, pub typtype: PgTypeTyptype, pub typispreferred: bool, pub typisdefined: bool, pub typdelim: i8, pub typrelid: Option<SmolStr>, pub typsubscript: Option<SmolStr>, pub typelem: Option<SmolStr>, pub typarray: Option<SmolStr>, pub typinput: SmolStr, pub typoutput: SmolStr, pub typreceive: Option<SmolStr>, pub typsend: Option<SmolStr>, pub typmodin: Option<SmolStr>, pub typmodout: Option<SmolStr>, pub typanalyze: Option<SmolStr>, pub typalign: PgTypeTypalign, pub typstorage: PgTypeTypstorage, pub typnotnull: bool, pub typbasetype: Option<SmolStr>, pub typtypmod: Option<u32>, pub typndims: u32, pub typcollation: Option<SmolStr>, pub typdefaultbin: Option<SmolStr>, pub typdefault: Option<SmolStr>, pub typacl: Option<Vec<AclItem<TypeAclPrivilege>>>, pub description: Option<SmolStr>, pub seclabel: Option<SmolStr>, pub seclabel_provider: Option<SmolStr>, pub initprivs: Option<Vec<AclItem<TypeAclPrivilege>>>, pub initprivs_type: Option<PgTypeInitprivsType>,
}
Expand description

The DDL-only contents of pg_type

Fields§

§oid: SmolStr

oid Row identifier

§typname: SmolStr

name Data type name

§typnamespace: SmolStr

oid (references pg_namespace.oid) The OID of the namespace that contains this type

§typowner: SmolStr

oid (references pg_authid.oid) Owner of the type

§typlen: i16

int2 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.

§typbyval: bool

bool typbyval determines whether internal routines pass a value of this type by value or by reference. typbyval had better be false if typlen is not 1, 2, or 4 (or 8 on machines where Datum is 8 bytes). Variable-length types are always passed by reference. Note that typbyval can be false even if the length would allow pass-by-value.

§typtype: PgTypeTyptype

char typtype is b for a base type, c for a composite type (e.g., a table’s row type), d for a domain, e for an enum type, p for a pseudo-type, r for a range type, or m for a multirange type. See also typrelid and typbasetype.

§typispreferred: bool

bool True if the type is a preferred cast target within its typcategory

§typisdefined: bool

bool True if the type is defined, false if this is a placeholder entry for a not-yet-defined type. When typisdefined is false, nothing except the type name, namespace, and OID can be relied on.

§typdelim: i8

char Character that separates two values of this type when parsing array input. Note that the delimiter is associated with the array element data type, not the array data type.

§typrelid: Option<SmolStr>

oid (references pg_class.oid) If this is a composite type (see typtype), then this column points to the pg_class entry that defines the corresponding table. (For a free-standing composite type, the pg_class entry doesn’t really represent a table, but it is needed anyway for the type’s pg_attribute entries to link to.) Zero for non-composite types.

§typsubscript: Option<SmolStr>

regproc (references pg_proc.oid) Subscripting handler function’s OID, or zero if this type doesn’t support subscripting. Types that are “true” array types have typsubscript = array_subscript_handler, but other types may have other handler functions to implement specialized subscripting behavior.

§typelem: Option<SmolStr>

oid (references pg_type.oid) If typelem is not zero then it identifies another row in pg_type, defining the type yielded by subscripting. This should be zero if typsubscript is zero. However, it can be zero when typsubscript isn’t zero, if the handler doesn’t need typelem to determine the subscripting result type. Note that a typelem dependency is considered to imply physical containment of the element type in this type; so DDL changes on the element type might be restricted by the presence of this type.

§typarray: Option<SmolStr>

oid (references pg_type.oid) If typarray is not zero then it identifies another row in pg_type, which is the “true” array type having this type as element

§typinput: SmolStr

regproc (references pg_proc.oid) Input conversion function (text format)

§typoutput: SmolStr

regproc (references pg_proc.oid) Output conversion function (text format)

§typreceive: Option<SmolStr>

regproc (references pg_proc.oid) Input conversion function (binary format), or zero if none

§typsend: Option<SmolStr>

regproc (references pg_proc.oid) Output conversion function (binary format), or zero if none

§typmodin: Option<SmolStr>

regproc (references pg_proc.oid) Type modifier input function, or zero if type does not support modifiers

§typmodout: Option<SmolStr>

regproc (references pg_proc.oid) Type modifier output function, or zero to use the standard format

§typanalyze: Option<SmolStr>

regproc (references pg_proc.oid) Custom ANALYZE function, or zero to use the standard function

§typalign: PgTypeTypalign

char typalign is the alignment required when storing a value of this type. It applies to storage on disk as well as most representations of the value inside PostgreSQL. When multiple values are stored consecutively, such as in the representation of a complete row on disk, padding is inserted before a datum of this type so that it begins on the specified boundary. The alignment reference is the beginning of the first datum in the sequence. Possible values are: c = char alignment, i.e., no alignment needed. s = short alignment (2 bytes on most machines). i = int alignment (4 bytes on most machines). d = double alignment (8 bytes on many machines, but by no means all).

§typstorage: PgTypeTypstorage

char typstorage tells for varlena types (those with typlen = -1) if the type is prepared for toasting and what the default strategy for attributes of this type should be. Possible values are: p (plain): Values must always be stored plain (non-varlena types always use this value). e (external): Values can be stored in a secondary “TOAST” relation (if relation has one, see pg_class.reltoastrelid). m (main): Values can be compressed and stored inline. x (extended): Values can be compressed and/or moved to a secondary relation. x is the usual choice for toast-able types. Note that m values can also be moved out to secondary storage, but only as a last resort (e and x values are moved first).

§typnotnull: bool

bool typnotnull represents a not-null constraint on a type. Used for domains only.

§typbasetype: Option<SmolStr>

oid (references pg_type.oid) If this is a domain (see typtype), then typbasetype identifies the type that this one is based on. Zero if this type is not a domain.

§typtypmod: Option<u32>

int4 Domains use typtypmod to record the typmod to be applied to their base type (-1 if base type does not use a typmod). -1 if this type is not a domain.

§typndims: u32

int4 typndims is the number of array dimensions for a domain over an array (that is, typbasetype is an array type). Zero for types other than domains over array types.

§typcollation: Option<SmolStr>

oid (references pg_collation.oid) typcollation specifies the collation of the type. If the type does not support collations, this will be zero. A base type that supports collations will have a nonzero value here, typically DEFAULT_COLLATION_OID. A domain over a collatable type can have a collation OID different from its base type’s, if one was specified for the domain.

§typdefaultbin: Option<SmolStr>

pg_node_tree If typdefaultbin is not null, it is the nodeToString() representation of a default expression for the type. This is only used for domains.

§typdefault: Option<SmolStr>

text typdefault is null if the type has no associated default value. If typdefaultbin is not null, typdefault must contain a human-readable version of the default expression represented by typdefaultbin. If typdefaultbin is null and typdefault is not, then typdefault is the external representation of the type’s default value, which can be fed to the type’s input converter to produce a constant.

§typacl: Option<Vec<AclItem<TypeAclPrivilege>>>

aclitem[] Access privileges; see Section 5.8 for details

§description: Option<SmolStr>

text The comment from pg_description

§seclabel: Option<SmolStr>

text The seclabel from pg_seclabel

§seclabel_provider: Option<SmolStr>

text The provider from pg_seclabel

§initprivs: Option<Vec<AclItem<TypeAclPrivilege>>>

aclitem[] The initial access privileges from pg_init_privs.

§initprivs_type: Option<PgTypeInitprivsType>

char A code defining the type of initial privilege of this object from pg_init_privs. ‘i’ if set by initdb, ‘e’ if set by CREATE EXTENSION.

Trait Implementations§

Source§

impl Clone for PgType

Source§

fn clone(&self) -> PgType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PgType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PgType

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<PgType, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Equivalent<PgType> for SmolStr

Source§

fn equivalent(&self, key: &PgType) -> bool

Compare self to key and return true if they are equal.
Source§

impl Equivalent<PgType> for str

Source§

fn equivalent(&self, key: &PgType) -> bool

Compare self to key and return true if they are equal.
Source§

impl Hash for PgType

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for PgType

Source§

fn eq(&self, other: &PgType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for PgType

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for PgType

Source§

impl StructuralPartialEq for PgType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,