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.
Modules§
- routine_
estimate - Serde for a COST or ROWS estimate, a
float4that overflows to infinity and that the JSON catalog cannot hold as a number: a finite estimate is a number, and an infinite one the textPostgreSQLprints for it.
Structs§
- Alter
Domain - Alter
Enum ALTER TYPE name ADD VALUE ...orALTER TYPE name RENAME VALUE ....- Alter
Foreign Table Stmt - Alter
Role Stmt - Alter
Routine Owner Stmt - Alter
Routine Stmt ALTER FUNCTION | PROCEDURE | ROUTINE name[(input_types)] ...with an optional exact declared input identity.- Alter
Sequence - Alter
Table Stmt - Alter
Type Object - One
ALTER TYPEorALTER DOMAINlifecycle change of a user-defined type and its generated array type. - Alter
View Stmt - Assignment
Target - Target syntax is separate from the value expression. Every bound belongs to the original input row, even when repeated targets compose writes to one column.
- Auto
Increment - Durable sequence provenance for a
SERIALor identity column. - Auto
Increment Owner - Durable owner of an implicit sequence. Inherited
SERIALdefaults and declarative partitions copy this owner unchanged, so truncating a child cannot reset a sequence owned by its parent. - CTE
- Column
Clause - One clause of a column definition.
- Column
Declaration - The clauses a column definition writes, in written order, which
transformColumnDefinitionchecks against each other. - Column
Def - Composite
Attribute Addition - One ADD ATTRIBUTE declaration. Unlike CREATE TYPE, ALTER applies column declaration lowering, including SERIAL.
- Composite
Attribute Definition - One declared attribute. The type is a declaration until execution binds it through the catalog.
- Composite
RowBinding - Creation-time positional binding of a stored ROW constructor. Type references use the same canonical-name lifecycle as stored casts; attribute numbers survive additions and dropped slots.
- Composite
Type Reference - A composite type bound by catalog identity: a standalone composite type or the row type of a relation. The schema and name are the catalog’s current names; equality compares the type identity only.
- Constraint
Catalog Identity - Create
Composite Type CREATE TYPE name AS (attribute type [COLLATE collation], ...)with attributes in declaration order.- Create
Domain - Create
Enum CREATE TYPE name AS ENUM (...)with labels in declaration order.- Create
Foreign Server - Create
Foreign Table - Create
Foreign Wrapper - Create
Function CREATE [OR REPLACE] FUNCTION | PROCEDURE.- Create
Index - Create
Role Stmt - Create
Rule - Create
Sequence - Create
Table - Create
Trigger - CteCycle
Clause PostgreSQLrecursive-CTE cycle detection metadata.- CteSearch
Clause PostgreSQLrecursive-CTE traversal-order metadata.- Declare
Cursor Stmt - Deferred
Create Foreign Table - A syntactically valid
CREATE FOREIGN TABLEwhose definition is analyzed after its creation namespace, skipping an existing target only when requested. - Deferred
Create Table - A syntactically valid
CREATE TABLE IF NOT EXISTSwhose definition must be analyzed only after execution has established that the target relation does not already exist. - DeferredSQL
Error - An error a statement found while compiling, which it raises later, where
PostgreSQLraises it. - Delete
Stmt - Detached
Partition Constraint - Domain
Check - Domain
NotNull - Drop
Column Action - Drop
Function Item - One
DROP FUNCTION/DROP PROCEDUREtarget. - Drop
Function Stmt DROP FUNCTION [IF EXISTS] name[(argtypes)] [, ...]and theDROP PROCEDUREequivalent.- Drop
Role Stmt - Drop
Rule - Drop
Stmt - Drop
Trigger - Enum
Neighbor - The existing label that a new label is placed before or after.
- Enum
Type Reference - A user-defined enum type bound by catalog identity. The schema and name are the catalog’s current names; equality compares the type identity only.
- Fetch
Cursor Stmt - Foreign
Key - Table-level foreign key. Compilation preserves an omitted referenced column list as empty; validation fills it from the primary key before publication.
- Foreign
KeyRef REFERENCES table[(column)]reference target.- Function
Binding - Function
Param - One declared parameter of a user-defined function or procedure.
- Generated
Column - Grant
Database Stmt GRANTorREVOKEofCONNECT,CREATE, andTEMPORARYon databases.- Grant
Role Stmt GRANT role TO memberorREVOKE role FROM member.- Grant
Routine Item - Grant
Routine Stmt - Grant
Schema Stmt GRANTorREVOKEofUSAGEandCREATEon schemas.- Grant
Sequence Stmt GRANTorREVOKEofUSAGE,SELECT, andUPDATEon sequences.- Grant
Table Stmt GRANTorREVOKEof privileges on ordinary tables. An empty privilege list recordsALL PRIVILEGESso explicit sequence targets can expand against their own privilege set.- Grant
Type Stmt GRANT | REVOKE [GRANT OPTION FOR] privileges ON TYPE | DOMAIN names TO | FROM grantees [WITH GRANT OPTION] [GRANTED BY role] [CASCADE | RESTRICT]. An empty privilege list isALL [PRIVILEGES].- Identity
Sequence Declaration - The sequence options an identity column declaration writes,
GENERATED ... AS IDENTITY (options). They create the column’s sequence, which keeps them; the column does not. - Identity
Sequence Name - The name
SEQUENCE NAMEgives an identity sequence: its schema, when written, and its name. - Index
Column Order - Insert
Stmt - Join
Using - Lock
Table Stmt - Lock
Table Target - Locking
Clause - One
PostgreSQLrow-locking clause, including optionalOFtargets and theNOWAIT/SKIP LOCKEDwait policy. - Merge
Stmt - Merge
Target Column Binding - NotNull
Declaration - A NOT NULL constraint a CREATE TABLE statement declares or implies, which
AddRelationNotNullConstraintsresolves against the relation’s columns once they exist. - Object
AclEntry - One explicit ACL entry. An absent ACL keeps the object’s
PostgreSQLdefault: the privilege for PUBLIC and the owner. - OnConflict
- Operator
Join Relations - The two independently bound catalog relations consumed by an operator-join table function.
- Operator
Resolution Error - OrderBy
- Partition
Identity Override - Partition
Spec - Projection
- Referenced
Partition Constraint - The constraint
PostgreSQLderives from a foreign key on one partition of the partitioned table it references, whosepg_constraint.conparentidnames the constraint it derives from. It names the partition’s share of the referenced rows inpg_constraint, in errors about those rows and inDETACH PARTITION, and keeps the name chosen when the partition joined the referenced table, whatever later happens to the name of the foreign key. - Rename
Index Stmt - Rename
Role Stmt - Rename
Routine Stmt ALTER FUNCTION | PROCEDURE | ROUTINE name[(input_types)] RENAME TO new_name.- Returning
Aliases - Role
Membership Options PostgreSQL18 options stored on one role-membership grant.- Routine
Attribute Clauses - The clauses of a routine statement that
compute_function_attributesandcompute_common_attributeexamine, and what they found that a later stage rejects. A statement carries them until registration checks them; stored definitions carry none. - Routine
Column Type Reference - Structured relation-column identity carried by a routine
%TYPEdeclaration until catalog binding resolves it to a concrete SQL type. - Routine
Invocation Binding - Concrete parameter and result types selected for one routine invocation.
- Routine
Security Attributes - Execution identity and planner leakproofness attached to a routine definition.
- Routine
Transform Type - A type that a
TRANSFORM FOR TYPEclause names. - SQLBody
Parameter - An input parameter as a SQL-standard body refers to it: the name the body uses, which follows
PostgreSQL’s positional naming, and where the parameter’s value arrives in a call. - Select
Stmt - Sequence
Declaration - The options a
CREATE SEQUENCE, or the declaration of an identity column, writes, kept as written.PostgreSQLreads their values and derives the omitted ones when it creates the sequence, in an order of its own. - SetConstraint
Name - SetOp
- Table
Check CHECK (expr)constraint with an optional name (CONSTRAINT <name> CHECK (...)).- Table
Constraint Set - Durable table-level constraints that do not fit in
ColumnDef. - Table
Function - One function inside a
FromClause::FunctionGroup. - Table
Hierarchy - Metadata shared by ordinary inheritance and declarative partitioning.
- Table
KeyConstraint - A table key whose columns are compared as one tuple.
- Table
Privilege Spec - One table privilege and its optional column list. Unsupported names and column forms survive compilation so execution can preserve
PostgreSQLobject- and role-resolution precedence. - Transaction
Characteristics - Trigger
Transition Relation - Truncate
Target - Type
Display Scope - The search path diagnostics use while a statement runs on this thread. Dropping the scope restores the enclosing statement’s path, so nested SQL keeps its own.
- Update
Stmt - User
Type Identity - A parsed identity: the type’s kind and OID, and the number of array dimensions around it.
- Vacuum
Option - One parser-normalized
VACUUMoption. Execution validates options before rejecting transaction blocks, then resolves relation targets, matchingPostgreSQL’s diagnostic order. - Vacuum
Stmt - Vacuum
Target - One relation (and optional ANALYZE column list) named by
VACUUM. - Window
Call Modifiers - The aggregate modifiers written on a window call, which
ParseFuncOrColumnrejects after it has resolved the function. The arguments of a call written withWITHIN GROUPinclude its ordering expressions. - Window
Definition - One query-local window definition. The specification owns only its written clauses; inheritance is resolved through an earlier named definition.
- Window
Definition Syntax - Compiler-only equality key for a raw window declaration; not part of stored SQL.
- Window
Frame - Window
Reference - Window
Spec
Enums§
- AclRole
Specification - Alter
Domain Action - Alter
Enum Action - Alter
Foreign Table Action - Alter
Routine Kind - Routine namespace selected by
ALTER FUNCTION,ALTER PROCEDURE, orALTER ROUTINE. - Alter
Table Action - Alter
Type Object Action - Alter
View Action - Alter
View Kind - Assignment
Step - Assignment
Targets - The targets of one SET item. A multiple target consumes one positional subquery result. Single targets retain the predecessor’s string or indirection-object encoding.
- Auto
Increment Kind PostgreSQLsyntax that supplies an omitted column value from an implicit sequence.SERIALis a sequence-backed default, while identity columns retain a separate generation attribute and do not have a column default.- Binary
Op - Column
Clause Kind - The kind of a column definition’s clause.
- Column
Type - CteBody
- A CTE owns a query or a data-modifying statement. The serialized
queryarm retains the original SELECT-only catalog representation. - CteMaterialization
- The planning fence requested for one common-table expression.
- Cursor
Direction - Database
Privilege - One requested database privilege. Unsupported names survive compilation so execution can preserve
PostgreSQLtarget- and role-resolution precedence. - Database
Revoke Behavior - Dependency behavior for database privilege revocation.
- Declared
Check - Where a CHECK that a CREATE TABLE statement declares is held.
- Declared
Element - An element of a CREATE TABLE statement that
transformCreateStmtexamines in written order. - Declared
Foreign Key - A foreign key written as a column clause or a table constraint.
- Discard
Target DISCARDtarget. MirrorsPostgreSQL’sDiscardMode.- Drop
Kind - Enum
Function Operation - Operation selected for one call of an
anyenumsupport function. The bound call carries the concrete enum type, becauseenum_first,enum_lastandenum_rangeread only their argument’s type. - Event
Enable Mode - Expr
- Scalar expression nodes the compiler handles.
- Foreign
KeyAction - Foreign
KeyMatch - Foreign
Wrapper Function Option - Frame
Bound - Frame
Exclusion - The frame exclusion clause: the rows of the frame that a window function or aggregate does not see.
- Frame
Mode - From
Clause - Function
Body - Body of a user-defined routine.
- Function
Call Syntax - The written function-call form, retained independently of overload binding. The durable
order_syntaxfield keeps its original name for stored-expression compatibility. - Function
Dispatch - Structural identity for parser-owned expressions and overload-specific built-in implementations. These variants occupy no SQL function-name namespace.
- Function
Parallel PARALLEL UNSAFE,PARALLEL RESTRICTED, orPARALLEL SAFEroutine metadata.- Function
Param Mode - Parameter mode of a
CREATE FUNCTION/CREATE PROCEDUREargument. MirrorsPostgreSQL’sFunctionParameterMode. - Function
Resolution Error - Static function-call failure discovered while binding declared argument types.
- Function
Returns - Declared result shape of a user-defined function.
- Function
Volatility IMMUTABLE/STABLE/VOLATILEmarker.- Generated
Column Kind - Grant
Sequence Target - Relation targets carried by
GRANTorREVOKEfor sequences. - Grant
Table Target - Relation targets carried by
GRANTorREVOKEwith theTABLEobject class. - Index
Key - Interval
Fields - The stored-field restriction in a
PostgreSQLinterval declaration. - Join
Kind - Lock
Strength PostgreSQLrow-lock strength, strongest last.- Lock
Wait - Wait policy for a row-locking clause.
- Merge
When - Nulls
Order - Numeric
Operator - Numeric operator syntax, kept separate from ordinary calls such as
modorabs. - OnCommit
Action ON COMMITbehavior retained with a temporary table definition.- OnConflict
Action - Overriding
Kind - Which value an
INSERTwrites to an identity column it supplies a value for. Without the clause a supplied value is written to aGENERATED BY DEFAULTidentity column and rejected for aGENERATED ALWAYSone. - Partition
Bound - Partition
Range Datum - Partition
Strategy - Range
Function Operation - Operation selected for one typed range or multirange call.
- Range
Subtype - Relation
Persistence PostgreSQL’spg_class.relpersistencecontract.- Role
Attribute - Role
Membership Action - Role
Specification - Routine
Attribute Clause - One attribute clause of a routine statement.
- Routine
Body Error - A body that
interpret_AS_clauserejects. - Routine
Config Action - Routine
Default Type - The type of a stored routine default. Some NULL inputs retain a polymorphic pseudo-type without claiming that it is a concrete SQL value carrier.
- Routine
Privilege - A routine privilege clause is retained until target and recipient lookup finish.
- Routine
Revoke Behavior - Routine
Variadic Mode - Call syntax selected for a routine’s variadic parameter.
- Rule
Event - SQLBody
Form - How a SQL-standard body was written;
pg_get_function_sqlbodyreproduces it. - Schema
Authorization - Schema
Privilege - One requested schema privilege. Unsupported names survive compilation so execution can preserve
PostgreSQLtarget- and role-resolution precedence. - Schema
Revoke Behavior - Dependency behavior for schema privilege revocation.
- Sequence
Bound ALTER SEQUENCEbound action, distinguishing omission fromNO MINVALUEorNO MAXVALUE.- Sequence
Data Type - Sequence
Lifecycle - Name or namespace lifecycle action carried by
ALTER SEQUENCE. - Sequence
Option Value - A sequence option’s value as the parser keeps it, before it is read as a 64-bit integer.
- Sequence
Ownership OWNED BYaction carried byCREATE SEQUENCEandALTER SEQUENCE.- Sequence
Privilege - One requested sequence privilege. Unsupported names survive compilation so execution can preserve
PostgreSQLtarget- and role-resolution precedence. - Sequence
Restart - Physical restart action carried by
ALTER SEQUENCE. - Sequence
Revoke Behavior - Dependency behavior for sequence privilege revocation.
- SetOp
Kind - Statement
- Table
KeyConstraint Kind - Table
Lock Mode - Explicit table-lock modes; compatibility is owned by the execution lock manager.
- Table
Privilege - One requested ordinary-table privilege.
- Table
Revoke Behavior - Dependency behavior for ordinary-table privilege revocation.
- Transaction
Isolation Level - Transaction
Stmt - Trigger
Deferrability - Trigger
Event - Trigger
Timing - Type
Object Kind - The keyword that named the target.
DOMAINstatements reject types that are not domains. - Type
Privilege - A privilege named by
GRANT | REVOKE ... ON TYPE | DOMAIN. Types have onlyUSAGE; other names are rejected after the targets are resolved, asPostgreSQLdoes. - Type
Revoke Behavior - User
Type Kind - Vacuum
Option Value - Window
Reference Kind
Functions§
- is_
builtin_ aggregate_ function - Return whether
nameis a built-in aggregate understood by the planner.
Type Aliases§
- Function
Order Syntax - The original public name, preserved for callers and stored ordering metadata.
- Generated
Function Dependency - Routine
AclEntry - One explicit
EXECUTEACL entry.NoneonCreateFunction::execute_aclretainsPostgreSQL’s default public execution privilege. - Value
Expr Exprrestricted to value-producing forms used byINSERTrows.