pub struct CreateSchema<X: Extension = NoExt> {
pub if_not_exists: bool,
pub name: Option<ObjectName>,
pub authorization: Option<Ident>,
pub elements: ThinVec<Statement<X>>,
pub meta: Meta,
}Expand description
CREATE SCHEMA [IF NOT EXISTS] [<name>] [AUTHORIZATION <role>] [<schema element> ...].
At least one of name / authorization is present — PostgreSQL’s CREATE SCHEMA AUTHORIZATION joe omits the schema name and derives it from the owning role.
The SQL-standard form embeds a list of component objects created inside the new
schema (CREATE SCHEMA s CREATE TABLE t (...)); elements holds
them as children so the whole construct stays ONE statement, mirroring PostgreSQL’s
CreateSchemaStmt.schemaElts (which likewise carries the components as raw
statement parsenodes). Rendering them embedded preserves the statement COUNT that
downstream consumers observe — the earlier model split them into separate
;-joined statements, a statement-level rewrite no source-fidelity render can undo.
The element list is a closed admissible set enforced by the parser (measured
against PostgreSQL: CREATE TABLE/VIEW/INDEX/SEQUENCE/TRIGGER and GRANT
— and PostgreSQL rejects CREATE MATERIALIZED VIEW/FUNCTION, a nested CREATE SCHEMA, DROP/ALTER/INSERT/… as elements). Modelled as a general
Statement list rather than a bespoke element enum — the same idiom as
CreateTrigger’s body — because the members ARE statements and reusing the
statement shape keeps the differential/structural oracles element-agnostic; the
closed set is the recorded acceptance bound, enforced at parse time. Non-empty only
under PostgreSQL (schema_elements gate); every other dialect parses a bare schema
head. Generic over X because the elements carry the extension node.
Fields§
§if_not_exists: boolWhether the if not exists form was present in the source.
name: Option<ObjectName>Name referenced by this syntax.
Optional authorization for this syntax.
elements: ThinVec<Statement<X>>The embedded schema-element statements, in source order. Empty for a bare
CREATE SCHEMA head (the common case) and for every non-PostgreSQL dialect.
meta: MetaSource location and node identity.
Trait Implementations§
Source§impl<X: Clone + Extension> Clone for CreateSchema<X>
impl<X: Clone + Extension> Clone for CreateSchema<X>
Source§fn clone(&self) -> CreateSchema<X>
fn clone(&self) -> CreateSchema<X>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de, X> Deserialize<'de> for CreateSchema<X>where
X: Deserialize<'de> + Extension,
impl<'de, X> Deserialize<'de> for CreateSchema<X>where
X: Deserialize<'de> + Extension,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<X: Eq + Extension> Eq for CreateSchema<X>
Source§impl<X: Extension + Render> Render for CreateSchema<X>
impl<X: Extension + Render> Render for CreateSchema<X>
Source§fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
Source§fn operand_binding_power(&self) -> Option<BindingPower>
fn operand_binding_power(&self) -> Option<BindingPower>
None (the default) for a self-delimiting node — an atom, call, or
constructor — that never needs parentheses. Read moreSource§impl<X> Serialize for CreateSchema<X>
impl<X> Serialize for CreateSchema<X>
Source§impl<X: Extension> Spanned for CreateSchema<X>
impl<X: Extension> Spanned for CreateSchema<X>
impl<X: PartialEq + Extension> StructuralPartialEq for CreateSchema<X>
Auto Trait Implementations§
impl<X> Freeze for CreateSchema<X>
impl<X> RefUnwindSafe for CreateSchema<X>where
X: RefUnwindSafe,
impl<X> Send for CreateSchema<X>where
X: Send,
impl<X> Sync for CreateSchema<X>where
X: Sync,
impl<X> Unpin for CreateSchema<X>where
X: Unpin,
impl<X> UnsafeUnpin for CreateSchema<X>
impl<X> UnwindSafe for CreateSchema<X>where
X: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DynAstExt for T
impl<T> DynAstExt for T
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&dyn Any for downcasting a node back to its concrete type.Source§fn dyn_clone(&self) -> Box<dyn DynAstExt>
fn dyn_clone(&self) -> Box<dyn DynAstExt>
Clone (whose
Self-returning signature cannot go through a vtable).Source§fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
PartialEq (whose &Self argument cannot go through a vtable). Equal
iff other holds the same concrete type and that type deems the values
equal; differently-typed nodes are never equal.