Skip to main content

CatalogQuery

Enum CatalogQuery 

Source
pub enum CatalogQuery {
Show 38 variants PgVersion, Schemas, Tables, Columns, Constraints, Indexes, Sequences, Comments, Dependencies, ViewsAndMvs, ViewColumns, UserTypes, EnumValues, DomainDetails, DomainChecks, CompositeAttributes, Functions, Aggregates, Extensions, Triggers, PartitionedTables, Partitions, ClusterRoles, ClusterMembers, ClusterTablespaces, DefaultPrivileges, Policies, Publications, PublicationRel, PublicationNamespace, PublicationAttributes, EventTriggers, Subscriptions, Statistics, StatisticAttributes, StatisticExpressions, Collations, Casts,
}
Expand description

Identifier for each catalog query the reader runs. Adapters dispatch on this enum to pick the per-version SQL string.

Variants§

§

PgVersion

SHOW server_version_num.

§

Schemas

pg_namespace rows for managed schemas.

§

Tables

pg_class (relkind=‘r’) for managed tables.

§

Columns

pg_attribute joined with pg_attrdef/pg_type for managed tables.

§

Constraints

pg_constraint for managed tables (PK/UNIQUE/FK/CHECK).

§

Indexes

pg_index for managed tables (excluding constraint-backing indexes).

§

Sequences

pg_class (relkind=‘S’) joined with pg_sequence.

§

Comments

pg_description (currently inlined into the per-object queries).

§

Dependencies

pg_depend rows linking sequences to their owning columns.

§

ViewsAndMvs

pg_class (relkind IN (‘v’,‘m’)) joined with pg_get_viewdef.

§

ViewColumns

pg_attribute for view and materialized view columns.

§

UserTypes

pg_type filtered to typtype IN ('e','d','c') for user-defined types.

§

EnumValues

pg_enum labels for enum types.

§

DomainDetails

Base-type and nullability details for domain types.

§

DomainChecks

Named CHECK constraints attached to domain types.

§

CompositeAttributes

Attributes (fields) of composite types.

§

Functions

pg_proc rows for functions and procedures (prokind IN ‘f’,‘p’).

§

Aggregates

pg_aggregate rows joined to their wrapper pg_proc entry.

Schema-filtered via $1::text[] (same param group as Self::Functions). The assembler skips ordered-set / hypothetical-set aggregates and any aggregate whose state/final function is in an unmanaged language, recording those in DriftReport::unmanaged_aggregates.

§

Extensions

pg_extension rows for installed extensions.

§

Triggers

pg_trigger rows for user triggers (excluding internal + extension-owned).

§

PartitionedTables

pg_class (relkind=‘p’) rows for partitioned-table parents.

§

Partitions

pg_class (relispartition=true) rows for child partitions.

§

ClusterRoles

pg_authid rows for cluster roles (with pg_shdescription for comments).

Uses $1::text[] as the bootstrap-role filter (names to exclude), not a managed-schema list. takes_text_array_param returns true so the adapter passes the parameter; the cluster reader supplies bootstrap role names.

§

ClusterMembers

pg_auth_members edges joined to pg_authid for role names.

Same $1::text[] bootstrap-role filter as Self::ClusterRoles.

§

ClusterTablespaces

pg_tablespace rows (with pg_shdescription for comments) for managed cluster tablespaces.

Built-in pg_default / pg_global are always excluded. Uses $1::text[] as the bootstrap filter (names to exclude), in the same param-group as Self::ClusterRoles; takes_text_array_param returns true.

§

DefaultPrivileges

pg_default_acl rows joined to pg_authid and pg_namespace.

Returns one row per (target_role, schema, object_type) tuple. Rows for predefined pg_* roles are filtered out. Takes no $1::text[] parameter; takes_text_array_param returns false for this variant.

§

Policies

pg_policies rows for managed schemas.

Returns one row per policy, scoped to schemaname = ANY($1::text[]). Decoded into crate::ir::policy::Policy and attached to their owning Table by the assembler. Policies on unmanaged tables are silently dropped.

§

Publications

pg_publication rows for all publications in the database.

Publications are database-global (not schema-scoped); takes no $1::text[] parameter (takes_text_array_param returns false).

§

PublicationRel

pg_publication_rel rows — one per (publication, table) membership.

PG 15+ includes prqual (row filter) and prattrs (column list); PG 14 variant substitutes NULL for both. Takes no parameter.

§

PublicationNamespace

pg_publication_namespace rows — one per (publication, schema) membership (PG 15+ only). PG 14 variant returns zero rows. Takes no parameter.

§

PublicationAttributes

pg_attribute rows for every column of every table referenced by any publication. Used to resolve column attnums to names. Takes no parameter.

§

EventTriggers

pg_event_trigger rows for all event triggers in the database.

Event triggers are database-global (not schema-scoped); takes no $1::text[] parameter (takes_text_array_param returns false). Extension-owned event triggers (pg_depend.deptype = 'e') are excluded at the SQL layer.

§

Subscriptions

pg_subscription rows for all subscriptions in the database.

Subscriptions are database-global (not schema-scoped). Takes no $1::text[] parameter (takes_text_array_param returns false).

pg_subscription is superuser-readable only. Non-super connections will receive an empty result or a permission error; the assembler catches the error and sets DriftReport::unreadable_subscriptions.

§

Statistics

pg_statistic_ext rows for managed schemas. Takes $1::text[] (managed schema names).

§

StatisticAttributes

Column-attnum resolver for statistics target tables. Bulk-fetched once; grouped by target_oid in the assembler. Takes $1::text[].

§

StatisticExpressions

Bulk expression decode via pg_get_statisticsobjdef_expressions for all statistics in managed schemas. Returns one row per expression entry with columns (stat_oid, expr_index, expr_sql). Takes $1::text[] (managed schema names).

§

Collations

pg_collation rows for managed schemas — user-defined collations only (built-in and extension-owned collations are filtered out at the SQL layer). Takes $1::text[] (managed schema names).

§

Casts

pg_cast rows for all user-defined casts in the database.

Casts are database-global (not schema-scoped); takes no $1::text[] parameter (takes_text_array_param returns false). System / built-in casts (oid < 16384) and extension-owned casts (pg_depend.deptype = 'e') are excluded at the SQL layer. The assembler skips casts whose conversion function is in an unmanaged language (anything other than sql / plpgsql), recording those in DriftReport::unmanaged_casts.

Implementations§

Source§

impl CatalogQuery

Source

pub const fn takes_text_array_param(self) -> bool

Whether this query accepts a $1::text[] argument.

The semantic meaning of the array varies by variant: managed-schema names for per-DB queries, bootstrap-role names for cluster queries. The adapter is responsible for passing the right slice to the right variant.

A few variants (PgVersion, Extensions) take no parameters at all; this method returns false for those.

Trait Implementations§

Source§

impl Clone for CatalogQuery

Source§

fn clone(&self) -> CatalogQuery

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for CatalogQuery

Source§

impl Debug for CatalogQuery

Source§

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

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

impl Eq for CatalogQuery

Source§

impl Hash for CatalogQuery

Source§

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

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 CatalogQuery

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 StructuralPartialEq for CatalogQuery

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.