pglast.ast
— Python classes representing PG parser nodes¶
The module implements a set of data classes, one for each C
structure defined in several
PostgreSQL headers, primarily those in the include/nodes/ directory.
The pglast.ast.Node
is an abstract class that implements the common behaviour of all
the concrete classes. In particular any node can be compared
with another instance, is able to serialize
itself and can
be altered
.
- class pglast.ast.Node(data)¶
Base class for all AST nodes.
- __call__(depth=None, ellipsis=…, skip_none=False)¶
Serialize the node as a structure made of simple Python data-types.
- Parameters:
depth (
None
orint
) – if notNone
, the maximum depth to reachellipsis – the marker value that will be used to replace cut-off branch
skip_none (bool) – whether
None
-valued attributes should be elidedenum_name (bool) – whether Enums will be rendered as their name only
- Returns:
a
dict
instance
This performs a top-down recursive visit to the whole AST tree: each
Node
instance becomes a dictionary with a special@
key carrying the node type, lists becomes tuples andEnum
instances become dictionaries with a special#
key carrying the enum name.
- __eq__(other)¶
Compare two nodes, returning
True
if they are considered equivalent.This is mainly an helper method used by tests: for this reason, two nodes are considered equal when all their attributes match, ignoring positional ones such as
location
,stmt_len
andstmt_location
.
- __repr__()¶
Build a representation of the whole node and its subtree, for debug.
- __setattr__(name, value)¶
Validate the given value and if acceptable assign it to the name attribute.
This tries to coerce the given value accordingly with the ctype of the attribute, raising opportune exception when that is not possible.
- class pglast.ast.A_ArrayExpr(elements=None, location=None)¶
Wrapper for the homonymous parser node.
- elements: tuple¶
Array element expressions
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.A_Const(isnull=None, val=None)¶
Wrapper for the homonymous parser node.
- isnull: bool¶
- val: ValUnion¶
- class pglast.ast.A_Expr(kind=None, name=None, lexpr=None, rexpr=None, location=None)¶
Wrapper for the homonymous parser node.
- kind: A_Expr_Kind¶
- name: tuple¶
Possibly-qualified name of operator
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.A_Indices(is_slice=None, lidx=None, uidx=None)¶
Wrapper for the homonymous parser node.
- is_slice: bool¶
True if slice (i.e., colon present)
- class pglast.ast.A_Indirection(arg=None, indirection=None)¶
Wrapper for the homonymous parser node.
- indirection: tuple¶
Subscripts and/or field names and/or *
- class pglast.ast.A_Star¶
Wrapper for the homonymous parser node.
- class pglast.ast.AccessPriv(priv_name=None, cols=None)¶
Wrapper for the homonymous parser node.
- priv_name: str¶
String name of privilege
- cols: tuple¶
List of String
- class pglast.ast.Aggref(aggargtypes=None, aggdirectargs=None, args=None, aggorder=None, aggdistinct=None, aggfilter=None, aggstar=None, aggvariadic=None, aggkind=None, agglevelsup=None, aggsplit=None, aggno=None, aggtransno=None, location=None)¶
Wrapper for the homonymous parser node.
- aggargtypes: tuple¶
- aggdirectargs: tuple¶
- args: tuple¶
- aggorder: tuple¶
- aggdistinct: tuple¶
- aggfilter: Expr*¶
- aggstar: bool¶
- aggvariadic: bool¶
- aggkind: str¶
- agglevelsup: Index¶
- aggno: int¶
- aggtransno: int¶
- location: int¶
- class pglast.ast.Alias(aliasname=None, colnames=None)¶
Wrapper for the homonymous parser node.
- aliasname: str¶
Aliased rel name (never qualified)
- colnames: tuple¶
Optional list of column aliases
- class pglast.ast.AlterCollationStmt(collname=None)¶
Wrapper for the homonymous parser node.
- collname: tuple¶
- class pglast.ast.AlterDatabaseRefreshCollStmt(dbname=None)¶
Wrapper for the homonymous parser node.
- dbname: str¶
- class pglast.ast.AlterDatabaseSetStmt(dbname=None, setstmt=None)¶
Wrapper for the homonymous parser node.
- dbname: str¶
Database name
- setstmt: VariableSetStmt*¶
SET or RESET subcommand
- class pglast.ast.AlterDatabaseStmt(dbname=None, options=None)¶
Wrapper for the homonymous parser node.
- dbname: str¶
Name of database to alter
- options: tuple¶
List of DefElem nodes
- class pglast.ast.AlterDefaultPrivilegesStmt(options=None, action=None)¶
Wrapper for the homonymous parser node.
- options: tuple¶
List of DefElem
- action: GrantStmt*¶
GRANT/REVOKE action (with objects=NIL)
- class pglast.ast.AlterDomainStmt(subtype=None, typeName=None, name=None, def_=None, behavior=None, missing_ok=None)¶
Wrapper for the homonymous parser node.
- subtype: str¶
T = alter column default
N = alter column drop not null
O = alter column set not null
C = add constraint
X = drop constraint
- typeName: tuple¶
Domain to work on
- name: str¶
Column or constraint name to act on
- behavior: DropBehavior¶
RESTRICT or CASCADE for DROP cases
- missing_ok: bool¶
Skip error if missing?
- class pglast.ast.AlterEnumStmt(typeName=None, oldVal=None, newVal=None, newValNeighbor=None, newValIsAfter=None, skipIfNewValExists=None)¶
Wrapper for the homonymous parser node.
- typeName: tuple¶
Qualified name (list of String)
- oldVal: str¶
Old enum value’s name, if renaming
- newVal: str¶
New enum value’s name
- newValNeighbor: str¶
Neighboring enum value, if specified
- newValIsAfter: bool¶
Place new enum value after neighbor?
- skipIfNewValExists: bool¶
No error if new already exists?
- class pglast.ast.AlterEventTrigStmt(trigname=None, tgenabled=None)¶
Wrapper for the homonymous parser node.
- trigname: str¶
TRIGGER’s name
- tgenabled: str¶
Trigger’s firing configuration WRT session_replication_role
- class pglast.ast.AlterExtensionContentsStmt(extname=None, action=None, objtype=None, object=None)¶
Wrapper for the homonymous parser node.
- extname: str¶
Extension’s name
- action: int¶
+1 = add object, -1 = drop object
- objtype: ObjectType¶
Object’s type
- class pglast.ast.AlterExtensionStmt(extname=None, options=None)¶
Wrapper for the homonymous parser node.
- extname: str¶
- options: tuple¶
List of DefElem nodes
- class pglast.ast.AlterFdwStmt(fdwname=None, func_options=None, options=None)¶
Wrapper for the homonymous parser node.
- fdwname: str¶
Foreign-data wrapper name
- func_options: tuple¶
HANDLER/VALIDATOR options
- options: tuple¶
Generic options to FDW
- class pglast.ast.AlterForeignServerStmt(servername=None, version=None, options=None, has_version=None)¶
Wrapper for the homonymous parser node.
- servername: str¶
Server name
- version: str¶
Optional server version
- options: tuple¶
Generic options to server
- has_version: bool¶
Version specified
- class pglast.ast.AlterFunctionStmt(objtype=None, func=None, actions=None)¶
Wrapper for the homonymous parser node.
- objtype: ObjectType¶
- func: ObjectWithArgs*¶
Name and args of function
- actions: tuple¶
List of DefElem
- class pglast.ast.AlterObjectDependsStmt(objectType=None, relation=None, object=None, extname=None, remove=None)¶
Wrapper for the homonymous parser node.
- objectType: ObjectType¶
OBJECT_FUNCTION, OBJECT_TRIGGER, etc
- relation: RangeVar*¶
In case a table is involved
- extname: String*¶
Extension name
- remove: bool¶
Set true to remove dep rather than add
- class pglast.ast.AlterObjectSchemaStmt(objectType=None, relation=None, object=None, newschema=None, missing_ok=None)¶
Wrapper for the homonymous parser node.
- objectType: ObjectType¶
OBJECT_TABLE, OBJECT_TYPE, etc
- relation: RangeVar*¶
In case it’s a table
- newschema: str¶
The new schema
- missing_ok: bool¶
Skip error if missing?
- class pglast.ast.AlterOpFamilyStmt(opfamilyname=None, amname=None, isDrop=None, items=None)¶
Wrapper for the homonymous parser node.
- opfamilyname: tuple¶
Qualified name (list of String)
- amname: str¶
Name of index AM opfamily is for
- isDrop: bool¶
ADD or DROP the items?
- items: tuple¶
List of CreateOpClassItem nodes
- class pglast.ast.AlterOperatorStmt(opername=None, options=None)¶
Wrapper for the homonymous parser node.
- opername: ObjectWithArgs*¶
Operator name and argument types
- options: tuple¶
List of DefElem nodes
- class pglast.ast.AlterOwnerStmt(objectType=None, relation=None, object=None, newowner=None)¶
Wrapper for the homonymous parser node.
- objectType: ObjectType¶
OBJECT_TABLE, OBJECT_TYPE, etc
- relation: RangeVar*¶
In case it’s a table
- newowner: RoleSpec*¶
The new owner
- class pglast.ast.AlterPolicyStmt(policy_name=None, table=None, roles=None, qual=None, with_check=None)¶
Wrapper for the homonymous parser node.
- policy_name: str¶
Policy’s name
- table: RangeVar*¶
The table name the policy applies to
- roles: tuple¶
The roles associated with the policy
- class pglast.ast.AlterPublicationStmt(pubname=None, options=None, pubobjects=None, for_all_tables=None, action=None)¶
Wrapper for the homonymous parser node.
- pubname: str¶
Name of the publication
- options: tuple¶
List of DefElem nodes
- pubobjects: tuple¶
Optional list of publication objects
- for_all_tables: bool¶
Special publication for all tables in db
- action: AlterPublicationAction¶
What action to perform with the given objects
- class pglast.ast.AlterRoleSetStmt(role=None, database=None, setstmt=None)¶
Wrapper for the homonymous parser node.
- role: RoleSpec*¶
Role
- database: str¶
Database name, or NULL
- setstmt: VariableSetStmt*¶
SET or RESET subcommand
- class pglast.ast.AlterRoleStmt(role=None, options=None, action=None)¶
Wrapper for the homonymous parser node.
- role: RoleSpec*¶
Role
- options: tuple¶
List of DefElem nodes
- action: int¶
+1 = add members, -1 = drop members
- class pglast.ast.AlterSeqStmt(sequence=None, options=None, for_identity=None, missing_ok=None)¶
Wrapper for the homonymous parser node.
- sequence: RangeVar*¶
The sequence to alter
- options: tuple¶
- for_identity: bool¶
- missing_ok: bool¶
Skip error if a role is missing?
- class pglast.ast.AlterStatsStmt(defnames=None, stxstattarget=None, missing_ok=None)¶
Wrapper for the homonymous parser node.
- defnames: tuple¶
Qualified name (list of String)
- stxstattarget: int¶
Statistics target
- missing_ok: bool¶
Skip error if statistics object is missing
- class pglast.ast.AlterSubscriptionStmt(kind=None, subname=None, conninfo=None, publication=None, options=None)¶
Wrapper for the homonymous parser node.
- kind: AlterSubscriptionType¶
ALTER_SUBSCRIPTION_OPTIONS, etc
- subname: str¶
Name of the subscription
- conninfo: str¶
Connection string to publisher
- publication: tuple¶
One or more publication to subscribe to
- options: tuple¶
List of DefElem nodes
- class pglast.ast.AlterSystemStmt(setstmt=None)¶
Wrapper for the homonymous parser node.
- setstmt: VariableSetStmt*¶
SET subcommand
- class pglast.ast.AlterTSConfigurationStmt(kind=None, cfgname=None, tokentype=None, dicts=None, override=None, replace=None, missing_ok=None)¶
Wrapper for the homonymous parser node.
- kind: AlterTSConfigType¶
ALTER_TSCONFIG_ADD_MAPPING, etc
- cfgname: tuple¶
Qualified name (list of String)
- tokentype: tuple¶
List of String
- dicts: tuple¶
List of list of String
- override: bool¶
If true - remove old variant
- replace: bool¶
If true - replace dictionary by another
- missing_ok: bool¶
For DROP - skip error if missing?
- class pglast.ast.AlterTSDictionaryStmt(dictname=None, options=None)¶
Wrapper for the homonymous parser node.
- dictname: tuple¶
Qualified name (list of String)
- options: tuple¶
List of DefElem nodes
- class pglast.ast.AlterTableCmd(subtype=None, name=None, num=None, newowner=None, def_=None, behavior=None, missing_ok=None, recurse=None)¶
Wrapper for the homonymous parser node.
- subtype: AlterTableType¶
Type of table alteration to apply
- name: str¶
Column, constraint, or trigger to act on, or tablespace
- num: int16¶
Attribute number for columns referenced by number
- newowner: RoleSpec*¶
- behavior: DropBehavior¶
RESTRICT or CASCADE for DROP cases
- missing_ok: bool¶
Skip error if missing?
- recurse: bool¶
Exec-time recursion
- class pglast.ast.AlterTableMoveAllStmt(orig_tablespacename=None, objtype=None, roles=None, new_tablespacename=None, nowait=None)¶
Wrapper for the homonymous parser node.
- orig_tablespacename: str¶
- objtype: ObjectType¶
Object type to move
- roles: tuple¶
List of roles to move objects of
- new_tablespacename: str¶
- nowait: bool¶
- class pglast.ast.AlterTableSpaceOptionsStmt(tablespacename=None, options=None, isReset=None)¶
Wrapper for the homonymous parser node.
- tablespacename: str¶
- options: tuple¶
- isReset: bool¶
- class pglast.ast.AlterTableStmt(relation=None, cmds=None, objtype=None, missing_ok=None)¶
Wrapper for the homonymous parser node.
- relation: RangeVar*¶
Table to work on
- cmds: tuple¶
List of subcommands
- objtype: ObjectType¶
Type of object
- missing_ok: bool¶
Skip error if table missing
- class pglast.ast.AlterTypeStmt(typeName=None, options=None)¶
Wrapper for the homonymous parser node.
- typeName: tuple¶
Type name (possibly qualified)
- options: tuple¶
List of DefElem nodes
- class pglast.ast.AlterUserMappingStmt(user=None, servername=None, options=None)¶
Wrapper for the homonymous parser node.
- user: RoleSpec*¶
User role
- servername: str¶
Server name
- options: tuple¶
Generic options to server
- class pglast.ast.AlternativeSubPlan(subplans=None)¶
Wrapper for the homonymous parser node.
- subplans: tuple¶
SubPlan(s) with equivalent results
- class pglast.ast.ArrayCoerceExpr(arg=None, elemexpr=None, resulttypmod=None, coerceformat=None, location=None)¶
Wrapper for the homonymous parser node.
- arg: Expr*¶
Input expression (yields an array)
- elemexpr: Expr*¶
Expression representing per-element work
- resulttypmod: int32¶
- coerceformat: CoercionForm¶
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.ArrayExpr(elements=None, multidims=None, location=None)¶
Wrapper for the homonymous parser node.
- elements: tuple¶
- multidims: bool¶
- location: int¶
- class pglast.ast.BitString(bsval=None)¶
Wrapper for the homonymous parser node.
- bsval: str¶
- class pglast.ast.BoolExpr(boolop=None, args=None, location=None)¶
Wrapper for the homonymous parser node.
- boolop: BoolExprType¶
- args: tuple¶
Arguments to this expression
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.Boolean(boolval=None)¶
Wrapper for the homonymous parser node.
- boolval: bool¶
- class pglast.ast.BooleanTest(arg=None, booltesttype=None, location=None)¶
Wrapper for the homonymous parser node.
- arg: Expr*¶
Input expression
- booltesttype: BoolTestType¶
Test type
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.CTECycleClause(cycle_col_list=None, cycle_mark_column=None, cycle_mark_value=None, cycle_mark_default=None, cycle_path_column=None, location=None, cycle_mark_typmod=None)¶
Wrapper for the homonymous parser node.
- cycle_col_list: tuple¶
- cycle_mark_column: str¶
- cycle_path_column: str¶
- location: int¶
- cycle_mark_typmod: int¶
- class pglast.ast.CTESearchClause(search_col_list=None, search_breadth_first=None, search_seq_column=None, location=None)¶
Wrapper for the homonymous parser node.
- search_col_list: tuple¶
- search_breadth_first: bool¶
- search_seq_column: str¶
- location: int¶
- class pglast.ast.CallContext(atomic=None)¶
Wrapper for the homonymous parser node.
- atomic: bool¶
- class pglast.ast.CallStmt(funccall=None, funcexpr=None, outargs=None)¶
Wrapper for the homonymous parser node.
- funccall: FuncCall*¶
From the parser
- funcexpr: FuncExpr*¶
- outargs: tuple¶
- class pglast.ast.CaseExpr(arg=None, args=None, defresult=None, location=None)¶
Wrapper for the homonymous parser node.
- arg: Expr*¶
Implicit equality comparison argument
- args: tuple¶
The arguments (list of WHEN clauses)
- defresult: Expr*¶
The default result (ELSE clause)
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.CaseTestExpr(typeMod=None)¶
Wrapper for the homonymous parser node.
- typeMod: int32¶
- class pglast.ast.CaseWhen(expr=None, result=None, location=None)¶
Wrapper for the homonymous parser node.
- expr: Expr*¶
Condition expression
- result: Expr*¶
Substitution result
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.CheckPointStmt¶
Wrapper for the homonymous parser node.
- class pglast.ast.ClosePortalStmt(portalname=None)¶
Wrapper for the homonymous parser node.
- portalname: str¶
Name of the portal (cursor)
- class pglast.ast.ClusterStmt(relation=None, indexname=None, params=None)¶
Wrapper for the homonymous parser node.
- relation: RangeVar*¶
Relation being indexed, or NULL if all
- indexname: str¶
Original index defined
- params: tuple¶
List of DefElem nodes
- class pglast.ast.CoalesceExpr(args=None, location=None)¶
Wrapper for the homonymous parser node.
- args: tuple¶
- location: int¶
- class pglast.ast.CoerceToDomain(arg=None, resulttypmod=None, coercionformat=None, location=None)¶
Wrapper for the homonymous parser node.
- arg: Expr*¶
Input expression
- resulttypmod: int32¶
- coercionformat: CoercionForm¶
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.CoerceToDomainValue(typeMod=None, location=None)¶
Wrapper for the homonymous parser node.
- typeMod: int32¶
- location: int¶
- class pglast.ast.CoerceViaIO(arg=None, coerceformat=None, location=None)¶
Wrapper for the homonymous parser node.
- arg: Expr*¶
Input expression
- coerceformat: CoercionForm¶
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.CollateClause(arg=None, collname=None, location=None)¶
Wrapper for the homonymous parser node.
- collname: tuple¶
Possibly-qualified collation name
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.CollateExpr(arg=None, location=None)¶
Wrapper for the homonymous parser node.
- arg: Expr*¶
Input expression
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.ColumnDef(colname=None, typeName=None, compression=None, inhcount=None, is_local=None, is_not_null=None, is_from_type=None, storage=None, storage_name=None, raw_default=None, cooked_default=None, identity=None, identitySequence=None, generated=None, collClause=None, constraints=None, fdwoptions=None, location=None)¶
Wrapper for the homonymous parser node.
- colname: str¶
Name of column
- typeName: TypeName*¶
Type of column
- compression: str¶
Compression method for column
- inhcount: int¶
Number of times column is inherited
- is_local: bool¶
Column has local (non-inherited) def’n
- is_not_null: bool¶
NOT NULL constraint specified?
- is_from_type: bool¶
Column definition came from table type
- storage: str¶
Attstorage setting, or 0 for default
- storage_name: str¶
Attstorage setting name or NULL for default
- identity: str¶
Attidentity setting
- identitySequence: RangeVar*¶
To store identity sequence name for ALTER TABLE … ADD COLUMN
- generated: str¶
Attgenerated setting
- collClause: CollateClause*¶
Untransformed COLLATE spec, if any
- constraints: tuple¶
Other constraints on column
- fdwoptions: tuple¶
Per-column FDW options
- location: int¶
Parse location, or -1 if none/unknown
- class pglast.ast.ColumnRef(fields=None, location=None)¶
Wrapper for the homonymous parser node.
- fields: tuple¶
Field names (String nodes) or A_Star
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.CommentStmt(objtype=None, object=None, comment=None)¶
Wrapper for the homonymous parser node.
- objtype: ObjectType¶
Object’s type
- comment: str¶
Comment to insert, or NULL to remove
- class pglast.ast.CommonTableExpr(ctename=None, aliascolnames=None, ctematerialized=None, ctequery=None, search_clause=None, cycle_clause=None, location=None, cterecursive=None, cterefcount=None, ctecolnames=None, ctecoltypes=None, ctecoltypmods=None, ctecolcollations=None)¶
Wrapper for the homonymous parser node.
- ctename: str¶
- aliascolnames: tuple¶
- ctematerialized: CTEMaterialize¶
Is this an optimization fence?
- search_clause: CTESearchClause*¶
- cycle_clause: CTECycleClause*¶
- location: int¶
Token location, or -1 if unknown
- cterecursive: bool¶
- cterefcount: int¶
- ctecolnames: tuple¶
- ctecoltypes: tuple¶
- ctecoltypmods: tuple¶
- ctecolcollations: tuple¶
- class pglast.ast.CompositeTypeStmt(typevar=None, coldeflist=None)¶
Wrapper for the homonymous parser node.
- typevar: RangeVar*¶
The composite type to be created
- coldeflist: tuple¶
List of ColumnDef nodes
- class pglast.ast.Constraint(contype=None, conname=None, deferrable=None, initdeferred=None, location=None, is_no_inherit=None, raw_expr=None, cooked_expr=None, generated_when=None, nulls_not_distinct=None, keys=None, including=None, exclusions=None, options=None, indexname=None, indexspace=None, reset_default_tblspc=None, access_method=None, where_clause=None, pktable=None, fk_attrs=None, pk_attrs=None, fk_matchtype=None, fk_upd_action=None, fk_del_action=None, fk_del_set_cols=None, old_conpfeqop=None, skip_validation=None, initially_valid=None)¶
Wrapper for the homonymous parser node.
- contype: ConstrType¶
- conname: str¶
Constraint name, or NULL if unnamed
- deferrable: bool¶
DEFERRABLE?
- initdeferred: bool¶
INITIALLY DEFERRED?
- location: int¶
Token location, or -1 if unknown
- is_no_inherit: bool¶
Is constraint non-inheritable?
- cooked_expr: str¶
Expr, as nodeToString representation
- generated_when: str¶
ALWAYS or BY DEFAULT
- nulls_not_distinct: bool¶
Null treatment for UNIQUE constraints
- keys: tuple¶
String nodes naming referenced key column(s)
- including: tuple¶
String nodes naming referenced nonkey column(s)
- exclusions: tuple¶
List of (IndexElem, operator name) pairs
- options: tuple¶
Options from WITH clause
- indexname: str¶
Existing index to use; otherwise NULL
- indexspace: str¶
Index tablespace; NULL for default
- reset_default_tblspc: bool¶
Reset default_tablespace prior to creating the index
- access_method: str¶
Index access method; NULL for default
- pktable: RangeVar*¶
Primary key table
- fk_attrs: tuple¶
Attributes of foreign key
- pk_attrs: tuple¶
Corresponding attrs in PK table
- fk_matchtype: str¶
FULL, PARTIAL, SIMPLE
- fk_upd_action: str¶
ON UPDATE action
- fk_del_action: str¶
ON DELETE action
- fk_del_set_cols: tuple¶
ON DELETE SET NULL/DEFAULT (col1, col2)
- old_conpfeqop: tuple¶
Pg_constraint.conpfeqop of my former self
- skip_validation: bool¶
Skip validation of existing rows?
- initially_valid: bool¶
Mark the new constraint as valid?
- class pglast.ast.ConstraintsSetStmt(constraints=None, deferred=None)¶
Wrapper for the homonymous parser node.
- constraints: tuple¶
List of names as RangeVars
- deferred: bool¶
- class pglast.ast.ConvertRowtypeExpr(arg=None, convertformat=None, location=None)¶
Wrapper for the homonymous parser node.
- arg: Expr*¶
Input expression
- convertformat: CoercionForm¶
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.CopyStmt(relation=None, query=None, attlist=None, is_from=None, is_program=None, filename=None, options=None, whereClause=None)¶
Wrapper for the homonymous parser node.
- relation: RangeVar*¶
The relation to copy
- attlist: tuple¶
List of column names (as Strings), or NIL for all columns
- is_from: bool¶
TO or FROM
- is_program: bool¶
Is ‘filename’ a program to popen?
- filename: str¶
Filename, or NULL for STDIN/STDOUT
- options: tuple¶
List of DefElem nodes
- class pglast.ast.CreateAmStmt(amname=None, handler_name=None, amtype=None)¶
Wrapper for the homonymous parser node.
- amname: str¶
Access method name
- handler_name: tuple¶
Handler function name
- amtype: str¶
Type of access method
- class pglast.ast.CreateCastStmt(sourcetype=None, targettype=None, func=None, context=None, inout=None)¶
Wrapper for the homonymous parser node.
- sourcetype: TypeName*¶
- targettype: TypeName*¶
- func: ObjectWithArgs*¶
- context: CoercionContext¶
- inout: bool¶
- class pglast.ast.CreateConversionStmt(conversion_name=None, for_encoding_name=None, to_encoding_name=None, func_name=None, def_=None)¶
Wrapper for the homonymous parser node.
- conversion_name: tuple¶
Name of the conversion
- for_encoding_name: str¶
Source encoding name
- to_encoding_name: str¶
Destination encoding name
- func_name: tuple¶
Qualified conversion function name
- def_: bool¶
Is this a default conversion?
- class pglast.ast.CreateDomainStmt(domainname=None, typeName=None, collClause=None, constraints=None)¶
Wrapper for the homonymous parser node.
- domainname: tuple¶
Qualified name (list of String)
- typeName: TypeName*¶
The base type
- collClause: CollateClause*¶
Untransformed COLLATE spec, if any
- constraints: tuple¶
Constraints (list of Constraint nodes)
- class pglast.ast.CreateEnumStmt(typeName=None, vals=None)¶
Wrapper for the homonymous parser node.
- typeName: tuple¶
Qualified name (list of String)
- vals: tuple¶
Enum values (list of String)
- class pglast.ast.CreateEventTrigStmt(trigname=None, eventname=None, whenclause=None, funcname=None)¶
Wrapper for the homonymous parser node.
- trigname: str¶
TRIGGER’s name
- eventname: str¶
Event’s identifier
- whenclause: tuple¶
List of DefElems indicating filtering
- funcname: tuple¶
Qual. name of function to call
- class pglast.ast.CreateExtensionStmt(extname=None, if_not_exists=None, options=None)¶
Wrapper for the homonymous parser node.
- extname: str¶
- if_not_exists: bool¶
Just do nothing if it already exists?
- options: tuple¶
List of DefElem nodes
- class pglast.ast.CreateFdwStmt(fdwname=None, func_options=None, options=None)¶
Wrapper for the homonymous parser node.
- fdwname: str¶
Foreign-data wrapper name
- func_options: tuple¶
HANDLER/VALIDATOR options
- options: tuple¶
Generic options to FDW
- class pglast.ast.CreateForeignServerStmt(servername=None, servertype=None, version=None, fdwname=None, if_not_exists=None, options=None)¶
Wrapper for the homonymous parser node.
- servername: str¶
Server name
- servertype: str¶
Optional server type
- version: str¶
Optional server version
- fdwname: str¶
FDW name
- if_not_exists: bool¶
Just do nothing if it already exists?
- options: tuple¶
Generic options to server
- class pglast.ast.CreateForeignTableStmt(base=None, servername=None, options=None)¶
Wrapper for the homonymous parser node.
- base: CreateStmt¶
- servername: str¶
- options: tuple¶
- class pglast.ast.CreateFunctionStmt(is_procedure=None, replace=None, funcname=None, parameters=None, returnType=None, options=None, sql_body=None)¶
Wrapper for the homonymous parser node.
- is_procedure: bool¶
It’s really CREATE PROCEDURE
- replace: bool¶
T => replace if already exists
- funcname: tuple¶
Qualified name of function to create
- parameters: tuple¶
A list of FunctionParameter
- returnType: TypeName*¶
The return type
- options: tuple¶
A list of DefElem
- class pglast.ast.CreateOpClassItem(itemtype=None, name=None, number=None, order_family=None, class_args=None, storedtype=None)¶
Wrapper for the homonymous parser node.
- itemtype: int¶
See codes above
- name: ObjectWithArgs*¶
Operator or function name and args
- number: int¶
Strategy num or support proc num
- order_family: tuple¶
Only used for ordering operators
- class_args: tuple¶
Amproclefttype/amprocrighttype or amoplefttype/amoprighttype
- storedtype: TypeName*¶
Datatype stored in index
- class pglast.ast.CreateOpClassStmt(opclassname=None, opfamilyname=None, amname=None, datatype=None, items=None, isDefault=None)¶
Wrapper for the homonymous parser node.
- opclassname: tuple¶
Qualified name (list of String)
- opfamilyname: tuple¶
Qualified name (ditto); NIL if omitted
- amname: str¶
Name of index AM opclass is for
- datatype: TypeName*¶
Datatype of indexed column
- items: tuple¶
List of CreateOpClassItem nodes
- isDefault: bool¶
Should be marked as default for type?
- class pglast.ast.CreateOpFamilyStmt(opfamilyname=None, amname=None)¶
Wrapper for the homonymous parser node.
- opfamilyname: tuple¶
Qualified name (list of String)
- amname: str¶
Name of index AM opfamily is for
- class pglast.ast.CreatePLangStmt(replace=None, plname=None, plhandler=None, plinline=None, plvalidator=None, pltrusted=None)¶
Wrapper for the homonymous parser node.
- replace: bool¶
T => replace if already exists
- plname: str¶
PL name
- plhandler: tuple¶
PL call handler function (qual. name)
- plinline: tuple¶
Optional inline function (qual. name)
- plvalidator: tuple¶
Optional validator function (qual. name)
- pltrusted: bool¶
PL is trusted
- class pglast.ast.CreatePolicyStmt(policy_name=None, table=None, cmd_name=None, permissive=None, roles=None, qual=None, with_check=None)¶
Wrapper for the homonymous parser node.
- policy_name: str¶
Policy’s name
- table: RangeVar*¶
The table name the policy applies to
- cmd_name: str¶
The command name the policy applies to
- permissive: bool¶
Restrictive or permissive policy
- roles: tuple¶
The roles associated with the policy
- class pglast.ast.CreatePublicationStmt(pubname=None, options=None, pubobjects=None, for_all_tables=None)¶
Wrapper for the homonymous parser node.
- pubname: str¶
Name of the publication
- options: tuple¶
List of DefElem nodes
- pubobjects: tuple¶
Optional list of publication objects
- for_all_tables: bool¶
Special publication for all tables in db
- class pglast.ast.CreateRangeStmt(typeName=None, params=None)¶
Wrapper for the homonymous parser node.
- typeName: tuple¶
Qualified name (list of String)
- params: tuple¶
Range parameters (list of DefElem)
- class pglast.ast.CreateRoleStmt(stmt_type=None, role=None, options=None)¶
Wrapper for the homonymous parser node.
- stmt_type: RoleStmtType¶
ROLE/USER/GROUP
- role: str¶
Role name
- options: tuple¶
List of DefElem nodes
- class pglast.ast.CreateSchemaStmt(schemaname=None, authrole=None, schemaElts=None, if_not_exists=None)¶
Wrapper for the homonymous parser node.
- schemaname: str¶
The name of the schema to create
- authrole: RoleSpec*¶
The owner of the created schema
- schemaElts: tuple¶
Schema components (list of parsenodes)
- if_not_exists: bool¶
Just do nothing if schema already exists?
- class pglast.ast.CreateSeqStmt(sequence=None, options=None, for_identity=None, if_not_exists=None)¶
Wrapper for the homonymous parser node.
- sequence: RangeVar*¶
The sequence to create
- options: tuple¶
- for_identity: bool¶
- if_not_exists: bool¶
Just do nothing if it already exists?
- class pglast.ast.CreateStatsStmt(defnames=None, stat_types=None, exprs=None, relations=None, stxcomment=None, transformed=None, if_not_exists=None)¶
Wrapper for the homonymous parser node.
- defnames: tuple¶
Qualified name (list of String)
- stat_types: tuple¶
Stat types (list of String)
- exprs: tuple¶
Expressions to build statistics on
- relations: tuple¶
Rels to build stats on (list of RangeVar)
- stxcomment: str¶
Comment to apply to stats, or NULL
- transformed: bool¶
True when transformStatsStmt is finished
- if_not_exists: bool¶
Do nothing if stats name already exists
- class pglast.ast.CreateStmt(relation=None, tableElts=None, inhRelations=None, partbound=None, partspec=None, ofTypename=None, constraints=None, options=None, oncommit=None, tablespacename=None, accessMethod=None, if_not_exists=None)¶
Wrapper for the homonymous parser node.
- relation: RangeVar*¶
Relation to create
- tableElts: tuple¶
Column definitions (list of ColumnDef)
- inhRelations: tuple¶
Relations to inherit from (list of RangeVar)
- partbound: PartitionBoundSpec*¶
FOR VALUES clause
- partspec: PartitionSpec*¶
PARTITION BY clause
- ofTypename: TypeName*¶
OF typename
- constraints: tuple¶
Constraints (list of Constraint nodes)
- options: tuple¶
Options from WITH clause
- oncommit: OnCommitAction¶
What do we do at COMMIT?
- tablespacename: str¶
Table space to use, or NULL
- accessMethod: str¶
Table access method
- if_not_exists: bool¶
Just do nothing if it already exists?
- class pglast.ast.CreateSubscriptionStmt(subname=None, conninfo=None, publication=None, options=None)¶
Wrapper for the homonymous parser node.
- subname: str¶
Name of the subscription
- conninfo: str¶
Connection string to publisher
- publication: tuple¶
One or more publication to subscribe to
- options: tuple¶
List of DefElem nodes
- class pglast.ast.CreateTableAsStmt(query=None, into=None, objtype=None, is_select_into=None, if_not_exists=None)¶
Wrapper for the homonymous parser node.
- into: IntoClause*¶
Destination table
- objtype: ObjectType¶
OBJECT_TABLE or OBJECT_MATVIEW
- is_select_into: bool¶
It was written as SELECT INTO
- if_not_exists: bool¶
Just do nothing if it already exists?
- class pglast.ast.CreateTableSpaceStmt(tablespacename=None, owner=None, location=None, options=None)¶
Wrapper for the homonymous parser node.
- tablespacename: str¶
- owner: RoleSpec*¶
- location: str¶
- options: tuple¶
- class pglast.ast.CreateTransformStmt(replace=None, type_name=None, lang=None, fromsql=None, tosql=None)¶
Wrapper for the homonymous parser node.
- replace: bool¶
- type_name: TypeName*¶
- lang: str¶
- fromsql: ObjectWithArgs*¶
- tosql: ObjectWithArgs*¶
- class pglast.ast.CreateTrigStmt(replace=None, isconstraint=None, trigname=None, relation=None, funcname=None, args=None, row=None, timing=None, events=None, columns=None, whenClause=None, transitionRels=None, deferrable=None, initdeferred=None, constrrel=None)¶
Wrapper for the homonymous parser node.
- replace: bool¶
Replace trigger if already exists
- isconstraint: bool¶
This is a constraint trigger
- trigname: str¶
TRIGGER’s name
- relation: RangeVar*¶
Relation trigger is on
- funcname: tuple¶
Qual. name of function to call
- args: tuple¶
List of String or NIL
- row: bool¶
ROW/STATEMENT
- timing: int16¶
BEFORE, AFTER, or INSTEAD
- events: int16¶
“OR” of INSERT/UPDATE/DELETE/TRUNCATE
- columns: tuple¶
Column names, or NIL for all columns
- transitionRels: tuple¶
TriggerTransition nodes, or NIL if none
- deferrable: bool¶
[NOT] DEFERRABLE
- initdeferred: bool¶
INITIALLY {DEFERRED|IMMEDIATE}
- constrrel: RangeVar*¶
Opposite relation, if RI trigger
- class pglast.ast.CreateUserMappingStmt(user=None, servername=None, if_not_exists=None, options=None)¶
Wrapper for the homonymous parser node.
- user: RoleSpec*¶
User role
- servername: str¶
Server name
- if_not_exists: bool¶
Just do nothing if it already exists?
- options: tuple¶
Generic options to server
- class pglast.ast.CreatedbStmt(dbname=None, options=None)¶
Wrapper for the homonymous parser node.
- dbname: str¶
Name of database to create
- options: tuple¶
List of DefElem nodes
- class pglast.ast.CurrentOfExpr(cvarno=None, cursor_name=None, cursor_param=None)¶
Wrapper for the homonymous parser node.
- cvarno: Index¶
RT index of target relation
- cursor_name: str¶
Name of referenced cursor, or NULL
- cursor_param: int¶
Refcursor parameter number, or 0
- class pglast.ast.DeallocateStmt(name=None)¶
Wrapper for the homonymous parser node.
- name: str¶
The name of the plan to remove
- class pglast.ast.DeclareCursorStmt(portalname=None, options=None, query=None)¶
Wrapper for the homonymous parser node.
- portalname: str¶
Name of the portal (cursor)
- options: int¶
Bitmask of options (see above)
- class pglast.ast.DefElem(defnamespace=None, defname=None, arg=None, defaction=None, location=None)¶
Wrapper for the homonymous parser node.
- defnamespace: str¶
NULL if unqualified name
- defname: str¶
- defaction: DefElemAction¶
Unspecified action, or SET/ADD/DROP
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.DefineStmt(kind=None, oldstyle=None, defnames=None, args=None, definition=None, if_not_exists=None, replace=None)¶
Wrapper for the homonymous parser node.
- kind: ObjectType¶
Aggregate, operator, type
- oldstyle: bool¶
Hack to signal old CREATE AGG syntax
- defnames: tuple¶
Qualified name (list of String)
- args: tuple¶
A list of TypeName (if needed)
- definition: tuple¶
A list of DefElem
- if_not_exists: bool¶
Just do nothing if it already exists?
- replace: bool¶
Replace if already exists?
- class pglast.ast.DeleteStmt(relation=None, usingClause=None, whereClause=None, returningList=None, withClause=None)¶
Wrapper for the homonymous parser node.
- relation: RangeVar*¶
Relation to delete from
- usingClause: tuple¶
Optional using clause for more tables
- returningList: tuple¶
List of expressions to return
- withClause: WithClause*¶
WITH clause
- class pglast.ast.DiscardStmt(target=None)¶
Wrapper for the homonymous parser node.
- target: DiscardMode¶
- class pglast.ast.DoStmt(args=None)¶
Wrapper for the homonymous parser node.
- args: tuple¶
List of DefElem nodes
- class pglast.ast.DropOwnedStmt(roles=None, behavior=None)¶
Wrapper for the homonymous parser node.
- roles: tuple¶
- behavior: DropBehavior¶
- class pglast.ast.DropRoleStmt(roles=None, missing_ok=None)¶
Wrapper for the homonymous parser node.
- roles: tuple¶
List of roles to remove
- missing_ok: bool¶
Skip error if a role is missing?
- class pglast.ast.DropStmt(objects=None, removeType=None, behavior=None, missing_ok=None, concurrent=None)¶
Wrapper for the homonymous parser node.
- objects: tuple¶
List of names
- removeType: ObjectType¶
Object type
- behavior: DropBehavior¶
RESTRICT or CASCADE behavior
- missing_ok: bool¶
Skip error if object is missing?
- concurrent: bool¶
Drop index concurrently?
- class pglast.ast.DropSubscriptionStmt(subname=None, missing_ok=None, behavior=None)¶
Wrapper for the homonymous parser node.
- subname: str¶
Name of the subscription
- missing_ok: bool¶
Skip error if missing?
- behavior: DropBehavior¶
RESTRICT or CASCADE behavior
- class pglast.ast.DropTableSpaceStmt(tablespacename=None, missing_ok=None)¶
Wrapper for the homonymous parser node.
- tablespacename: str¶
- missing_ok: bool¶
Skip error if missing?
- class pglast.ast.DropUserMappingStmt(user=None, servername=None, missing_ok=None)¶
Wrapper for the homonymous parser node.
- user: RoleSpec*¶
User role
- servername: str¶
Server name
- missing_ok: bool¶
Ignore missing mappings
- class pglast.ast.DropdbStmt(dbname=None, missing_ok=None, options=None)¶
Wrapper for the homonymous parser node.
- dbname: str¶
Database to drop
- missing_ok: bool¶
Skip error if db is missing?
- options: tuple¶
Currently only FORCE is supported
- class pglast.ast.ExecuteStmt(name=None, params=None)¶
Wrapper for the homonymous parser node.
- name: str¶
The name of the plan to execute
- params: tuple¶
Values to assign to parameters
- class pglast.ast.ExplainStmt(query=None, options=None)¶
Wrapper for the homonymous parser node.
- options: tuple¶
List of DefElem nodes
- class pglast.ast.FetchStmt(direction=None, howMany=None, portalname=None, ismove=None)¶
Wrapper for the homonymous parser node.
- direction: FetchDirection¶
- howMany: long¶
Number of rows, or position argument
- portalname: str¶
Name of portal (cursor)
- ismove: bool¶
True if MOVE
- class pglast.ast.FieldSelect(arg=None, fieldnum=None, resulttypmod=None)¶
Wrapper for the homonymous parser node.
- arg: Expr*¶
Input expression
- fieldnum: AttrNumber¶
Attribute number of field to extract
- resulttypmod: int32¶
- class pglast.ast.FieldStore(arg=None, newvals=None, fieldnums=None)¶
Wrapper for the homonymous parser node.
- arg: Expr*¶
Input tuple value
- newvals: tuple¶
New value(s) for field(s)
- fieldnums: tuple¶
- class pglast.ast.Float(fval=None)¶
Wrapper for the homonymous parser node.
- fval: str¶
- class pglast.ast.FromExpr(fromlist=None, quals=None)¶
Wrapper for the homonymous parser node.
- fromlist: tuple¶
List of join subtrees
- class pglast.ast.FuncCall(funcname=None, args=None, agg_order=None, agg_filter=None, over=None, agg_within_group=None, agg_star=None, agg_distinct=None, func_variadic=None, funcformat=None, location=None)¶
Wrapper for the homonymous parser node.
- funcname: tuple¶
Qualified name of function
- args: tuple¶
The arguments (list of exprs)
- agg_order: tuple¶
ORDER BY (list of SortBy)
- over: WindowDef*¶
OVER clause, if any
- agg_within_group: bool¶
ORDER BY appeared in WITHIN GROUP
- agg_star: bool¶
Argument was really ‘*’
- agg_distinct: bool¶
Arguments were labeled DISTINCT
- func_variadic: bool¶
Last argument was labeled VARIADIC
- funcformat: CoercionForm¶
How to display this node
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.FuncExpr(funcretset=None, funcvariadic=None, funcformat=None, args=None, location=None)¶
Wrapper for the homonymous parser node.
- funcretset: bool¶
- funcvariadic: bool¶
- funcformat: CoercionForm¶
- args: tuple¶
- location: int¶
- class pglast.ast.FunctionParameter(name=None, argType=None, mode=None, defexpr=None)¶
Wrapper for the homonymous parser node.
- name: str¶
Parameter name, or NULL if not given
- argType: TypeName*¶
TypeName for parameter type
- mode: FunctionParameterMode¶
IN/OUT/etc
- class pglast.ast.GrantRoleStmt(granted_roles=None, grantee_roles=None, is_grant=None, opt=None, grantor=None, behavior=None)¶
Wrapper for the homonymous parser node.
- granted_roles: tuple¶
List of roles to be granted/revoked
- grantee_roles: tuple¶
List of member roles to add/delete
- is_grant: bool¶
True = GRANT, false = REVOKE
- opt: tuple¶
Options e.g. WITH GRANT OPTION
- grantor: RoleSpec*¶
Set grantor to other than current role
- behavior: DropBehavior¶
Drop behavior (for REVOKE)
- class pglast.ast.GrantStmt(is_grant=None, targtype=None, objtype=None, objects=None, privileges=None, grantees=None, grant_option=None, grantor=None, behavior=None)¶
Wrapper for the homonymous parser node.
- is_grant: bool¶
True = GRANT, false = REVOKE
- targtype: GrantTargetType¶
Type of the grant target
- objtype: ObjectType¶
Kind of object being operated on
- objects: tuple¶
List of RangeVar nodes, ObjectWithArgs nodes, or plain names (as String values)
- privileges: tuple¶
List of AccessPriv nodes
- grantees: tuple¶
List of RoleSpec nodes
- grant_option: bool¶
Grant or revoke grant option
- grantor: RoleSpec*¶
- behavior: DropBehavior¶
Drop behavior (for REVOKE)
- class pglast.ast.GroupingFunc(args=None, refs=None, agglevelsup=None, location=None)¶
Wrapper for the homonymous parser node.
- args: tuple¶
- refs: tuple¶
- agglevelsup: Index¶
- location: int¶
- class pglast.ast.GroupingSet(kind=None, content=None, location=None)¶
Wrapper for the homonymous parser node.
- kind: GroupingSetKind¶
- content: tuple¶
- location: int¶
- class pglast.ast.ImportForeignSchemaStmt(server_name=None, remote_schema=None, local_schema=None, list_type=None, table_list=None, options=None)¶
Wrapper for the homonymous parser node.
- server_name: str¶
FDW server name
- remote_schema: str¶
Remote schema name to query
- local_schema: str¶
Local schema to create objects in
- list_type: ImportForeignSchemaType¶
Type of table list
- table_list: tuple¶
List of RangeVar
- options: tuple¶
List of options to pass to FDW
- class pglast.ast.IndexElem(name=None, expr=None, indexcolname=None, collation=None, opclass=None, opclassopts=None, ordering=None, nulls_ordering=None)¶
Wrapper for the homonymous parser node.
- name: str¶
Name of attribute to index, or NULL
- indexcolname: str¶
Name for index column; NULL = default
- collation: tuple¶
Name of collation; NIL = default
- opclass: tuple¶
Name of desired opclass; NIL = default
- opclassopts: tuple¶
Opclass-specific options, or NIL
- nulls_ordering: SortByNulls¶
FIRST/LAST/default
- class pglast.ast.IndexStmt(idxname=None, relation=None, accessMethod=None, tableSpace=None, indexParams=None, indexIncludingParams=None, options=None, whereClause=None, excludeOpNames=None, idxcomment=None, oldNumber=None, oldCreateSubid=None, oldFirstRelfilelocatorSubid=None, unique=None, nulls_not_distinct=None, primary=None, isconstraint=None, deferrable=None, initdeferred=None, transformed=None, concurrent=None, if_not_exists=None, reset_default_tblspc=None)¶
Wrapper for the homonymous parser node.
- idxname: str¶
Name of new index, or NULL for default
- relation: RangeVar*¶
Relation to build index on
- accessMethod: str¶
Name of access method (eg. btree)
- tableSpace: str¶
Tablespace, or NULL for default
- indexParams: tuple¶
Columns to index: a list of IndexElem
- indexIncludingParams: tuple¶
Additional columns to index: a list of IndexElem
- options: tuple¶
WITH clause options: a list of DefElem
- excludeOpNames: tuple¶
Exclusion operator names, or NIL if none
- idxcomment: str¶
Comment to apply to index, or NULL
- oldNumber: RelFileNumber¶
Relfilenumber of existing storage, if any
- oldCreateSubid: SubTransactionId¶
Rd_createSubid of oldNumber
- oldFirstRelfilelocatorSubid: SubTransactionId¶
Rd_firstRelfilelocatorSubid of oldNumber
- unique: bool¶
Is index unique?
- nulls_not_distinct: bool¶
Null treatment for UNIQUE constraints
- primary: bool¶
Is index a primary key?
- isconstraint: bool¶
Is it for a pkey/unique constraint?
- deferrable: bool¶
Is the constraint DEFERRABLE?
- initdeferred: bool¶
Is the constraint INITIALLY DEFERRED?
- transformed: bool¶
True when transformIndexStmt is finished
- concurrent: bool¶
Should this be a concurrent index build?
- if_not_exists: bool¶
Just do nothing if index already exists?
- reset_default_tblspc: bool¶
Reset default_tablespace prior to executing
- class pglast.ast.InferClause(indexElems=None, whereClause=None, conname=None, location=None)¶
Wrapper for the homonymous parser node.
- indexElems: tuple¶
IndexElems to infer unique index
- conname: str¶
Constraint name, or NULL if unnamed
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.InferenceElem(expr=None)¶
Wrapper for the homonymous parser node.
- class pglast.ast.InlineCodeBlock(source_text=None, langIsTrusted=None, atomic=None)¶
Wrapper for the homonymous parser node.
- source_text: str¶
Source text of anonymous code block
- langIsTrusted: bool¶
Trusted property of the language
- atomic: bool¶
Atomic execution context
- class pglast.ast.InsertStmt(relation=None, cols=None, selectStmt=None, onConflictClause=None, returningList=None, withClause=None, override=None)¶
Wrapper for the homonymous parser node.
- relation: RangeVar*¶
Relation to insert into
- cols: tuple¶
Optional: names of the target columns
- onConflictClause: OnConflictClause*¶
ON CONFLICT clause
- returningList: tuple¶
List of expressions to return
- withClause: WithClause*¶
WITH clause
- override: OverridingKind¶
OVERRIDING clause
- class pglast.ast.Integer(ival=None)¶
Wrapper for the homonymous parser node.
- ival: long¶
- class pglast.ast.IntoClause(rel=None, colNames=None, accessMethod=None, options=None, onCommit=None, tableSpaceName=None, viewQuery=None, skipData=None)¶
Wrapper for the homonymous parser node.
- rel: RangeVar*¶
Target relation name
- colNames: tuple¶
Column names to assign, or NIL
- accessMethod: str¶
Table access method
- options: tuple¶
Options from WITH clause
- onCommit: OnCommitAction¶
What do we do at COMMIT?
- tableSpaceName: str¶
Table space to use, or NULL
- skipData: bool¶
True for WITH NO DATA
- class pglast.ast.JoinExpr(jointype=None, isNatural=None, larg=None, rarg=None, usingClause=None, join_using_alias=None, quals=None, alias=None, rtindex=None)¶
Wrapper for the homonymous parser node.
- isNatural: bool¶
Natural join? Will need to shape table
- usingClause: tuple¶
- join_using_alias: Alias*¶
- alias: Alias*¶
- rtindex: int¶
- class pglast.ast.JsonAggConstructor(output=None, agg_filter=None, agg_order=None, over=None, location=None)¶
Wrapper for the homonymous parser node.
- output: JsonOutput*¶
RETURNING clause, if any
- agg_order: tuple¶
ORDER BY clause, if any
- over: WindowDef*¶
OVER clause, if any
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.JsonArrayAgg(constructor=None, arg=None, absent_on_null=None)¶
Wrapper for the homonymous parser node.
- constructor: JsonAggConstructor*¶
Common fields
- arg: JsonValueExpr*¶
Array element expression
- absent_on_null: bool¶
Skip NULL elements?
- class pglast.ast.JsonArrayConstructor(exprs=None, output=None, absent_on_null=None, location=None)¶
Wrapper for the homonymous parser node.
- exprs: tuple¶
List of JsonValueExpr elements
- output: JsonOutput*¶
RETURNING clause, if specified
- absent_on_null: bool¶
Skip NULL elements?
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.JsonArrayQueryConstructor(query=None, output=None, format=None, absent_on_null=None, location=None)¶
Wrapper for the homonymous parser node.
- output: JsonOutput*¶
RETURNING clause, if specified
- format: JsonFormat*¶
FORMAT clause for subquery, if specified
- absent_on_null: bool¶
Skip NULL elements?
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.JsonConstructorExpr(type=None, args=None, func=None, coercion=None, returning=None, absent_on_null=None, unique=None, location=None)¶
Wrapper for the homonymous parser node.
- type: JsonConstructorType¶
Constructor type
- args: tuple¶
- func: Expr*¶
Underlying json[b]_xxx() function call
- coercion: Expr*¶
Coercion to RETURNING type
- returning: JsonReturning*¶
RETURNING clause
- absent_on_null: bool¶
ABSENT ON NULL?
- unique: bool¶
WITH UNIQUE KEYS? (JSON_OBJECT[AGG] only)
- location: int¶
- class pglast.ast.JsonFormat(format_type=None, encoding=None, location=None)¶
Wrapper for the homonymous parser node.
- format_type: JsonFormatType¶
Format type
- encoding: JsonEncoding¶
JSON encoding
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.JsonIsPredicate(expr=None, format=None, item_type=None, unique_keys=None, location=None)¶
Wrapper for the homonymous parser node.
- format: JsonFormat*¶
FORMAT clause, if specified
- item_type: JsonValueType¶
JSON item type
- unique_keys: bool¶
Check key uniqueness?
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.JsonKeyValue(key=None, value=None)¶
Wrapper for the homonymous parser node.
- key: Expr*¶
Key expression
- value: JsonValueExpr*¶
JSON value expression
- class pglast.ast.JsonObjectAgg(constructor=None, arg=None, absent_on_null=None, unique=None)¶
Wrapper for the homonymous parser node.
- constructor: JsonAggConstructor*¶
Common fields
- arg: JsonKeyValue*¶
Object key-value pair
- absent_on_null: bool¶
Skip NULL values?
- unique: bool¶
Check key uniqueness?
- class pglast.ast.JsonObjectConstructor(exprs=None, output=None, absent_on_null=None, unique=None, location=None)¶
Wrapper for the homonymous parser node.
- exprs: tuple¶
List of JsonKeyValue pairs
- output: JsonOutput*¶
RETURNING clause, if specified
- absent_on_null: bool¶
Skip NULL values?
- unique: bool¶
Check key uniqueness?
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.JsonOutput(typeName=None, returning=None)¶
Wrapper for the homonymous parser node.
- typeName: TypeName*¶
RETURNING type name, if specified
- returning: JsonReturning*¶
RETURNING FORMAT clause and type Oids
- class pglast.ast.JsonReturning(format=None, typmod=None)¶
Wrapper for the homonymous parser node.
- format: JsonFormat*¶
Output JSON format
- typmod: int32¶
Target type modifier
- class pglast.ast.JsonValueExpr(raw_expr=None, formatted_expr=None, format=None)¶
Wrapper for the homonymous parser node.
- raw_expr: Expr*¶
Raw expression
- formatted_expr: Expr*¶
Formatted expression
- format: JsonFormat*¶
FORMAT clause, if specified
- class pglast.ast.ListenStmt(conditionname=None)¶
Wrapper for the homonymous parser node.
- conditionname: str¶
Condition name to listen on
- class pglast.ast.LoadStmt(filename=None)¶
Wrapper for the homonymous parser node.
- filename: str¶
File to load
- class pglast.ast.LockStmt(relations=None, mode=None, nowait=None)¶
Wrapper for the homonymous parser node.
- relations: tuple¶
Relations to lock
- mode: int¶
Lock mode
- nowait: bool¶
No wait mode
- class pglast.ast.LockingClause(lockedRels=None, strength=None, waitPolicy=None)¶
Wrapper for the homonymous parser node.
- lockedRels: tuple¶
FOR [KEY] UPDATE/SHARE relations
- strength: LockClauseStrength¶
- waitPolicy: LockWaitPolicy¶
NOWAIT and SKIP LOCKED
- class pglast.ast.MergeAction(matched=None, commandType=None, override=None, qual=None, targetList=None, updateColnos=None)¶
Wrapper for the homonymous parser node.
- matched: bool¶
True=MATCHED, false=NOT MATCHED
- override: OverridingKind¶
- targetList: tuple¶
The target list (of TargetEntry)
- updateColnos: tuple¶
- class pglast.ast.MergeStmt(relation=None, sourceRelation=None, joinCondition=None, mergeWhenClauses=None, withClause=None)¶
Wrapper for the homonymous parser node.
- relation: RangeVar*¶
Target relation to merge into
- mergeWhenClauses: tuple¶
List of MergeWhenClause(es)
- withClause: WithClause*¶
WITH clause
- class pglast.ast.MergeWhenClause(matched=None, commandType=None, override=None, condition=None, targetList=None, values=None)¶
Wrapper for the homonymous parser node.
- matched: bool¶
True=MATCHED, false=NOT MATCHED
- override: OverridingKind¶
OVERRIDING clause
- targetList: tuple¶
INSERT/UPDATE targetlist
- values: tuple¶
VALUES to INSERT, or NULL
- class pglast.ast.MinMaxExpr(op=None, args=None, location=None)¶
Wrapper for the homonymous parser node.
- args: tuple¶
- location: int¶
- class pglast.ast.MultiAssignRef(source=None, colno=None, ncolumns=None)¶
Wrapper for the homonymous parser node.
- colno: int¶
Column number for this target (1..n)
- ncolumns: int¶
Number of targets in the construct
- class pglast.ast.NamedArgExpr(arg=None, name=None, argnumber=None, location=None)¶
Wrapper for the homonymous parser node.
- arg: Expr*¶
- name: str¶
- argnumber: int¶
- location: int¶
- class pglast.ast.NotifyStmt(conditionname=None, payload=None)¶
Wrapper for the homonymous parser node.
- conditionname: str¶
Condition name to notify
- payload: str¶
The payload string, or NULL if none
- class pglast.ast.NullTest(arg=None, nulltesttype=None, argisrow=None, location=None)¶
Wrapper for the homonymous parser node.
- arg: Expr*¶
Input expression
- nulltesttype: NullTestType¶
IS NULL, IS NOT NULL
- argisrow: bool¶
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.ObjectWithArgs(objname=None, objargs=None, objfuncargs=None, args_unspecified=None)¶
Wrapper for the homonymous parser node.
- objname: tuple¶
Qualified name of function/operator
- objargs: tuple¶
List of Typename nodes (input args only)
- objfuncargs: tuple¶
List of FunctionParameter nodes
- args_unspecified: bool¶
Argument list was omitted?
- class pglast.ast.OnConflictClause(action=None, infer=None, targetList=None, whereClause=None, location=None)¶
Wrapper for the homonymous parser node.
- action: OnConflictAction¶
DO NOTHING or UPDATE?
- infer: InferClause*¶
Optional index inference clause
- targetList: tuple¶
The target list (of ResTarget)
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.OnConflictExpr(action=None, arbiterElems=None, arbiterWhere=None, onConflictSet=None, onConflictWhere=None, exclRelIndex=None, exclRelTlist=None)¶
Wrapper for the homonymous parser node.
- action: OnConflictAction¶
DO NOTHING or UPDATE?
- arbiterElems: tuple¶
Unique index arbiter list (of InferenceElem’s)
- onConflictSet: tuple¶
List of ON CONFLICT SET TargetEntrys
- exclRelIndex: int¶
RT index of ‘excluded’ relation
- exclRelTlist: tuple¶
Tlist of the EXCLUDED pseudo relation
- class pglast.ast.OpExpr(opretset=None, args=None, location=None)¶
Wrapper for the homonymous parser node.
- opretset: bool¶
- args: tuple¶
- location: int¶
- class pglast.ast.PLAssignStmt(name=None, indirection=None, nnames=None, val=None, location=None)¶
Wrapper for the homonymous parser node.
- name: str¶
Initial column name
- indirection: tuple¶
Subscripts and field names, if any
- nnames: int¶
Number of names to use in ColumnRef
- val: SelectStmt*¶
The PL/pgSQL expression to assign
- location: int¶
Name’s token location, or -1 if unknown
- class pglast.ast.Param(paramkind=None, paramid=None, paramtypmod=None, location=None)¶
Wrapper for the homonymous parser node.
- paramid: int¶
Numeric ID for parameter
- paramtypmod: int32¶
- location: int¶
- class pglast.ast.ParamRef(number=None, location=None)¶
Wrapper for the homonymous parser node.
- number: int¶
The number of the parameter
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.PartitionBoundSpec(strategy=None, is_default=None, modulus=None, remainder=None, listdatums=None, lowerdatums=None, upperdatums=None, location=None)¶
Wrapper for the homonymous parser node.
- strategy: str¶
See PARTITION_STRATEGY codes above
- is_default: bool¶
Is it a default partition bound?
- modulus: int¶
- remainder: int¶
- listdatums: tuple¶
List of Consts (or A_Consts in raw tree)
- lowerdatums: tuple¶
List of PartitionRangeDatums
- upperdatums: tuple¶
List of PartitionRangeDatums
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.PartitionCmd(name=None, bound=None, concurrent=None)¶
Wrapper for the homonymous parser node.
- name: RangeVar*¶
Name of partition to attach/detach
- bound: PartitionBoundSpec*¶
FOR VALUES, if attaching
- concurrent: bool¶
- class pglast.ast.PartitionElem(name=None, expr=None, collation=None, opclass=None, location=None)¶
Wrapper for the homonymous parser node.
- name: str¶
Name of column to partition on, or NULL
- collation: tuple¶
Name of collation; NIL = default
- opclass: tuple¶
Name of desired opclass; NIL = default
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.PartitionRangeDatum(kind=None, value=None, location=None)¶
Wrapper for the homonymous parser node.
- kind: PartitionRangeDatumKind¶
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.PartitionSpec(strategy=None, partParams=None, location=None)¶
Wrapper for the homonymous parser node.
- strategy: PartitionStrategy¶
- partParams: tuple¶
List of PartitionElems
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.PrepareStmt(name=None, argtypes=None, query=None)¶
Wrapper for the homonymous parser node.
- name: str¶
Name of plan, arbitrary
- argtypes: tuple¶
Types of parameters (List of TypeName)
- class pglast.ast.PublicationObjSpec(pubobjtype=None, name=None, pubtable=None, location=None)¶
Wrapper for the homonymous parser node.
- pubobjtype: PublicationObjSpecType¶
Type of this publication object
- name: str¶
- pubtable: PublicationTable*¶
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.PublicationTable(relation=None, whereClause=None, columns=None)¶
Wrapper for the homonymous parser node.
- relation: RangeVar*¶
Relation to be published
- columns: tuple¶
List of columns in a publication table
- class pglast.ast.Query(commandType=None, querySource=None, canSetTag=None, utilityStmt=None, resultRelation=None, hasAggs=None, hasWindowFuncs=None, hasTargetSRFs=None, hasSubLinks=None, hasDistinctOn=None, hasRecursive=None, hasModifyingCTE=None, hasForUpdate=None, hasRowSecurity=None, isReturn=None, cteList=None, rtable=None, rteperminfos=None, jointree=None, mergeActionList=None, mergeUseOuterJoin=None, targetList=None, override=None, onConflict=None, returningList=None, groupClause=None, groupDistinct=None, groupingSets=None, havingQual=None, windowClause=None, distinctClause=None, sortClause=None, limitOffset=None, limitCount=None, limitOption=None, rowMarks=None, setOperations=None, constraintDeps=None, withCheckOptions=None, stmt_location=None, stmt_len=None)¶
Wrapper for the homonymous parser node.
- querySource: QuerySource¶
- canSetTag: bool¶
- resultRelation: int¶
- hasAggs: bool¶
- hasWindowFuncs: bool¶
- hasTargetSRFs: bool¶
- hasSubLinks: bool¶
- hasDistinctOn: bool¶
- hasRecursive: bool¶
- hasModifyingCTE: bool¶
- hasForUpdate: bool¶
- hasRowSecurity: bool¶
- isReturn: bool¶
- cteList: tuple¶
WITH list (of CommonTableExpr’s)
- rtable: tuple¶
List of range table entries
- rteperminfos: tuple¶
- jointree: FromExpr*¶
Table join tree (FROM and WHERE clauses); also USING clause for MERGE
- mergeActionList: tuple¶
List of actions for MERGE (only)
- mergeUseOuterJoin: bool¶
- targetList: tuple¶
Target list (of TargetEntry)
- override: OverridingKind¶
- onConflict: OnConflictExpr*¶
ON CONFLICT DO [NOTHING | UPDATE]
- returningList: tuple¶
Return-values list (of TargetEntry)
- groupClause: tuple¶
A list of SortGroupClause’s
- groupDistinct: bool¶
Is the group by clause distinct?
- groupingSets: tuple¶
A list of GroupingSet’s if present
- windowClause: tuple¶
A list of WindowClause’s
- distinctClause: tuple¶
A list of SortGroupClause’s
- sortClause: tuple¶
A list of SortGroupClause’s
- limitOption: LimitOption¶
Limit type
- rowMarks: tuple¶
A list of RowMarkClause’s
- constraintDeps: tuple¶
- withCheckOptions: tuple¶
- stmt_location: int¶
- stmt_len: int¶
- class pglast.ast.RTEPermissionInfo(inh=None, requiredPerms=None, selectedCols=None, insertedCols=None, updatedCols=None)¶
Wrapper for the homonymous parser node.
- inh: bool¶
Separately check inheritance children?
- requiredPerms: AclMode¶
Bitmask of required access permissions
- selectedCols: Bitmapset*¶
Columns needing SELECT permission
- insertedCols: Bitmapset*¶
Columns needing INSERT permission
- updatedCols: Bitmapset*¶
Columns needing UPDATE permission
- class pglast.ast.RangeFunction(lateral=None, ordinality=None, is_rowsfrom=None, functions=None, alias=None, coldeflist=None)¶
Wrapper for the homonymous parser node.
- lateral: bool¶
Does it have LATERAL prefix?
- ordinality: bool¶
Does it have WITH ORDINALITY suffix?
- is_rowsfrom: bool¶
Is result of ROWS FROM() syntax?
- functions: tuple¶
Per-function information, see above
- alias: Alias*¶
Table alias & optional column aliases
- coldeflist: tuple¶
List of ColumnDef nodes to describe result of function returning RECORD
- class pglast.ast.RangeSubselect(lateral=None, subquery=None, alias=None)¶
Wrapper for the homonymous parser node.
- lateral: bool¶
Does it have LATERAL prefix?
- alias: Alias*¶
Table alias & optional column aliases
- class pglast.ast.RangeTableFunc(lateral=None, docexpr=None, rowexpr=None, namespaces=None, columns=None, alias=None, location=None)¶
Wrapper for the homonymous parser node.
- lateral: bool¶
Does it have LATERAL prefix?
- namespaces: tuple¶
List of namespaces as ResTarget
- columns: tuple¶
List of RangeTableFuncCol
- alias: Alias*¶
Table alias & optional column aliases
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.RangeTableFuncCol(colname=None, typeName=None, for_ordinality=None, is_not_null=None, colexpr=None, coldefexpr=None, location=None)¶
Wrapper for the homonymous parser node.
- colname: str¶
Name of generated column
- typeName: TypeName*¶
Type of generated column
- for_ordinality: bool¶
Does it have FOR ORDINALITY?
- is_not_null: bool¶
Does it have NOT NULL?
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.RangeTableSample(relation=None, method=None, args=None, repeatable=None, location=None)¶
Wrapper for the homonymous parser node.
- method: tuple¶
Sampling method name (possibly qualified)
- args: tuple¶
Argument(s) for sampling method
- location: int¶
Method name location, or -1 if unknown
- class pglast.ast.RangeTblEntry(rtekind=None, relkind=None, rellockmode=None, tablesample=None, perminfoindex=None, subquery=None, security_barrier=None, jointype=None, joinmergedcols=None, joinaliasvars=None, joinleftcols=None, joinrightcols=None, join_using_alias=None, functions=None, funcordinality=None, tablefunc=None, values_lists=None, ctename=None, ctelevelsup=None, self_reference=None, coltypes=None, coltypmods=None, colcollations=None, enrname=None, enrtuples=None, alias=None, eref=None, lateral=None, inh=None, inFromCl=None, securityQuals=None)¶
Wrapper for the homonymous parser node.
- relkind: str¶
Relation kind (see pg_class.relkind)
- rellockmode: int¶
Lock level that query requires on the rel
- tablesample: TableSampleClause*¶
Sampling info, or NULL
- perminfoindex: Index¶
- subquery: Query*¶
The sub-query
- security_barrier: bool¶
Is from security_barrier view?
- joinmergedcols: int¶
Number of merged (JOIN USING) columns
- joinaliasvars: tuple¶
List of alias-var expansions
- joinleftcols: tuple¶
Left-side input column numbers
- joinrightcols: tuple¶
Right-side input column numbers
- join_using_alias: Alias*¶
- functions: tuple¶
List of RangeTblFunction nodes
- funcordinality: bool¶
Is this called WITH ORDINALITY?
- tablefunc: TableFunc*¶
- values_lists: tuple¶
List of expression lists
- ctename: str¶
Name of the WITH list item
- ctelevelsup: Index¶
Number of query levels up
- self_reference: bool¶
Is this a recursive self-reference?
- coltypes: tuple¶
OID list of column type OIDs
- coltypmods: tuple¶
Integer list of column typmods
- colcollations: tuple¶
OID list of column collation OIDs
- enrname: str¶
Name of ephemeral named relation
- enrtuples: Cardinality¶
Estimated or actual from caller
- alias: Alias*¶
User-written alias clause, if any
- eref: Alias*¶
Expanded reference names
- lateral: bool¶
Subquery, function, or values is LATERAL?
- inh: bool¶
Inheritance requested?
- inFromCl: bool¶
Present in FROM clause?
- securityQuals: tuple¶
Security barrier quals to apply, if any
- class pglast.ast.RangeTblFunction(funcexpr=None, funccolcount=None, funccolnames=None, funccoltypes=None, funccoltypmods=None, funccolcollations=None, funcparams=None)¶
Wrapper for the homonymous parser node.
- funccolcount: int¶
- funccolnames: tuple¶
- funccoltypes: tuple¶
- funccoltypmods: tuple¶
- funccolcollations: tuple¶
- funcparams: Bitmapset*¶
- class pglast.ast.RangeTblRef(rtindex=None)¶
Wrapper for the homonymous parser node.
- rtindex: int¶
- class pglast.ast.RangeVar(catalogname=None, schemaname=None, relname=None, inh=None, relpersistence=None, alias=None, location=None)¶
Wrapper for the homonymous parser node.
- catalogname: str¶
- schemaname: str¶
- relname: str¶
- inh: bool¶
- relpersistence: str¶
- alias: Alias*¶
- location: int¶
- class pglast.ast.RawStmt(stmt=None, stmt_location=None, stmt_len=None)¶
Wrapper for the homonymous parser node.
- stmt_location: int¶
Start location, or -1 if unknown
- stmt_len: int¶
Length in bytes; 0 means “rest of string”
- class pglast.ast.ReassignOwnedStmt(roles=None, newrole=None)¶
Wrapper for the homonymous parser node.
- roles: tuple¶
- newrole: RoleSpec*¶
- class pglast.ast.RefreshMatViewStmt(concurrent=None, skipData=None, relation=None)¶
Wrapper for the homonymous parser node.
- concurrent: bool¶
Allow concurrent access?
- skipData: bool¶
True for WITH NO DATA
- relation: RangeVar*¶
Relation to insert into
- class pglast.ast.ReindexStmt(kind=None, relation=None, name=None, params=None)¶
Wrapper for the homonymous parser node.
- kind: ReindexObjectType¶
REINDEX_OBJECT_INDEX, REINDEX_OBJECT_TABLE, etc.
- relation: RangeVar*¶
Table or index to reindex
- name: str¶
Name of database to reindex
- params: tuple¶
List of DefElem nodes
- class pglast.ast.RelabelType(arg=None, resulttypmod=None, relabelformat=None, location=None)¶
Wrapper for the homonymous parser node.
- arg: Expr*¶
Input expression
- resulttypmod: int32¶
- relabelformat: CoercionForm¶
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.RenameStmt(renameType=None, relationType=None, relation=None, object=None, subname=None, newname=None, behavior=None, missing_ok=None)¶
Wrapper for the homonymous parser node.
- renameType: ObjectType¶
OBJECT_TABLE, OBJECT_COLUMN, etc
- relationType: ObjectType¶
If column name, associated relation type
- relation: RangeVar*¶
In case it’s a table
- subname: str¶
Name of contained object (column, rule, trigger, etc)
- newname: str¶
The new name
- behavior: DropBehavior¶
RESTRICT or CASCADE behavior
- missing_ok: bool¶
Skip error if missing?
- class pglast.ast.ReplicaIdentityStmt(identity_type=None, name=None)¶
Wrapper for the homonymous parser node.
- identity_type: str¶
- name: str¶
- class pglast.ast.ResTarget(name=None, indirection=None, val=None, location=None)¶
Wrapper for the homonymous parser node.
- name: str¶
Column name or NULL
- indirection: tuple¶
Subscripts, field names, and ‘*’, or NIL
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.ReturnStmt(returnval=None)¶
Wrapper for the homonymous parser node.
- class pglast.ast.RoleSpec(roletype=None, rolename=None, location=None)¶
Wrapper for the homonymous parser node.
- roletype: RoleSpecType¶
Type of this rolespec
- rolename: str¶
Filled only for ROLESPEC_CSTRING
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.RowCompareExpr(rctype=None, opnos=None, opfamilies=None, inputcollids=None, largs=None, rargs=None)¶
Wrapper for the homonymous parser node.
- rctype: RowCompareType¶
- opnos: tuple¶
- opfamilies: tuple¶
- inputcollids: tuple¶
- largs: tuple¶
- rargs: tuple¶
- class pglast.ast.RowExpr(args=None, row_format=None, colnames=None, location=None)¶
Wrapper for the homonymous parser node.
- args: tuple¶
The fields
- row_format: CoercionForm¶
- colnames: tuple¶
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.RowMarkClause(rti=None, strength=None, waitPolicy=None, pushedDown=None)¶
Wrapper for the homonymous parser node.
- rti: Index¶
Range table index of target relation
- strength: LockClauseStrength¶
- waitPolicy: LockWaitPolicy¶
NOWAIT and SKIP LOCKED
- pushedDown: bool¶
Pushed down from higher query level?
- class pglast.ast.RuleStmt(relation=None, rulename=None, whereClause=None, event=None, instead=None, actions=None, replace=None)¶
Wrapper for the homonymous parser node.
- relation: RangeVar*¶
Relation the rule is for
- rulename: str¶
Name of the rule
- instead: bool¶
Is a ‘do instead’?
- actions: tuple¶
The action statements
- replace: bool¶
OR REPLACE
- class pglast.ast.SQLValueFunction(op=None, typmod=None, location=None)¶
Wrapper for the homonymous parser node.
- op: SQLValueFunctionOp¶
Which function this is
- typmod: int32¶
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.ScalarArrayOpExpr(useOr=None, args=None, location=None)¶
Wrapper for the homonymous parser node.
- useOr: bool¶
- args: tuple¶
- location: int¶
- class pglast.ast.SecLabelStmt(objtype=None, object=None, provider=None, label=None)¶
Wrapper for the homonymous parser node.
- objtype: ObjectType¶
Object’s type
- provider: str¶
Label provider (or NULL)
- label: str¶
New security label to be assigned
- class pglast.ast.SelectStmt(distinctClause=None, intoClause=None, targetList=None, fromClause=None, whereClause=None, groupClause=None, groupDistinct=None, havingClause=None, windowClause=None, valuesLists=None, sortClause=None, limitOffset=None, limitCount=None, limitOption=None, lockingClause=None, withClause=None, op=None, all=None, larg=None, rarg=None)¶
Wrapper for the homonymous parser node.
- distinctClause: tuple¶
NULL, list of DISTINCT ON exprs, or lcons(NIL,NIL) for all (SELECT DISTINCT)
- intoClause: IntoClause*¶
Target for SELECT INTO
- targetList: tuple¶
The target list (of ResTarget)
- fromClause: tuple¶
The FROM clause
- groupClause: tuple¶
GROUP BY clauses
- groupDistinct: bool¶
Is this GROUP BY DISTINCT?
- windowClause: tuple¶
WINDOW window_name AS (…), …
- valuesLists: tuple¶
Untransformed list of expression lists
- sortClause: tuple¶
Sort clause (a list of SortBy’s)
- limitOption: LimitOption¶
Limit type
- lockingClause: tuple¶
FOR UPDATE (list of LockingClause’s)
- withClause: WithClause*¶
WITH clause
- op: SetOperation¶
Type of set op
- all: bool¶
ALL specified?
- larg: SelectStmt*¶
Left child
- rarg: SelectStmt*¶
Right child
- class pglast.ast.SetOperationStmt(op=None, all=None, larg=None, rarg=None, colTypes=None, colTypmods=None, colCollations=None, groupClauses=None)¶
Wrapper for the homonymous parser node.
- op: SetOperation¶
Type of set op
- all: bool¶
ALL specified?
- colTypes: tuple¶
- colTypmods: tuple¶
- colCollations: tuple¶
- groupClauses: tuple¶
- class pglast.ast.SetToDefault(typeMod=None, location=None)¶
Wrapper for the homonymous parser node.
- typeMod: int32¶
- location: int¶
- class pglast.ast.SortBy(node=None, sortby_dir=None, sortby_nulls=None, useOp=None, location=None)¶
Wrapper for the homonymous parser node.
- sortby_nulls: SortByNulls¶
NULLS FIRST/LAST
- useOp: tuple¶
Name of op to use, if SORTBY_USING
- location: int¶
Operator location, or -1 if none/unknown
- class pglast.ast.SortGroupClause(tleSortGroupRef=None, nulls_first=None, hashable=None)¶
Wrapper for the homonymous parser node.
- tleSortGroupRef: Index¶
Reference into targetlist
- nulls_first: bool¶
Do NULLs come before normal values?
- hashable: bool¶
- class pglast.ast.StatsElem(name=None, expr=None)¶
Wrapper for the homonymous parser node.
- name: str¶
Name of attribute to index, or NULL
- class pglast.ast.String(sval=None)¶
Wrapper for the homonymous parser node.
- sval: str¶
- class pglast.ast.SubLink(subLinkType=None, subLinkId=None, testexpr=None, operName=None, subselect=None, location=None)¶
Wrapper for the homonymous parser node.
- subLinkType: SubLinkType¶
- subLinkId: int¶
ID (1..n); 0 if not MULTIEXPR
- operName: tuple¶
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.SubPlan(subLinkType=None, testexpr=None, paramIds=None, plan_id=None, plan_name=None, firstColTypmod=None, useHashTable=None, unknownEqFalse=None, parallel_safe=None, setParam=None, parParam=None, args=None, startup_cost=None, per_call_cost=None)¶
Wrapper for the homonymous parser node.
- subLinkType: SubLinkType¶
- paramIds: tuple¶
IDs of Params embedded in the above
- plan_id: int¶
Index (from 1) in PlannedStmt.subplans
- plan_name: str¶
A name assigned during planning
- firstColTypmod: int32¶
Typmod of first column of subplan result
- useHashTable: bool¶
True to store subselect output in a hash table (implies we are doing “IN”)
- unknownEqFalse: bool¶
True if it’s okay to return FALSE when the spec result is UNKNOWN; this allows much simpler handling of null values
- parallel_safe: bool¶
Is the subplan parallel-safe?
- setParam: tuple¶
Initplan and MULTIEXPR subqueries have to set these Params for parent plan
- parParam: tuple¶
Indices of input Params from parent plan
- args: tuple¶
Exprs to pass as parParam values
- startup_cost: Cost¶
One-time setup cost
- per_call_cost: Cost¶
Cost for each subplan evaluation
- class pglast.ast.SubscriptingRef(reftypmod=None, refupperindexpr=None, reflowerindexpr=None, refexpr=None, refassgnexpr=None)¶
Wrapper for the homonymous parser node.
- reftypmod: int32¶
- refupperindexpr: tuple¶
- reflowerindexpr: tuple¶
- refexpr: Expr*¶
- refassgnexpr: Expr*¶
- class pglast.ast.TableFunc(ns_uris=None, ns_names=None, docexpr=None, rowexpr=None, colnames=None, coltypes=None, coltypmods=None, colcollations=None, colexprs=None, coldefexprs=None, notnulls=None, ordinalitycol=None, location=None)¶
Wrapper for the homonymous parser node.
- ns_uris: tuple¶
- ns_names: tuple¶
- colnames: tuple¶
- coltypes: tuple¶
- coltypmods: tuple¶
- colcollations: tuple¶
- colexprs: tuple¶
- coldefexprs: tuple¶
- notnulls: Bitmapset*¶
- ordinalitycol: int¶
- location: int¶
- class pglast.ast.TableLikeClause(relation=None, options=None)¶
Wrapper for the homonymous parser node.
- relation: RangeVar*¶
- options: bits32¶
OR of TableLikeOption flags
- class pglast.ast.TableSampleClause(args=None, repeatable=None)¶
Wrapper for the homonymous parser node.
- args: tuple¶
Tablesample argument expression(s)
- repeatable: Expr*¶
REPEATABLE expression, or NULL if none
- class pglast.ast.TargetEntry(expr=None, resno=None, resname=None, ressortgroupref=None, resorigcol=None, resjunk=None)¶
Wrapper for the homonymous parser node.
- expr: Expr*¶
- resno: AttrNumber¶
- resname: str¶
- ressortgroupref: Index¶
- resorigcol: AttrNumber¶
- resjunk: bool¶
- class pglast.ast.TransactionStmt(kind=None, options=None, savepoint_name=None, gid=None, chain=None)¶
Wrapper for the homonymous parser node.
- kind: TransactionStmtKind¶
- options: tuple¶
For BEGIN/START commands
- savepoint_name: str¶
For savepoint commands
- gid: str¶
For two-phase-commit related commands
- chain: bool¶
AND CHAIN option
- class pglast.ast.TriggerTransition(name=None, isNew=None, isTable=None)¶
Wrapper for the homonymous parser node.
- name: str¶
- isNew: bool¶
- isTable: bool¶
- class pglast.ast.TruncateStmt(relations=None, restart_seqs=None, behavior=None)¶
Wrapper for the homonymous parser node.
- relations: tuple¶
Relations (RangeVars) to be truncated
- restart_seqs: bool¶
Restart owned sequences?
- behavior: DropBehavior¶
RESTRICT or CASCADE behavior
- class pglast.ast.TypeCast(arg=None, typeName=None, location=None)¶
Wrapper for the homonymous parser node.
- typeName: TypeName*¶
The target type
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.TypeName(names=None, setof=None, pct_type=None, typmods=None, typemod=None, arrayBounds=None, location=None)¶
Wrapper for the homonymous parser node.
- names: tuple¶
Qualified name (list of String nodes)
- setof: bool¶
Is a set?
- pct_type: bool¶
%TYPE specified?
- typmods: tuple¶
Type modifier expression(s)
- typemod: int32¶
Prespecified type modifier
- arrayBounds: tuple¶
Array bounds
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.UnlistenStmt(conditionname=None)¶
Wrapper for the homonymous parser node.
- conditionname: str¶
Name to unlisten on, or NULL for all
- class pglast.ast.UpdateStmt(relation=None, targetList=None, whereClause=None, fromClause=None, returningList=None, withClause=None)¶
Wrapper for the homonymous parser node.
- relation: RangeVar*¶
Relation to update
- targetList: tuple¶
The target list (of ResTarget)
- fromClause: tuple¶
Optional from clause for more tables
- returningList: tuple¶
List of expressions to return
- withClause: WithClause*¶
WITH clause
- class pglast.ast.VacuumRelation(relation=None, va_cols=None)¶
Wrapper for the homonymous parser node.
- relation: RangeVar*¶
Table name to process, or NULL
- va_cols: tuple¶
List of column names, or NIL for all
- class pglast.ast.VacuumStmt(options=None, rels=None, is_vacuumcmd=None)¶
Wrapper for the homonymous parser node.
- options: tuple¶
List of DefElem nodes
- rels: tuple¶
List of VacuumRelation, or NIL for all
- is_vacuumcmd: bool¶
True for VACUUM, false for ANALYZE
- class pglast.ast.Var(varno=None, varattno=None, vartypmod=None, varnullingrels=None, varlevelsup=None, location=None)¶
Wrapper for the homonymous parser node.
- varno: int¶
- varattno: AttrNumber¶
- vartypmod: int32¶
- varnullingrels: Bitmapset*¶
- varlevelsup: Index¶
- location: int¶
- class pglast.ast.VariableSetStmt(kind=None, name=None, args=None, is_local=None)¶
Wrapper for the homonymous parser node.
- kind: VariableSetKind¶
- name: str¶
Variable to be set
- args: tuple¶
List of A_Const nodes
- is_local: bool¶
SET LOCAL?
- class pglast.ast.VariableShowStmt(name=None)¶
Wrapper for the homonymous parser node.
- name: str¶
- class pglast.ast.ViewStmt(view=None, aliases=None, query=None, replace=None, options=None, withCheckOption=None)¶
Wrapper for the homonymous parser node.
- view: RangeVar*¶
The view to be created
- aliases: tuple¶
Target column names
- replace: bool¶
Replace an existing view?
- options: tuple¶
Options from WITH clause
- withCheckOption: ViewCheckOption¶
WITH CHECK OPTION
- class pglast.ast.WindowClause(name=None, refname=None, partitionClause=None, orderClause=None, frameOptions=None, startOffset=None, endOffset=None, runCondition=None, inRangeAsc=None, inRangeNullsFirst=None, winref=None, copiedOrder=None)¶
Wrapper for the homonymous parser node.
- name: str¶
- refname: str¶
- partitionClause: tuple¶
PARTITION BY list
- orderClause: tuple¶
- frameOptions: int¶
Frame_clause options, see WindowDef
- runCondition: tuple¶
- inRangeAsc: bool¶
- inRangeNullsFirst: bool¶
- winref: Index¶
ID referenced by window functions
- copiedOrder: bool¶
- class pglast.ast.WindowDef(name=None, refname=None, partitionClause=None, orderClause=None, frameOptions=None, startOffset=None, endOffset=None, location=None)¶
Wrapper for the homonymous parser node.
- name: str¶
Window’s own name
- refname: str¶
Referenced window name, if any
- partitionClause: tuple¶
PARTITION BY expression list
- orderClause: tuple¶
ORDER BY (list of SortBy)
- frameOptions: int¶
Frame_clause options, see below
- location: int¶
Parse location, or -1 if none/unknown
- class pglast.ast.WindowFunc(args=None, aggfilter=None, winref=None, winstar=None, winagg=None, location=None)¶
Wrapper for the homonymous parser node.
- args: tuple¶
- aggfilter: Expr*¶
- winref: Index¶
- winstar: bool¶
- winagg: bool¶
- location: int¶
- class pglast.ast.WithCheckOption(kind=None, relname=None, polname=None, qual=None, cascaded=None)¶
Wrapper for the homonymous parser node.
- relname: str¶
Name of relation that specified the WCO
- polname: str¶
Name of RLS policy being checked
- cascaded: bool¶
True for a cascaded WCO on a view
- class pglast.ast.WithClause(ctes=None, recursive=None, location=None)¶
Wrapper for the homonymous parser node.
- ctes: tuple¶
List of CommonTableExprs
- recursive: bool¶
True = WITH RECURSIVE
- location: int¶
Token location, or -1 if unknown
- class pglast.ast.XmlExpr(op=None, name=None, named_args=None, arg_names=None, args=None, xmloption=None, indent=None, typmod=None, location=None)¶
Wrapper for the homonymous parser node.
- name: str¶
- named_args: tuple¶
- arg_names: tuple¶
- args: tuple¶
- xmloption: XmlOptionType¶
- indent: bool¶
- typmod: int32¶
- location: int¶
- class pglast.ast.XmlSerialize(xmloption=None, expr=None, typeName=None, indent=None, location=None)¶
Wrapper for the homonymous parser node.
- xmloption: XmlOptionType¶
DOCUMENT or CONTENT
- typeName: TypeName*¶
- indent: bool¶
[NO] INDENT
- location: int¶
Token location, or -1 if unknown