Skip to main content

pgevolve_core/ir/
mod.rs

1//! In-memory representation of a Postgres schema.
2//!
3//! The IR is the contract between every other component. Both the source-side
4//! parser and the catalog reader produce these types; the differ, dependency
5//! analyzer, and planner consume them.
6
7pub mod canon;
8pub mod catalog;
9pub mod cluster;
10pub mod column;
11pub mod column_type;
12pub mod constraint;
13pub mod default_expr;
14pub mod default_privileges;
15pub mod difference;
16pub mod eq;
17pub mod extension;
18pub mod function;
19pub mod grant;
20pub mod index;
21pub mod partition;
22pub mod policy;
23pub mod publication;
24pub mod reloptions;
25pub mod schema;
26pub mod sequence;
27pub mod table;
28pub use function::*;
29pub mod procedure;
30pub use procedure::*;
31pub mod trigger;
32pub mod user_type;
33pub use user_type::*;
34pub mod view;
35pub use view::*;
36
37use thiserror::Error;
38
39/// Errors raised when constructing IR values.
40#[derive(Debug, Error)]
41pub enum IrError {
42    /// An identifier did not satisfy validation rules.
43    #[error("invalid identifier: {0}")]
44    InvalidIdentifier(String),
45
46    /// A type definition was not representable in our IR.
47    #[error("invalid column type: {0}")]
48    InvalidColumnType(String),
49
50    /// A required field was missing or empty.
51    #[error("missing required field: {0}")]
52    MissingField(&'static str),
53
54    /// A `PublicationScope::Selective` had no schemas and no tables.
55    #[error("publication {0:?}: empty Selective scope (no tables, no schemas)")]
56    EmptyPublication(crate::identifier::Identifier),
57    /// A `PublishedTable.columns` was `Some(vec![])`.
58    #[error("publication {0:?} table {1:?}: empty column list (use None to publish all columns)")]
59    EmptyColumnList(
60        crate::identifier::Identifier,
61        crate::identifier::QualifiedName,
62    ),
63    /// A `PublishKinds` had all four DML flags false.
64    #[error("publication {0:?}: empty publish bitset (must enable at least one DML kind)")]
65    EmptyPublishBitset(crate::identifier::Identifier),
66    /// A `PublishedTable.columns` contained a duplicate column name.
67    #[error("publication {0:?} table {1:?}: duplicate column {2:?} in column list")]
68    DuplicateColumnInPublication(
69        crate::identifier::Identifier,
70        crate::identifier::QualifiedName,
71        crate::identifier::Identifier,
72    ),
73}