Skip to main content

Module ast

Module ast 

Source
Expand description

Internal SQL AST. Lifts the relevant subset of the libpg_query protobuf tree into a Rust enum the compiler walks. Statements not yet supported parse cleanly but compile to crate::SQLError::Unsupported.

Structs§

AlterForeignTableStmt
AlterRoleStmt
AlterRoutineOwnerStmt
AlterRoutineStmt
ALTER FUNCTION | PROCEDURE | ROUTINE name[(input_types)] ... with an optional exact declared input identity.
AlterSequence
AlterTableStmt
AlterViewStmt
AutoIncrement
Durable sequence provenance for a SERIAL or identity column.
AutoIncrementOwner
Durable owner of an implicit sequence. Inherited SERIAL defaults and declarative partitions copy this owner unchanged, so truncating a child cannot reset a sequence owned by its parent.
CTE
ColumnDef
CreateForeignServer
CreateForeignTable
CreateFunction
CREATE [OR REPLACE] FUNCTION | PROCEDURE.
CreateIndex
CreateRoleStmt
CreateRule
CreateSequence
CreateTable
CreateTrigger
CteCycleClause
PostgreSQL recursive-CTE cycle detection metadata.
CteSearchClause
PostgreSQL recursive-CTE traversal-order metadata.
DeclareCursorStmt
DeferredCreateForeignTable
A syntactically valid CREATE FOREIGN TABLE IF NOT EXISTS whose definition must be analyzed only when its target name is free.
DeferredCreateTable
A syntactically valid CREATE TABLE IF NOT EXISTS whose definition must be analyzed only after execution has established that the target relation does not already exist.
DeleteStmt
DetachedPartitionConstraint
DropFunctionItem
One DROP FUNCTION / DROP PROCEDURE target.
DropFunctionStmt
DROP FUNCTION [IF EXISTS] name[(argtypes)] [, ...] and the DROP PROCEDURE equivalent.
DropRoleStmt
DropRule
DropStmt
DropTrigger
FetchCursorStmt
ForeignKey
Table-level foreign key. Compilation preserves an omitted referenced column list as empty; validation fills it from the primary key before publication.
ForeignKeyRef
REFERENCES table[(column)] reference target.
FunctionBinding
FunctionParam
One declared parameter of a user-defined function or procedure.
GeneratedColumn
GrantDatabaseStmt
GRANT or REVOKE of CONNECT, CREATE, and TEMPORARY on databases.
GrantRoleStmt
GRANT role TO member or REVOKE role FROM member.
GrantRoutineItem
GrantRoutineStmt
GrantSchemaStmt
GRANT or REVOKE of USAGE and CREATE on schemas.
GrantSequenceStmt
GRANT or REVOKE of USAGE, SELECT, and UPDATE on sequences.
GrantTableStmt
GRANT or REVOKE of privileges on ordinary tables. An empty privilege list records ALL PRIVILEGES so explicit sequence targets can expand against their own privilege set.
IndexColumnOrder
InsertStmt
JoinUsing
LockingClause
One PostgreSQL row-locking clause, including optional OF targets and the NOWAIT / SKIP LOCKED wait policy.
MergeStmt
OnConflict
OperatorJoinRelations
The two independently bound catalog relations consumed by an operator-join table function.
OrderBy
PartitionIdentityOverride
PartitionSpec
Projection
RenameRoutineStmt
ALTER FUNCTION | PROCEDURE | ROUTINE name[(input_types)] RENAME TO new_name.
ReturningAliases
RoleMembershipOptions
PostgreSQL 18 options stored on one role-membership grant.
RoutineAclEntry
One explicit EXECUTE ACL entry. None on CreateFunction::execute_acl retains PostgreSQL’s default public execution privilege.
RoutineColumnTypeReference
Structured relation-column identity carried by a routine %TYPE declaration until catalog binding resolves it to a concrete SQL type.
RoutineInvocationBinding
Concrete parameter and result types selected for one routine invocation.
RoutineSecurityAttributes
Execution identity and planner leakproofness attached to a routine definition.
SelectStmt
SetConstraintName
SetOp
TableCheck
CHECK (expr) constraint with an optional name (CONSTRAINT <name> CHECK (...)).
TableConstraintSet
Durable table-level constraints that do not fit in ColumnDef.
TableFunction
One function inside a FromClause::FunctionGroup.
TableHierarchy
Metadata shared by ordinary inheritance and declarative partitioning.
TableKeyConstraint
A table key whose columns are compared as one tuple.
TablePrivilegeSpec
One table privilege and its optional column list. Unsupported names and column forms survive compilation so execution can preserve PostgreSQL object- and role-resolution precedence.
TransactionCharacteristics
TriggerTransitionRelation
TruncateTarget
UpdateStmt
VacuumOption
One parser-normalized VACUUM option. Keeping the parsed value in the SQL AST lets execution enforce PostgreSQL’s transaction-block error before validating command options.
VacuumStmt
VacuumTarget
One relation (and optional ANALYZE column list) named by VACUUM.
WindowFrame
WindowReference
WindowSpec

Enums§

AlterForeignTableAction
AlterRoutineKind
Routine namespace selected by ALTER FUNCTION, ALTER PROCEDURE, or ALTER ROUTINE.
AlterTableAction
AlterViewAction
AlterViewKind
AutoIncrementKind
PostgreSQL syntax that supplies an omitted column value from an implicit sequence. SERIAL is a sequence-backed default, while identity columns retain a separate generation attribute and do not have a column default.
BinaryOp
ColumnType
CteMaterialization
The planning fence requested for one common-table expression.
CursorDirection
DatabasePrivilege
One requested database privilege. Unsupported names survive compilation so execution can preserve PostgreSQL target- and role-resolution precedence.
DatabaseRevokeBehavior
Dependency behavior for database privilege revocation.
DiscardTarget
DISCARD target. Mirrors PostgreSQL’s DiscardMode.
DropKind
EventEnableMode
Expr
Scalar expression nodes the compiler handles.
ForeignKeyAction
ForeignKeyMatch
FrameBound
FrameMode
FromClause
FunctionBody
Body of a user-defined routine.
FunctionDispatch
Structural identity for parser-owned expressions and overload-specific built-in implementations. These variants occupy no SQL function-name namespace.
FunctionParallel
PARALLEL UNSAFE, PARALLEL RESTRICTED, or PARALLEL SAFE routine metadata.
FunctionParamMode
Parameter mode of a CREATE FUNCTION / CREATE PROCEDURE argument. Mirrors PostgreSQL’s FunctionParameterMode.
FunctionResolutionError
Static function-call failure discovered while binding declared argument types.
FunctionReturns
Declared result shape of a user-defined function.
FunctionVolatility
IMMUTABLE / STABLE / VOLATILE marker.
GeneratedColumnKind
GrantSequenceTarget
Relation targets carried by GRANT or REVOKE for sequences.
GrantTableTarget
Relation targets carried by GRANT or REVOKE with the TABLE object class.
IndexKey
JoinKind
LockStrength
PostgreSQL row-lock strength, strongest last.
LockWait
Wait policy for a row-locking clause.
MergeWhen
NullsOrder
OnCommitAction
ON COMMIT behavior retained with a temporary table definition.
OnConflictAction
PartitionBound
PartitionRangeDatum
PartitionStrategy
RangeFunctionOperation
Operation selected for one typed range or multirange call.
RangeSubtype
RelationPersistence
PostgreSQL’s pg_class.relpersistence contract.
RoleAttribute
RoleMembershipAction
RoutineConfigAction
RoutineRevokeBehavior
RoutineVariadicMode
Call syntax selected for a routine’s variadic parameter.
RuleEvent
SchemaPrivilege
One requested schema privilege. Unsupported names survive compilation so execution can preserve PostgreSQL target- and role-resolution precedence.
SchemaRevokeBehavior
Dependency behavior for schema privilege revocation.
SequenceBound
ALTER SEQUENCE bound action, distinguishing omission from NO MINVALUE or NO MAXVALUE.
SequenceDataType
SequenceLifecycle
Name or namespace lifecycle action carried by ALTER SEQUENCE.
SequenceOwnership
OWNED BY action carried by CREATE SEQUENCE and ALTER SEQUENCE.
SequencePrivilege
One requested sequence privilege. Unsupported names survive compilation so execution can preserve PostgreSQL target- and role-resolution precedence.
SequenceRestart
Physical restart action carried by ALTER SEQUENCE.
SequenceRevokeBehavior
Dependency behavior for sequence privilege revocation.
SetOpKind
Statement
TableKeyConstraintKind
TablePrivilege
One requested ordinary-table privilege.
TableRevokeBehavior
Dependency behavior for ordinary-table privilege revocation.
TransactionIsolationLevel
TransactionStmt
TriggerDeferrability
TriggerEvent
TriggerTiming
VacuumOptionValue
WindowReferenceKind

Functions§

is_builtin_aggregate_function
Return whether name is a built-in aggregate understood by the planner.

Type Aliases§

GeneratedFunctionDependency
ValueExpr
Expr restricted to value-producing forms used by INSERT rows.