diff --git a/Makefile b/Makefile index 7443d23..d503a75 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,7 @@ build: $(VENVDIR)/libpg_query.hash build: $(VENVDIR)/extension.timestamp build: enums build: keywords +build: type-stubs build: printers-doc FORCE: @@ -93,62 +94,93 @@ distclean:: clean help:: @printf "enums\n\textract Python enums from PG sources\n" -PY_ENUMS := $(shell ls pglast/enums/*.py) +PY_ENUMS := $(filter-out pglast/enums/__init__.py,$(shell ls pglast/enums/*.py)) +PY_ENUM_STUBS := $(PY_ENUMS:.py=.pyi) PG_INCLUDE_DIR := libpg_query/src/postgres/include .PHONY: enums enums: $(PY_ENUMS) -$(PY_ENUMS): tools/extract_enums.py -$(PY_ENUMS): libpg_query/libpg_query.a -$(PY_ENUMS): $(VENVDIR)/libpg_query.hash +$(PY_ENUMS) $(PY_ENUM_STUBS): tools/extract_enums.py +$(PY_ENUMS) $(PY_ENUM_STUBS): libpg_query/libpg_query.a +$(PY_ENUMS) $(PY_ENUM_STUBS): $(VENVDIR)/libpg_query.hash -define extract_enums = -$(PYTHON) tools/extract_enums.py -I $(PG_INCLUDE_DIR) $< $@ docs/$(basename $(notdir $@)).rst +define extract_enums +$(PYTHON) tools/extract_enums.py -I $(PG_INCLUDE_DIR) $< $(basename $@).py docs/$(basename $(notdir $@)).rst endef -pglast/enums/%.py: $(PG_INCLUDE_DIR)/nodes/%.h +pglast/enums/%.py pglast/enums/%.pyi: $(PG_INCLUDE_DIR)/nodes/%.h $(extract_enums) -pglast/enums/lockdefs.py: $(PG_INCLUDE_DIR)/storage/lockdefs.h +pglast/enums/lockdefs.py pglast/enums/lockdefs.pyi: $(PG_INCLUDE_DIR)/storage/lockdefs.h $(extract_enums) -pglast/enums/pg_am.py: $(PG_INCLUDE_DIR)/catalog/pg_am.h +pglast/enums/pg_am.py pglast/enums/pg_am.pyi: $(PG_INCLUDE_DIR)/catalog/pg_am.h $(extract_enums) -pglast/enums/pg_attribute.py: $(PG_INCLUDE_DIR)/catalog/pg_attribute.h +pglast/enums/pg_attribute.py pglast/enums/pg_attribute.pyi: $(PG_INCLUDE_DIR)/catalog/pg_attribute.h $(extract_enums) -pglast/enums/pg_class.py: $(PG_INCLUDE_DIR)/catalog/pg_class.h +pglast/enums/pg_class.py pglast/enums/pg_class.pyi: $(PG_INCLUDE_DIR)/catalog/pg_class.h $(extract_enums) -pglast/enums/pg_trigger.py: $(PG_INCLUDE_DIR)/catalog/pg_trigger.h +pglast/enums/pg_trigger.py pglast/enums/pg_trigger.pyi: $(PG_INCLUDE_DIR)/catalog/pg_trigger.h $(extract_enums) -pglast/enums/xml.py: $(PG_INCLUDE_DIR)/utils/xml.h +pglast/enums/xml.py pglast/enums/xml.pyi: $(PG_INCLUDE_DIR)/utils/xml.h $(extract_enums) -pglast/enums/cmptype.py: $(PG_INCLUDE_DIR)/access/cmptype.h +pglast/enums/cmptype.py pglast/enums/cmptype.pyi: $(PG_INCLUDE_DIR)/access/cmptype.h $(extract_enums) help:: @printf "keywords\n\textract Python keyword sets from PG sources\n" PY_KEYWORDS := pglast/keywords.py +PY_KEYWORD_STUBS := pglast/keywords.pyi .PHONY: keywords keywords: $(PY_KEYWORDS) -$(PY_KEYWORDS): tools/extract_keywords.py -$(PY_KEYWORDS): libpg_query/libpg_query.a -$(PY_KEYWORDS): $(VENVDIR)/libpg_query.hash -$(PY_KEYWORDS): $(PG_INCLUDE_DIR)/parser/kwlist.h - $(PYTHON) tools/extract_keywords.py $(PG_INCLUDE_DIR)/parser/kwlist.h $@ +$(PY_KEYWORDS) $(PY_KEYWORD_STUBS): tools/extract_keywords.py +$(PY_KEYWORDS) $(PY_KEYWORD_STUBS): libpg_query/libpg_query.a +$(PY_KEYWORDS) $(PY_KEYWORD_STUBS): $(VENVDIR)/libpg_query.hash +$(PY_KEYWORDS) $(PY_KEYWORD_STUBS): $(PG_INCLUDE_DIR)/parser/kwlist.h + $(PYTHON) tools/extract_keywords.py $(PG_INCLUDE_DIR)/parser/kwlist.h $(PY_KEYWORDS) pglast/ast.pyx: tools/extract_ast.py libpg_query/srcdata/struct_defs.json pglast/ast.pyx: $(PY_ENUMS) $(PYTHON) tools/extract_ast.py pglast/ docs/ast.rst +pglast/ast.pyi: tools/extract_ast.py libpg_query/srcdata/struct_defs.json +pglast/ast.pyi: $(PY_ENUMS) + $(PYTHON) tools/extract_ast.py pglast/ docs/ast.rst + +help:: + @printf "type-stubs\n\tgenerate Python type stubs for generated modules\n" + +PRINTER_STUBS := pglast/printers/ddl.pyi pglast/printers/dml.pyi pglast/printers/sfuncs.pyi + +.PHONY: type-stubs +type-stubs: enums +type-stubs: keywords +type-stubs: + $(MAKE) pglast/ast.pyi $(PY_ENUM_STUBS) pglast/enums/__init__.pyi $(PY_KEYWORD_STUBS) $(PRINTER_STUBS) + +pglast/printers/%.pyi: pglast/printers/%.py tools/extract_printer_stubs.py + $(PYTHON) tools/extract_printer_stubs.py $< $@ + +pglast/enums/__init__.pyi: pglast/enums/__init__.py Makefile + { \ + printf "%s\n" "# -*- coding: utf-8 -*-"; \ + printf "%s\n" "# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from __init__.py"; \ + printf "%s\n" "# :Author: Lele Gaifax "; \ + printf "%s\n" "# :License: GNU General Public License version 3 or later"; \ + printf "%s\n" "#"; \ + printf "\n"; \ + sed -n '/^from \./p' $<; \ + } > $@ + help:: @printf "printers-doc\n\tupdate printers documentation\n" diff --git a/pglast/__init__.pyi b/pglast/__init__.pyi new file mode 100644 index 0000000..16fa506 --- /dev/null +++ b/pglast/__init__.pyi @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — Type stubs for pglast package +# :License: GNU General Public License version 3 or later +# + +from typing import Any, NamedTuple + +from . import enums as enums +from .error import Error as Error +from .parser import fingerprint as fingerprint +from .parser import get_postgresql_version as get_postgresql_version +from .parser import parse_sql as parse_sql +from .parser import scan as scan +from .parser import split as split + +__version__: str +__author__: str +__all__: tuple[str, ...] + +class Comment(NamedTuple): + location: int + text: str + at_start_of_line: bool + continue_previous: bool + +def parse_plpgsql(statement: str) -> list[dict[str, Any]]: ... +def _extract_comments(statement: str) -> list[Comment]: ... +def prettify( + statement: str, + safety_belt: bool = False, + preserve_comments: bool = False, + **options: Any, +) -> str: ... diff --git a/pglast/__main__.pyi b/pglast/__main__.pyi new file mode 100644 index 0000000..d8422a9 --- /dev/null +++ b/pglast/__main__.pyi @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — Type stubs for pglast.__main__ module +# :License: GNU General Public License version 3 or later +# + +from argparse import Namespace +from collections.abc import Sequence + +def workhorse(args: Namespace) -> None: ... +def main(options: Sequence[str] | None = None) -> None: ... diff --git a/pglast/ast.pyi b/pglast/ast.pyi new file mode 100644 index 0000000..6d97f77 --- /dev/null +++ b/pglast/ast.pyi @@ -0,0 +1,3148 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from struct_defs.json @ 18.0.0-0-g204fbdb +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2021-2026 Lele Gaifax +# + +from collections.abc import Callable, Iterator +from decimal import Decimal + +from typing import Any, NamedTuple, overload + +from . import enums + + +class SlotTypeInfo(NamedTuple): + c_type: str + py_type: Any + adaptor: Callable[[Any], Any] | None + + +class __Omissis: + def __eq__(self, other: object) -> bool: ... + def __repr__(self) -> str: ... + + +Omissis: __Omissis + + +class Node: + ancestors: Any + _ATTRS_TO_IGNORE_IN_COMPARISON: set[str] + + def __init__(self, data: dict[str, Any]) -> None: ... + def __iter__(self) -> Iterator[str]: ... + def __repr__(self) -> str: ... + def __eq__(self, other: object) -> bool: ... + def __call__( + self, + depth: int | None = None, + ellipsis: Any = ..., + skip_none: bool = False, + ) -> dict[str, Any]: ... + def __setattr__(self, name: str, value: Any) -> None: ... + + +class Expr(Node): + pass + + +_NodePayload = dict[str, Any] +_ListInput = list[Any] | tuple[Any, ...] +_BitmapsetInput = set[int] | list[int] | tuple[int, ...] +_CharInput = str | int +_FloatStringInput = str | int | float | Decimal + + +class ATAlterConstraint(Node): + conname: str | None + alterEnforceability: bool | None + is_enforced: bool | None + alterDeferrability: bool | None + deferrable: bool | None + initdeferred: bool | None + alterInheritability: bool | None + noinherit: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, conname: str | None = None, alterEnforceability: bool | int | None = None, is_enforced: bool | int | None = None, alterDeferrability: bool | int | None = None, deferrable: bool | int | None = None, initdeferred: bool | int | None = None, alterInheritability: bool | int | None = None, noinherit: bool | int | None = None) -> None: ... # noqa: E501 + + +class A_ArrayExpr(Node): + elements: tuple[Any, ...] | None + list_start: int | None + list_end: int | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, elements: _ListInput | None = None, list_start: int | None = None, list_end: int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + + +class ValUnion(Node): + val: Node | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, value: Node | None = None) -> None: ... + + +class A_Const(Node): + isnull: bool | None + val: Node | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, isnull: bool | int | None = None, val: Node | None = None) -> None: ... # noqa: E501 + + +class A_Expr(Node): + kind: enums.A_Expr_Kind | None + name: tuple[Any, ...] | None + lexpr: Node | None + rexpr: Node | None + rexpr_list_start: int | None + rexpr_list_end: int | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, kind: enums.A_Expr_Kind | int | str | dict[str, Any] | None = None, name: _ListInput | None = None, lexpr: Node | _NodePayload | None = None, rexpr: Node | _NodePayload | None = None, rexpr_list_start: int | None = None, rexpr_list_end: int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class A_Indices(Node): + is_slice: bool | None + lidx: Node | None + uidx: Node | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, is_slice: bool | int | None = None, lidx: Node | _NodePayload | None = None, uidx: Node | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class A_Indirection(Node): + arg: Node | None + indirection: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, arg: Node | _NodePayload | None = None, indirection: _ListInput | None = None) -> None: ... # noqa: E501 + + +class A_Star(Node): + def __init__(self) -> None: ... + + +class AccessPriv(Node): + priv_name: str | None + cols: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, priv_name: str | None = None, cols: _ListInput | None = None) -> None: ... # noqa: E501 + + +class Aggref(Expr): + aggargtypes: tuple[Any, ...] | None + aggdirectargs: tuple[Any, ...] | None + args: tuple[Any, ...] | None + aggorder: tuple[Any, ...] | None + aggdistinct: tuple[Any, ...] | None + aggfilter: Expr | None + aggstar: bool | None + aggvariadic: bool | None + aggkind: str | None + agglevelsup: int | None + aggsplit: enums.AggSplit | None + aggno: int | None + aggtransno: int | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, aggargtypes: _ListInput | None = None, aggdirectargs: _ListInput | None = None, args: _ListInput | None = None, aggorder: _ListInput | None = None, aggdistinct: _ListInput | None = None, aggfilter: Expr | _NodePayload | None = None, aggstar: bool | int | None = None, aggvariadic: bool | int | None = None, aggkind: _CharInput | None = None, agglevelsup: int | None = None, aggsplit: enums.AggSplit | int | str | dict[str, Any] | None = None, aggno: int | None = None, aggtransno: int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class Alias(Node): + aliasname: str | None + colnames: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, aliasname: str | None = None, colnames: _ListInput | None = None) -> None: ... # noqa: E501 + + +class AlterCollationStmt(Node): + collname: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, collname: _ListInput | None = None) -> None: ... # noqa: E501 + + +class AlterDatabaseRefreshCollStmt(Node): + dbname: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, dbname: str | None = None) -> None: ... # noqa: E501 + + +class AlterDatabaseSetStmt(Node): + dbname: str | None + setstmt: VariableSetStmt | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, dbname: str | None = None, setstmt: VariableSetStmt | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class AlterDatabaseStmt(Node): + dbname: str | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, dbname: str | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class AlterDefaultPrivilegesStmt(Node): + options: tuple[Any, ...] | None + action: GrantStmt | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, options: _ListInput | None = None, action: GrantStmt | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class AlterDomainStmt(Node): + subtype: str | None + typeName: tuple[Any, ...] | None + name: str | None + def_: Node | None + behavior: enums.DropBehavior | None + missing_ok: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, subtype: _CharInput | None = None, typeName: _ListInput | None = None, name: str | None = None, def_: Node | _NodePayload | None = None, behavior: enums.DropBehavior | int | str | dict[str, Any] | None = None, missing_ok: bool | int | None = None) -> None: ... # noqa: E501 + + +class AlterEnumStmt(Node): + typeName: tuple[Any, ...] | None + oldVal: str | None + newVal: str | None + newValNeighbor: str | None + newValIsAfter: bool | None + skipIfNewValExists: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, typeName: _ListInput | None = None, oldVal: str | None = None, newVal: str | None = None, newValNeighbor: str | None = None, newValIsAfter: bool | int | None = None, skipIfNewValExists: bool | int | None = None) -> None: ... # noqa: E501 + + +class AlterEventTrigStmt(Node): + trigname: str | None + tgenabled: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, trigname: str | None = None, tgenabled: _CharInput | None = None) -> None: ... # noqa: E501 + + +class AlterExtensionContentsStmt(Node): + extname: str | None + action: int | None + objtype: enums.ObjectType | None + object: Node | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, extname: str | None = None, action: int | None = None, objtype: enums.ObjectType | int | str | dict[str, Any] | None = None, object: Node | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class AlterExtensionStmt(Node): + extname: str | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, extname: str | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class AlterFdwStmt(Node): + fdwname: str | None + func_options: tuple[Any, ...] | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, fdwname: str | None = None, func_options: _ListInput | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class AlterForeignServerStmt(Node): + servername: str | None + version: str | None + options: tuple[Any, ...] | None + has_version: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, servername: str | None = None, version: str | None = None, options: _ListInput | None = None, has_version: bool | int | None = None) -> None: ... # noqa: E501 + + +class AlterFunctionStmt(Node): + objtype: enums.ObjectType | None + func: ObjectWithArgs | None + actions: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, objtype: enums.ObjectType | int | str | dict[str, Any] | None = None, func: ObjectWithArgs | _NodePayload | None = None, actions: _ListInput | None = None) -> None: ... # noqa: E501 + + +class AlterObjectDependsStmt(Node): + objectType: enums.ObjectType | None + relation: RangeVar | None + object: Node | None + extname: String | None + remove: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, objectType: enums.ObjectType | int | str | dict[str, Any] | None = None, relation: RangeVar | _NodePayload | None = None, object: Node | _NodePayload | None = None, extname: String | _NodePayload | None = None, remove: bool | int | None = None) -> None: ... # noqa: E501 + + +class AlterObjectSchemaStmt(Node): + objectType: enums.ObjectType | None + relation: RangeVar | None + object: Node | None + newschema: str | None + missing_ok: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, objectType: enums.ObjectType | int | str | dict[str, Any] | None = None, relation: RangeVar | _NodePayload | None = None, object: Node | _NodePayload | None = None, newschema: str | None = None, missing_ok: bool | int | None = None) -> None: ... # noqa: E501 + + +class AlterOpFamilyStmt(Node): + opfamilyname: tuple[Any, ...] | None + amname: str | None + isDrop: bool | None + items: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, opfamilyname: _ListInput | None = None, amname: str | None = None, isDrop: bool | int | None = None, items: _ListInput | None = None) -> None: ... # noqa: E501 + + +class AlterOperatorStmt(Node): + opername: ObjectWithArgs | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, opername: ObjectWithArgs | _NodePayload | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class AlterOwnerStmt(Node): + objectType: enums.ObjectType | None + relation: RangeVar | None + object: Node | None + newowner: RoleSpec | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, objectType: enums.ObjectType | int | str | dict[str, Any] | None = None, relation: RangeVar | _NodePayload | None = None, object: Node | _NodePayload | None = None, newowner: RoleSpec | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class AlterPolicyStmt(Node): + policy_name: str | None + table: RangeVar | None + roles: tuple[Any, ...] | None + qual: Node | None + with_check: Node | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, policy_name: str | None = None, table: RangeVar | _NodePayload | None = None, roles: _ListInput | None = None, qual: Node | _NodePayload | None = None, with_check: Node | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class AlterPublicationStmt(Node): + pubname: str | None + options: tuple[Any, ...] | None + pubobjects: tuple[Any, ...] | None + for_all_tables: bool | None + action: enums.AlterPublicationAction | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, pubname: str | None = None, options: _ListInput | None = None, pubobjects: _ListInput | None = None, for_all_tables: bool | int | None = None, action: enums.AlterPublicationAction | int | str | dict[str, Any] | None = None) -> None: ... # noqa: E501 + + +class AlterRoleSetStmt(Node): + role: RoleSpec | None + database: str | None + setstmt: VariableSetStmt | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, role: RoleSpec | _NodePayload | None = None, database: str | None = None, setstmt: VariableSetStmt | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class AlterRoleStmt(Node): + role: RoleSpec | None + options: tuple[Any, ...] | None + action: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, role: RoleSpec | _NodePayload | None = None, options: _ListInput | None = None, action: int | None = None) -> None: ... # noqa: E501 + + +class AlterSeqStmt(Node): + sequence: RangeVar | None + options: tuple[Any, ...] | None + for_identity: bool | None + missing_ok: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, sequence: RangeVar | _NodePayload | None = None, options: _ListInput | None = None, for_identity: bool | int | None = None, missing_ok: bool | int | None = None) -> None: ... # noqa: E501 + + +class AlterStatsStmt(Node): + defnames: tuple[Any, ...] | None + stxstattarget: Node | None + missing_ok: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, defnames: _ListInput | None = None, stxstattarget: Node | _NodePayload | None = None, missing_ok: bool | int | None = None) -> None: ... # noqa: E501 + + +class AlterSubscriptionStmt(Node): + kind: enums.AlterSubscriptionType | None + subname: str | None + conninfo: str | None + publication: tuple[Any, ...] | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, kind: enums.AlterSubscriptionType | int | str | dict[str, Any] | None = None, subname: str | None = None, conninfo: str | None = None, publication: _ListInput | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class AlterSystemStmt(Node): + setstmt: VariableSetStmt | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, setstmt: VariableSetStmt | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class AlterTSConfigurationStmt(Node): + kind: enums.AlterTSConfigType | None + cfgname: tuple[Any, ...] | None + tokentype: tuple[Any, ...] | None + dicts: tuple[Any, ...] | None + override: bool | None + replace: bool | None + missing_ok: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, kind: enums.AlterTSConfigType | int | str | dict[str, Any] | None = None, cfgname: _ListInput | None = None, tokentype: _ListInput | None = None, dicts: _ListInput | None = None, override: bool | int | None = None, replace: bool | int | None = None, missing_ok: bool | int | None = None) -> None: ... # noqa: E501 + + +class AlterTSDictionaryStmt(Node): + dictname: tuple[Any, ...] | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, dictname: _ListInput | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class AlterTableCmd(Node): + subtype: enums.AlterTableType | None + name: str | None + num: int | None + newowner: RoleSpec | None + def_: Node | None + behavior: enums.DropBehavior | None + missing_ok: bool | None + recurse: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, subtype: enums.AlterTableType | int | str | dict[str, Any] | None = None, name: str | None = None, num: int | None = None, newowner: RoleSpec | _NodePayload | None = None, def_: Node | _NodePayload | None = None, behavior: enums.DropBehavior | int | str | dict[str, Any] | None = None, missing_ok: bool | int | None = None, recurse: bool | int | None = None) -> None: ... # noqa: E501 + + +class AlterTableMoveAllStmt(Node): + orig_tablespacename: str | None + objtype: enums.ObjectType | None + roles: tuple[Any, ...] | None + new_tablespacename: str | None + nowait: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, orig_tablespacename: str | None = None, objtype: enums.ObjectType | int | str | dict[str, Any] | None = None, roles: _ListInput | None = None, new_tablespacename: str | None = None, nowait: bool | int | None = None) -> None: ... # noqa: E501 + + +class AlterTableSpaceOptionsStmt(Node): + tablespacename: str | None + options: tuple[Any, ...] | None + isReset: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, tablespacename: str | None = None, options: _ListInput | None = None, isReset: bool | int | None = None) -> None: ... # noqa: E501 + + +class AlterTableStmt(Node): + relation: RangeVar | None + cmds: tuple[Any, ...] | None + objtype: enums.ObjectType | None + missing_ok: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, relation: RangeVar | _NodePayload | None = None, cmds: _ListInput | None = None, objtype: enums.ObjectType | int | str | dict[str, Any] | None = None, missing_ok: bool | int | None = None) -> None: ... # noqa: E501 + + +class AlterTypeStmt(Node): + typeName: tuple[Any, ...] | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, typeName: _ListInput | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class AlterUserMappingStmt(Node): + user: RoleSpec | None + servername: str | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, user: RoleSpec | _NodePayload | None = None, servername: str | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class AlternativeSubPlan(Expr): + subplans: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, subplans: _ListInput | None = None) -> None: ... # noqa: E501 + + +class ArrayCoerceExpr(Expr): + arg: Expr | None + elemexpr: Expr | None + resulttypmod: int | None + coerceformat: enums.CoercionForm | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, arg: Expr | _NodePayload | None = None, elemexpr: Expr | _NodePayload | None = None, resulttypmod: int | None = None, coerceformat: enums.CoercionForm | int | str | dict[str, Any] | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class ArrayExpr(Expr): + elements: tuple[Any, ...] | None + multidims: bool | None + list_start: int | None + list_end: int | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, elements: _ListInput | None = None, multidims: bool | int | None = None, list_start: int | None = None, list_end: int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class BitString(Node): + bsval: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, bsval: str | None = None) -> None: ... # noqa: E501 + + +class BoolExpr(Expr): + boolop: enums.BoolExprType | None + args: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, boolop: enums.BoolExprType | int | str | dict[str, Any] | None = None, args: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class Boolean(Node): + boolval: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, boolval: bool | int | None = None) -> None: ... # noqa: E501 + + +class BooleanTest(Expr): + arg: Expr | None + booltesttype: enums.BoolTestType | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, arg: Expr | _NodePayload | None = None, booltesttype: enums.BoolTestType | int | str | dict[str, Any] | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class CTECycleClause(Node): + cycle_col_list: tuple[Any, ...] | None + cycle_mark_column: str | None + cycle_mark_value: Node | None + cycle_mark_default: Node | None + cycle_path_column: str | None + location: int | None + cycle_mark_typmod: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, cycle_col_list: _ListInput | None = None, cycle_mark_column: str | None = None, cycle_mark_value: Node | _NodePayload | None = None, cycle_mark_default: Node | _NodePayload | None = None, cycle_path_column: str | None = None, location: int | None = None, cycle_mark_typmod: int | None = None) -> None: ... # noqa: E501 + + +class CTESearchClause(Node): + search_col_list: tuple[Any, ...] | None + search_breadth_first: bool | None + search_seq_column: str | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, search_col_list: _ListInput | None = None, search_breadth_first: bool | int | None = None, search_seq_column: str | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class CallContext(Node): + atomic: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, atomic: bool | int | None = None) -> None: ... # noqa: E501 + + +class CallStmt(Node): + funccall: FuncCall | None + funcexpr: FuncExpr | None + outargs: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, funccall: FuncCall | _NodePayload | None = None, funcexpr: FuncExpr | _NodePayload | None = None, outargs: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CaseExpr(Expr): + arg: Expr | None + args: tuple[Any, ...] | None + defresult: Expr | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, arg: Expr | _NodePayload | None = None, args: _ListInput | None = None, defresult: Expr | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class CaseTestExpr(Expr): + typeMod: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, typeMod: int | None = None) -> None: ... # noqa: E501 + + +class CaseWhen(Expr): + expr: Expr | None + result: Expr | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, expr: Expr | _NodePayload | None = None, result: Expr | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class CheckPointStmt(Node): + def __init__(self) -> None: ... + + +class ClosePortalStmt(Node): + portalname: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, portalname: str | None = None) -> None: ... # noqa: E501 + + +class ClusterStmt(Node): + relation: RangeVar | None + indexname: str | None + params: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, relation: RangeVar | _NodePayload | None = None, indexname: str | None = None, params: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CoalesceExpr(Expr): + args: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, args: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class CoerceToDomain(Expr): + arg: Expr | None + resulttypmod: int | None + coercionformat: enums.CoercionForm | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, arg: Expr | _NodePayload | None = None, resulttypmod: int | None = None, coercionformat: enums.CoercionForm | int | str | dict[str, Any] | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class CoerceToDomainValue(Expr): + typeMod: int | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, typeMod: int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class CoerceViaIO(Expr): + arg: Expr | None + coerceformat: enums.CoercionForm | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, arg: Expr | _NodePayload | None = None, coerceformat: enums.CoercionForm | int | str | dict[str, Any] | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class CollateClause(Node): + arg: Node | None + collname: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, arg: Node | _NodePayload | None = None, collname: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class CollateExpr(Expr): + arg: Expr | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, arg: Expr | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class ColumnDef(Node): + colname: str | None + typeName: TypeName | None + compression: str | None + inhcount: int | None + is_local: bool | None + is_not_null: bool | None + is_from_type: bool | None + storage: str | None + storage_name: str | None + raw_default: Node | None + cooked_default: Node | None + identity: str | None + identitySequence: RangeVar | None + generated: str | None + collClause: CollateClause | None + constraints: tuple[Any, ...] | None + fdwoptions: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, colname: str | None = None, typeName: TypeName | _NodePayload | None = None, compression: str | None = None, inhcount: int | None = None, is_local: bool | int | None = None, is_not_null: bool | int | None = None, is_from_type: bool | int | None = None, storage: _CharInput | None = None, storage_name: str | None = None, raw_default: Node | _NodePayload | None = None, cooked_default: Node | _NodePayload | None = None, identity: _CharInput | None = None, identitySequence: RangeVar | _NodePayload | None = None, generated: _CharInput | None = None, collClause: CollateClause | _NodePayload | None = None, constraints: _ListInput | None = None, fdwoptions: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class ColumnRef(Node): + fields: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, fields: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class CommentStmt(Node): + objtype: enums.ObjectType | None + object: Node | None + comment: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, objtype: enums.ObjectType | int | str | dict[str, Any] | None = None, object: Node | _NodePayload | None = None, comment: str | None = None) -> None: ... # noqa: E501 + + +class CommonTableExpr(Node): + ctename: str | None + aliascolnames: tuple[Any, ...] | None + ctematerialized: enums.CTEMaterialize | None + ctequery: Node | None + search_clause: CTESearchClause | None + cycle_clause: CTECycleClause | None + location: int | None + cterecursive: bool | None + cterefcount: int | None + ctecolnames: tuple[Any, ...] | None + ctecoltypes: tuple[Any, ...] | None + ctecoltypmods: tuple[Any, ...] | None + ctecolcollations: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, ctename: str | None = None, aliascolnames: _ListInput | None = None, ctematerialized: enums.CTEMaterialize | int | str | dict[str, Any] | None = None, ctequery: Node | _NodePayload | None = None, search_clause: CTESearchClause | _NodePayload | None = None, cycle_clause: CTECycleClause | _NodePayload | None = None, location: int | None = None, cterecursive: bool | int | None = None, cterefcount: int | None = None, ctecolnames: _ListInput | None = None, ctecoltypes: _ListInput | None = None, ctecoltypmods: _ListInput | None = None, ctecolcollations: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CompositeTypeStmt(Node): + typevar: RangeVar | None + coldeflist: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, typevar: RangeVar | _NodePayload | None = None, coldeflist: _ListInput | None = None) -> None: ... # noqa: E501 + + +class Constraint(Node): + contype: enums.ConstrType | None + conname: str | None + deferrable: bool | None + initdeferred: bool | None + is_enforced: bool | None + skip_validation: bool | None + initially_valid: bool | None + is_no_inherit: bool | None + raw_expr: Node | None + cooked_expr: str | None + generated_when: str | None + generated_kind: str | None + nulls_not_distinct: bool | None + keys: tuple[Any, ...] | None + without_overlaps: bool | None + including: tuple[Any, ...] | None + exclusions: tuple[Any, ...] | None + options: tuple[Any, ...] | None + indexname: str | None + indexspace: str | None + reset_default_tblspc: bool | None + access_method: str | None + where_clause: Node | None + pktable: RangeVar | None + fk_attrs: tuple[Any, ...] | None + pk_attrs: tuple[Any, ...] | None + fk_with_period: bool | None + pk_with_period: bool | None + fk_matchtype: str | None + fk_upd_action: str | None + fk_del_action: str | None + fk_del_set_cols: tuple[Any, ...] | None + old_conpfeqop: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, contype: enums.ConstrType | int | str | dict[str, Any] | None = None, conname: str | None = None, deferrable: bool | int | None = None, initdeferred: bool | int | None = None, is_enforced: bool | int | None = None, skip_validation: bool | int | None = None, initially_valid: bool | int | None = None, is_no_inherit: bool | int | None = None, raw_expr: Node | _NodePayload | None = None, cooked_expr: str | None = None, generated_when: _CharInput | None = None, generated_kind: _CharInput | None = None, nulls_not_distinct: bool | int | None = None, keys: _ListInput | None = None, without_overlaps: bool | int | None = None, including: _ListInput | None = None, exclusions: _ListInput | None = None, options: _ListInput | None = None, indexname: str | None = None, indexspace: str | None = None, reset_default_tblspc: bool | int | None = None, access_method: str | None = None, where_clause: Node | _NodePayload | None = None, pktable: RangeVar | _NodePayload | None = None, fk_attrs: _ListInput | None = None, pk_attrs: _ListInput | None = None, fk_with_period: bool | int | None = None, pk_with_period: bool | int | None = None, fk_matchtype: _CharInput | None = None, fk_upd_action: _CharInput | None = None, fk_del_action: _CharInput | None = None, fk_del_set_cols: _ListInput | None = None, old_conpfeqop: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class ConstraintsSetStmt(Node): + constraints: tuple[Any, ...] | None + deferred: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, constraints: _ListInput | None = None, deferred: bool | int | None = None) -> None: ... # noqa: E501 + + +class ConvertRowtypeExpr(Expr): + arg: Expr | None + convertformat: enums.CoercionForm | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, arg: Expr | _NodePayload | None = None, convertformat: enums.CoercionForm | int | str | dict[str, Any] | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class CopyStmt(Node): + relation: RangeVar | None + query: Node | None + attlist: tuple[Any, ...] | None + is_from: bool | None + is_program: bool | None + filename: str | None + options: tuple[Any, ...] | None + whereClause: Node | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, relation: RangeVar | _NodePayload | None = None, query: Node | _NodePayload | None = None, attlist: _ListInput | None = None, is_from: bool | int | None = None, is_program: bool | int | None = None, filename: str | None = None, options: _ListInput | None = None, whereClause: Node | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class CreateAmStmt(Node): + amname: str | None + handler_name: tuple[Any, ...] | None + amtype: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, amname: str | None = None, handler_name: _ListInput | None = None, amtype: _CharInput | None = None) -> None: ... # noqa: E501 + + +class CreateCastStmt(Node): + sourcetype: TypeName | None + targettype: TypeName | None + func: ObjectWithArgs | None + context: enums.CoercionContext | None + inout: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, sourcetype: TypeName | _NodePayload | None = None, targettype: TypeName | _NodePayload | None = None, func: ObjectWithArgs | _NodePayload | None = None, context: enums.CoercionContext | int | str | dict[str, Any] | None = None, inout: bool | int | None = None) -> None: ... # noqa: E501 + + +class CreateConversionStmt(Node): + conversion_name: tuple[Any, ...] | None + for_encoding_name: str | None + to_encoding_name: str | None + func_name: tuple[Any, ...] | None + def_: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, conversion_name: _ListInput | None = None, for_encoding_name: str | None = None, to_encoding_name: str | None = None, func_name: _ListInput | None = None, def_: bool | int | None = None) -> None: ... # noqa: E501 + + +class CreateDomainStmt(Node): + domainname: tuple[Any, ...] | None + typeName: TypeName | None + collClause: CollateClause | None + constraints: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, domainname: _ListInput | None = None, typeName: TypeName | _NodePayload | None = None, collClause: CollateClause | _NodePayload | None = None, constraints: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CreateEnumStmt(Node): + typeName: tuple[Any, ...] | None + vals: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, typeName: _ListInput | None = None, vals: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CreateEventTrigStmt(Node): + trigname: str | None + eventname: str | None + whenclause: tuple[Any, ...] | None + funcname: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, trigname: str | None = None, eventname: str | None = None, whenclause: _ListInput | None = None, funcname: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CreateExtensionStmt(Node): + extname: str | None + if_not_exists: bool | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, extname: str | None = None, if_not_exists: bool | int | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CreateFdwStmt(Node): + fdwname: str | None + func_options: tuple[Any, ...] | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, fdwname: str | None = None, func_options: _ListInput | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CreateForeignServerStmt(Node): + servername: str | None + servertype: str | None + version: str | None + fdwname: str | None + if_not_exists: bool | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, servername: str | None = None, servertype: str | None = None, version: str | None = None, fdwname: str | None = None, if_not_exists: bool | int | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CreateForeignTableStmt(Node): + base: CreateStmt | None + servername: str | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, base: CreateStmt | _NodePayload | None = None, servername: str | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CreateFunctionStmt(Node): + is_procedure: bool | None + replace: bool | None + funcname: tuple[Any, ...] | None + parameters: tuple[Any, ...] | None + returnType: TypeName | None + options: tuple[Any, ...] | None + sql_body: Node | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, is_procedure: bool | int | None = None, replace: bool | int | None = None, funcname: _ListInput | None = None, parameters: _ListInput | None = None, returnType: TypeName | _NodePayload | None = None, options: _ListInput | None = None, sql_body: Node | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class CreateOpClassItem(Node): + itemtype: int | None + name: ObjectWithArgs | None + number: int | None + order_family: tuple[Any, ...] | None + class_args: tuple[Any, ...] | None + storedtype: TypeName | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, itemtype: int | None = None, name: ObjectWithArgs | _NodePayload | None = None, number: int | None = None, order_family: _ListInput | None = None, class_args: _ListInput | None = None, storedtype: TypeName | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class CreateOpClassStmt(Node): + opclassname: tuple[Any, ...] | None + opfamilyname: tuple[Any, ...] | None + amname: str | None + datatype: TypeName | None + items: tuple[Any, ...] | None + isDefault: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, opclassname: _ListInput | None = None, opfamilyname: _ListInput | None = None, amname: str | None = None, datatype: TypeName | _NodePayload | None = None, items: _ListInput | None = None, isDefault: bool | int | None = None) -> None: ... # noqa: E501 + + +class CreateOpFamilyStmt(Node): + opfamilyname: tuple[Any, ...] | None + amname: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, opfamilyname: _ListInput | None = None, amname: str | None = None) -> None: ... # noqa: E501 + + +class CreatePLangStmt(Node): + replace: bool | None + plname: str | None + plhandler: tuple[Any, ...] | None + plinline: tuple[Any, ...] | None + plvalidator: tuple[Any, ...] | None + pltrusted: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, replace: bool | int | None = None, plname: str | None = None, plhandler: _ListInput | None = None, plinline: _ListInput | None = None, plvalidator: _ListInput | None = None, pltrusted: bool | int | None = None) -> None: ... # noqa: E501 + + +class CreatePolicyStmt(Node): + policy_name: str | None + table: RangeVar | None + cmd_name: str | None + permissive: bool | None + roles: tuple[Any, ...] | None + qual: Node | None + with_check: Node | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, policy_name: str | None = None, table: RangeVar | _NodePayload | None = None, cmd_name: str | None = None, permissive: bool | int | None = None, roles: _ListInput | None = None, qual: Node | _NodePayload | None = None, with_check: Node | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class CreatePublicationStmt(Node): + pubname: str | None + options: tuple[Any, ...] | None + pubobjects: tuple[Any, ...] | None + for_all_tables: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, pubname: str | None = None, options: _ListInput | None = None, pubobjects: _ListInput | None = None, for_all_tables: bool | int | None = None) -> None: ... # noqa: E501 + + +class CreateRangeStmt(Node): + typeName: tuple[Any, ...] | None + params: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, typeName: _ListInput | None = None, params: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CreateRoleStmt(Node): + stmt_type: enums.RoleStmtType | None + role: str | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, stmt_type: enums.RoleStmtType | int | str | dict[str, Any] | None = None, role: str | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CreateSchemaStmt(Node): + schemaname: str | None + authrole: RoleSpec | None + schemaElts: tuple[Any, ...] | None + if_not_exists: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, schemaname: str | None = None, authrole: RoleSpec | _NodePayload | None = None, schemaElts: _ListInput | None = None, if_not_exists: bool | int | None = None) -> None: ... # noqa: E501 + + +class CreateSeqStmt(Node): + sequence: RangeVar | None + options: tuple[Any, ...] | None + for_identity: bool | None + if_not_exists: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, sequence: RangeVar | _NodePayload | None = None, options: _ListInput | None = None, for_identity: bool | int | None = None, if_not_exists: bool | int | None = None) -> None: ... # noqa: E501 + + +class CreateStatsStmt(Node): + defnames: tuple[Any, ...] | None + stat_types: tuple[Any, ...] | None + exprs: tuple[Any, ...] | None + relations: tuple[Any, ...] | None + stxcomment: str | None + transformed: bool | None + if_not_exists: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, defnames: _ListInput | None = None, stat_types: _ListInput | None = None, exprs: _ListInput | None = None, relations: _ListInput | None = None, stxcomment: str | None = None, transformed: bool | int | None = None, if_not_exists: bool | int | None = None) -> None: ... # noqa: E501 + + +class CreateStmt(Node): + relation: RangeVar | None + tableElts: tuple[Any, ...] | None + inhRelations: tuple[Any, ...] | None + partbound: PartitionBoundSpec | None + partspec: PartitionSpec | None + ofTypename: TypeName | None + constraints: tuple[Any, ...] | None + nnconstraints: tuple[Any, ...] | None + options: tuple[Any, ...] | None + oncommit: enums.OnCommitAction | None + tablespacename: str | None + accessMethod: str | None + if_not_exists: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, relation: RangeVar | _NodePayload | None = None, tableElts: _ListInput | None = None, inhRelations: _ListInput | None = None, partbound: PartitionBoundSpec | _NodePayload | None = None, partspec: PartitionSpec | _NodePayload | None = None, ofTypename: TypeName | _NodePayload | None = None, constraints: _ListInput | None = None, nnconstraints: _ListInput | None = None, options: _ListInput | None = None, oncommit: enums.OnCommitAction | int | str | dict[str, Any] | None = None, tablespacename: str | None = None, accessMethod: str | None = None, if_not_exists: bool | int | None = None) -> None: ... # noqa: E501 + + +class CreateSubscriptionStmt(Node): + subname: str | None + conninfo: str | None + publication: tuple[Any, ...] | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, subname: str | None = None, conninfo: str | None = None, publication: _ListInput | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CreateTableAsStmt(Node): + query: Node | None + into: IntoClause | None + objtype: enums.ObjectType | None + is_select_into: bool | None + if_not_exists: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, query: Node | _NodePayload | None = None, into: IntoClause | _NodePayload | None = None, objtype: enums.ObjectType | int | str | dict[str, Any] | None = None, is_select_into: bool | int | None = None, if_not_exists: bool | int | None = None) -> None: ... # noqa: E501 + + +class CreateTableSpaceStmt(Node): + tablespacename: str | None + owner: RoleSpec | None + location: str | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, tablespacename: str | None = None, owner: RoleSpec | _NodePayload | None = None, location: str | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CreateTransformStmt(Node): + replace: bool | None + type_name: TypeName | None + lang: str | None + fromsql: ObjectWithArgs | None + tosql: ObjectWithArgs | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, replace: bool | int | None = None, type_name: TypeName | _NodePayload | None = None, lang: str | None = None, fromsql: ObjectWithArgs | _NodePayload | None = None, tosql: ObjectWithArgs | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class CreateTrigStmt(Node): + replace: bool | None + isconstraint: bool | None + trigname: str | None + relation: RangeVar | None + funcname: tuple[Any, ...] | None + args: tuple[Any, ...] | None + row: bool | None + timing: int | None + events: int | None + columns: tuple[Any, ...] | None + whenClause: Node | None + transitionRels: tuple[Any, ...] | None + deferrable: bool | None + initdeferred: bool | None + constrrel: RangeVar | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, replace: bool | int | None = None, isconstraint: bool | int | None = None, trigname: str | None = None, relation: RangeVar | _NodePayload | None = None, funcname: _ListInput | None = None, args: _ListInput | None = None, row: bool | int | None = None, timing: int | None = None, events: int | None = None, columns: _ListInput | None = None, whenClause: Node | _NodePayload | None = None, transitionRels: _ListInput | None = None, deferrable: bool | int | None = None, initdeferred: bool | int | None = None, constrrel: RangeVar | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class CreateUserMappingStmt(Node): + user: RoleSpec | None + servername: str | None + if_not_exists: bool | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, user: RoleSpec | _NodePayload | None = None, servername: str | None = None, if_not_exists: bool | int | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CreatedbStmt(Node): + dbname: str | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, dbname: str | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class CurrentOfExpr(Expr): + cvarno: int | None + cursor_name: str | None + cursor_param: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, cvarno: int | None = None, cursor_name: str | None = None, cursor_param: int | None = None) -> None: ... # noqa: E501 + + +class DeallocateStmt(Node): + name: str | None + isall: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, name: str | None = None, isall: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class DeclareCursorStmt(Node): + portalname: str | None + options: int | None + query: Node | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, portalname: str | None = None, options: int | None = None, query: Node | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class DefElem(Node): + defnamespace: str | None + defname: str | None + arg: Node | None + defaction: enums.DefElemAction | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, defnamespace: str | None = None, defname: str | None = None, arg: Node | _NodePayload | None = None, defaction: enums.DefElemAction | int | str | dict[str, Any] | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class DefineStmt(Node): + kind: enums.ObjectType | None + oldstyle: bool | None + defnames: tuple[Any, ...] | None + args: tuple[Any, ...] | None + definition: tuple[Any, ...] | None + if_not_exists: bool | None + replace: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, kind: enums.ObjectType | int | str | dict[str, Any] | None = None, oldstyle: bool | int | None = None, defnames: _ListInput | None = None, args: _ListInput | None = None, definition: _ListInput | None = None, if_not_exists: bool | int | None = None, replace: bool | int | None = None) -> None: ... # noqa: E501 + + +class DeleteStmt(Node): + relation: RangeVar | None + usingClause: tuple[Any, ...] | None + whereClause: Node | None + returningClause: ReturningClause | None + withClause: WithClause | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, relation: RangeVar | _NodePayload | None = None, usingClause: _ListInput | None = None, whereClause: Node | _NodePayload | None = None, returningClause: ReturningClause | _NodePayload | None = None, withClause: WithClause | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class DiscardStmt(Node): + target: enums.DiscardMode | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, target: enums.DiscardMode | int | str | dict[str, Any] | None = None) -> None: ... # noqa: E501 + + +class DoStmt(Node): + args: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, args: _ListInput | None = None) -> None: ... # noqa: E501 + + +class DropOwnedStmt(Node): + roles: tuple[Any, ...] | None + behavior: enums.DropBehavior | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, roles: _ListInput | None = None, behavior: enums.DropBehavior | int | str | dict[str, Any] | None = None) -> None: ... # noqa: E501 + + +class DropRoleStmt(Node): + roles: tuple[Any, ...] | None + missing_ok: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, roles: _ListInput | None = None, missing_ok: bool | int | None = None) -> None: ... # noqa: E501 + + +class DropStmt(Node): + objects: tuple[Any, ...] | None + removeType: enums.ObjectType | None + behavior: enums.DropBehavior | None + missing_ok: bool | None + concurrent: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, objects: _ListInput | None = None, removeType: enums.ObjectType | int | str | dict[str, Any] | None = None, behavior: enums.DropBehavior | int | str | dict[str, Any] | None = None, missing_ok: bool | int | None = None, concurrent: bool | int | None = None) -> None: ... # noqa: E501 + + +class DropSubscriptionStmt(Node): + subname: str | None + missing_ok: bool | None + behavior: enums.DropBehavior | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, subname: str | None = None, missing_ok: bool | int | None = None, behavior: enums.DropBehavior | int | str | dict[str, Any] | None = None) -> None: ... # noqa: E501 + + +class DropTableSpaceStmt(Node): + tablespacename: str | None + missing_ok: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, tablespacename: str | None = None, missing_ok: bool | int | None = None) -> None: ... # noqa: E501 + + +class DropUserMappingStmt(Node): + user: RoleSpec | None + servername: str | None + missing_ok: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, user: RoleSpec | _NodePayload | None = None, servername: str | None = None, missing_ok: bool | int | None = None) -> None: ... # noqa: E501 + + +class DropdbStmt(Node): + dbname: str | None + missing_ok: bool | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, dbname: str | None = None, missing_ok: bool | int | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class ExecuteStmt(Node): + name: str | None + params: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, name: str | None = None, params: _ListInput | None = None) -> None: ... # noqa: E501 + + +class ExplainStmt(Node): + query: Node | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, query: Node | _NodePayload | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class FetchStmt(Node): + direction: enums.FetchDirection | None + howMany: int | None + portalname: str | None + ismove: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, direction: enums.FetchDirection | int | str | dict[str, Any] | None = None, howMany: int | None = None, portalname: str | None = None, ismove: bool | int | None = None) -> None: ... # noqa: E501 + + +class FieldSelect(Expr): + arg: Expr | None + fieldnum: int | None + resulttypmod: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, arg: Expr | _NodePayload | None = None, fieldnum: int | None = None, resulttypmod: int | None = None) -> None: ... # noqa: E501 + + +class FieldStore(Expr): + arg: Expr | None + newvals: tuple[Any, ...] | None + fieldnums: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, arg: Expr | _NodePayload | None = None, newvals: _ListInput | None = None, fieldnums: _ListInput | None = None) -> None: ... # noqa: E501 + + +class Float(Node): + fval: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, fval: _FloatStringInput | None = None) -> None: ... # noqa: E501 + + +class FromExpr(Node): + fromlist: tuple[Any, ...] | None + quals: Node | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, fromlist: _ListInput | None = None, quals: Node | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class FuncCall(Node): + funcname: tuple[Any, ...] | None + args: tuple[Any, ...] | None + agg_order: tuple[Any, ...] | None + agg_filter: Node | None + over: WindowDef | None + agg_within_group: bool | None + agg_star: bool | None + agg_distinct: bool | None + func_variadic: bool | None + funcformat: enums.CoercionForm | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, funcname: _ListInput | None = None, args: _ListInput | None = None, agg_order: _ListInput | None = None, agg_filter: Node | _NodePayload | None = None, over: WindowDef | _NodePayload | None = None, agg_within_group: bool | int | None = None, agg_star: bool | int | None = None, agg_distinct: bool | int | None = None, func_variadic: bool | int | None = None, funcformat: enums.CoercionForm | int | str | dict[str, Any] | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class FuncExpr(Expr): + funcretset: bool | None + funcvariadic: bool | None + funcformat: enums.CoercionForm | None + args: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, funcretset: bool | int | None = None, funcvariadic: bool | int | None = None, funcformat: enums.CoercionForm | int | str | dict[str, Any] | None = None, args: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class FunctionParameter(Node): + name: str | None + argType: TypeName | None + mode: enums.FunctionParameterMode | None + defexpr: Node | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, name: str | None = None, argType: TypeName | _NodePayload | None = None, mode: enums.FunctionParameterMode | int | str | dict[str, Any] | None = None, defexpr: Node | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class GrantRoleStmt(Node): + granted_roles: tuple[Any, ...] | None + grantee_roles: tuple[Any, ...] | None + is_grant: bool | None + opt: tuple[Any, ...] | None + grantor: RoleSpec | None + behavior: enums.DropBehavior | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, granted_roles: _ListInput | None = None, grantee_roles: _ListInput | None = None, is_grant: bool | int | None = None, opt: _ListInput | None = None, grantor: RoleSpec | _NodePayload | None = None, behavior: enums.DropBehavior | int | str | dict[str, Any] | None = None) -> None: ... # noqa: E501 + + +class GrantStmt(Node): + is_grant: bool | None + targtype: enums.GrantTargetType | None + objtype: enums.ObjectType | None + objects: tuple[Any, ...] | None + privileges: tuple[Any, ...] | None + grantees: tuple[Any, ...] | None + grant_option: bool | None + grantor: RoleSpec | None + behavior: enums.DropBehavior | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, is_grant: bool | int | None = None, targtype: enums.GrantTargetType | int | str | dict[str, Any] | None = None, objtype: enums.ObjectType | int | str | dict[str, Any] | None = None, objects: _ListInput | None = None, privileges: _ListInput | None = None, grantees: _ListInput | None = None, grant_option: bool | int | None = None, grantor: RoleSpec | _NodePayload | None = None, behavior: enums.DropBehavior | int | str | dict[str, Any] | None = None) -> None: ... # noqa: E501 + + +class GroupingFunc(Expr): + args: tuple[Any, ...] | None + refs: tuple[Any, ...] | None + agglevelsup: int | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, args: _ListInput | None = None, refs: _ListInput | None = None, agglevelsup: int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class GroupingSet(Node): + kind: enums.GroupingSetKind | None + content: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, kind: enums.GroupingSetKind | int | str | dict[str, Any] | None = None, content: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class ImportForeignSchemaStmt(Node): + server_name: str | None + remote_schema: str | None + local_schema: str | None + list_type: enums.ImportForeignSchemaType | None + table_list: tuple[Any, ...] | None + options: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, server_name: str | None = None, remote_schema: str | None = None, local_schema: str | None = None, list_type: enums.ImportForeignSchemaType | int | str | dict[str, Any] | None = None, table_list: _ListInput | None = None, options: _ListInput | None = None) -> None: ... # noqa: E501 + + +class IndexElem(Node): + name: str | None + expr: Node | None + indexcolname: str | None + collation: tuple[Any, ...] | None + opclass: tuple[Any, ...] | None + opclassopts: tuple[Any, ...] | None + ordering: enums.SortByDir | None + nulls_ordering: enums.SortByNulls | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, name: str | None = None, expr: Node | _NodePayload | None = None, indexcolname: str | None = None, collation: _ListInput | None = None, opclass: _ListInput | None = None, opclassopts: _ListInput | None = None, ordering: enums.SortByDir | int | str | dict[str, Any] | None = None, nulls_ordering: enums.SortByNulls | int | str | dict[str, Any] | None = None) -> None: ... # noqa: E501 + + +class IndexStmt(Node): + idxname: str | None + relation: RangeVar | None + accessMethod: str | None + tableSpace: str | None + indexParams: tuple[Any, ...] | None + indexIncludingParams: tuple[Any, ...] | None + options: tuple[Any, ...] | None + whereClause: Node | None + excludeOpNames: tuple[Any, ...] | None + idxcomment: str | None + oldNumber: int | None + oldCreateSubid: int | None + oldFirstRelfilelocatorSubid: int | None + unique: bool | None + nulls_not_distinct: bool | None + primary: bool | None + isconstraint: bool | None + iswithoutoverlaps: bool | None + deferrable: bool | None + initdeferred: bool | None + transformed: bool | None + concurrent: bool | None + if_not_exists: bool | None + reset_default_tblspc: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, idxname: str | None = None, relation: RangeVar | _NodePayload | None = None, accessMethod: str | None = None, tableSpace: str | None = None, indexParams: _ListInput | None = None, indexIncludingParams: _ListInput | None = None, options: _ListInput | None = None, whereClause: Node | _NodePayload | None = None, excludeOpNames: _ListInput | None = None, idxcomment: str | None = None, oldNumber: int | None = None, oldCreateSubid: int | None = None, oldFirstRelfilelocatorSubid: int | None = None, unique: bool | int | None = None, nulls_not_distinct: bool | int | None = None, primary: bool | int | None = None, isconstraint: bool | int | None = None, iswithoutoverlaps: bool | int | None = None, deferrable: bool | int | None = None, initdeferred: bool | int | None = None, transformed: bool | int | None = None, concurrent: bool | int | None = None, if_not_exists: bool | int | None = None, reset_default_tblspc: bool | int | None = None) -> None: ... # noqa: E501 + + +class InferClause(Node): + indexElems: tuple[Any, ...] | None + whereClause: Node | None + conname: str | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, indexElems: _ListInput | None = None, whereClause: Node | _NodePayload | None = None, conname: str | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class InferenceElem(Expr): + expr: Node | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, expr: Node | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class InlineCodeBlock(Node): + source_text: str | None + langIsTrusted: bool | None + atomic: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, source_text: str | None = None, langIsTrusted: bool | int | None = None, atomic: bool | int | None = None) -> None: ... # noqa: E501 + + +class InsertStmt(Node): + relation: RangeVar | None + cols: tuple[Any, ...] | None + selectStmt: Node | None + onConflictClause: OnConflictClause | None + returningClause: ReturningClause | None + withClause: WithClause | None + override: enums.OverridingKind | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, relation: RangeVar | _NodePayload | None = None, cols: _ListInput | None = None, selectStmt: Node | _NodePayload | None = None, onConflictClause: OnConflictClause | _NodePayload | None = None, returningClause: ReturningClause | _NodePayload | None = None, withClause: WithClause | _NodePayload | None = None, override: enums.OverridingKind | int | str | dict[str, Any] | None = None) -> None: ... # noqa: E501 + + +class Integer(Node): + ival: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, ival: int | None = None) -> None: ... # noqa: E501 + + +class IntoClause(Node): + rel: RangeVar | None + colNames: tuple[Any, ...] | None + accessMethod: str | None + options: tuple[Any, ...] | None + onCommit: enums.OnCommitAction | None + tableSpaceName: str | None + viewQuery: Query | None + skipData: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, rel: RangeVar | _NodePayload | None = None, colNames: _ListInput | None = None, accessMethod: str | None = None, options: _ListInput | None = None, onCommit: enums.OnCommitAction | int | str | dict[str, Any] | None = None, tableSpaceName: str | None = None, viewQuery: Query | _NodePayload | None = None, skipData: bool | int | None = None) -> None: ... # noqa: E501 + + +class JoinExpr(Node): + jointype: enums.JoinType | None + isNatural: bool | None + larg: Node | None + rarg: Node | None + usingClause: tuple[Any, ...] | None + join_using_alias: Alias | None + quals: Node | None + alias: Alias | None + rtindex: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, jointype: enums.JoinType | int | str | dict[str, Any] | None = None, isNatural: bool | int | None = None, larg: Node | _NodePayload | None = None, rarg: Node | _NodePayload | None = None, usingClause: _ListInput | None = None, join_using_alias: Alias | _NodePayload | None = None, quals: Node | _NodePayload | None = None, alias: Alias | _NodePayload | None = None, rtindex: int | None = None) -> None: ... # noqa: E501 + + +class JsonAggConstructor(Node): + output: JsonOutput | None + agg_filter: Node | None + agg_order: tuple[Any, ...] | None + over: WindowDef | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, output: JsonOutput | _NodePayload | None = None, agg_filter: Node | _NodePayload | None = None, agg_order: _ListInput | None = None, over: WindowDef | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonArgument(Node): + val: JsonValueExpr | None + name: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, val: JsonValueExpr | _NodePayload | None = None, name: str | None = None) -> None: ... # noqa: E501 + + +class JsonArrayAgg(Node): + constructor: JsonAggConstructor | None + arg: JsonValueExpr | None + absent_on_null: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, constructor: JsonAggConstructor | _NodePayload | None = None, arg: JsonValueExpr | _NodePayload | None = None, absent_on_null: bool | int | None = None) -> None: ... # noqa: E501 + + +class JsonArrayConstructor(Node): + exprs: tuple[Any, ...] | None + output: JsonOutput | None + absent_on_null: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, exprs: _ListInput | None = None, output: JsonOutput | _NodePayload | None = None, absent_on_null: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonArrayQueryConstructor(Node): + query: Node | None + output: JsonOutput | None + format: JsonFormat | None + absent_on_null: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, query: Node | _NodePayload | None = None, output: JsonOutput | _NodePayload | None = None, format: JsonFormat | _NodePayload | None = None, absent_on_null: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonBehavior(Node): + btype: enums.JsonBehaviorType | None + expr: Node | None + coerce: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, btype: enums.JsonBehaviorType | int | str | dict[str, Any] | None = None, expr: Node | _NodePayload | None = None, coerce: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonConstructorExpr(Expr): + type: enums.JsonConstructorType | None + args: tuple[Any, ...] | None + func: Expr | None + coercion: Expr | None + returning: JsonReturning | None + absent_on_null: bool | None + unique: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, type: enums.JsonConstructorType | int | str | dict[str, Any] | None = None, args: _ListInput | None = None, func: Expr | _NodePayload | None = None, coercion: Expr | _NodePayload | None = None, returning: JsonReturning | _NodePayload | None = None, absent_on_null: bool | int | None = None, unique: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonExpr(Expr): + op: enums.JsonExprOp | None + column_name: str | None + formatted_expr: Node | None + format: JsonFormat | None + path_spec: Node | None + returning: JsonReturning | None + passing_names: tuple[Any, ...] | None + passing_values: tuple[Any, ...] | None + on_empty: JsonBehavior | None + on_error: JsonBehavior | None + use_io_coercion: bool | None + use_json_coercion: bool | None + wrapper: enums.JsonWrapper | None + omit_quotes: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, op: enums.JsonExprOp | int | str | dict[str, Any] | None = None, column_name: str | None = None, formatted_expr: Node | _NodePayload | None = None, format: JsonFormat | _NodePayload | None = None, path_spec: Node | _NodePayload | None = None, returning: JsonReturning | _NodePayload | None = None, passing_names: _ListInput | None = None, passing_values: _ListInput | None = None, on_empty: JsonBehavior | _NodePayload | None = None, on_error: JsonBehavior | _NodePayload | None = None, use_io_coercion: bool | int | None = None, use_json_coercion: bool | int | None = None, wrapper: enums.JsonWrapper | int | str | dict[str, Any] | None = None, omit_quotes: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonFormat(Node): + format_type: enums.JsonFormatType | None + encoding: enums.JsonEncoding | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, format_type: enums.JsonFormatType | int | str | dict[str, Any] | None = None, encoding: enums.JsonEncoding | int | str | dict[str, Any] | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonFuncExpr(Node): + op: enums.JsonExprOp | None + column_name: str | None + context_item: JsonValueExpr | None + pathspec: Node | None + passing: tuple[Any, ...] | None + output: JsonOutput | None + on_empty: JsonBehavior | None + on_error: JsonBehavior | None + wrapper: enums.JsonWrapper | None + quotes: enums.JsonQuotes | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, op: enums.JsonExprOp | int | str | dict[str, Any] | None = None, column_name: str | None = None, context_item: JsonValueExpr | _NodePayload | None = None, pathspec: Node | _NodePayload | None = None, passing: _ListInput | None = None, output: JsonOutput | _NodePayload | None = None, on_empty: JsonBehavior | _NodePayload | None = None, on_error: JsonBehavior | _NodePayload | None = None, wrapper: enums.JsonWrapper | int | str | dict[str, Any] | None = None, quotes: enums.JsonQuotes | int | str | dict[str, Any] | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonIsPredicate(Node): + expr: Node | None + format: JsonFormat | None + item_type: enums.JsonValueType | None + unique_keys: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, expr: Node | _NodePayload | None = None, format: JsonFormat | _NodePayload | None = None, item_type: enums.JsonValueType | int | str | dict[str, Any] | None = None, unique_keys: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonKeyValue(Node): + key: Expr | None + value: JsonValueExpr | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, key: Expr | _NodePayload | None = None, value: JsonValueExpr | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class JsonObjectAgg(Node): + constructor: JsonAggConstructor | None + arg: JsonKeyValue | None + absent_on_null: bool | None + unique: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, constructor: JsonAggConstructor | _NodePayload | None = None, arg: JsonKeyValue | _NodePayload | None = None, absent_on_null: bool | int | None = None, unique: bool | int | None = None) -> None: ... # noqa: E501 + + +class JsonObjectConstructor(Node): + exprs: tuple[Any, ...] | None + output: JsonOutput | None + absent_on_null: bool | None + unique: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, exprs: _ListInput | None = None, output: JsonOutput | _NodePayload | None = None, absent_on_null: bool | int | None = None, unique: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonOutput(Node): + typeName: TypeName | None + returning: JsonReturning | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, typeName: TypeName | _NodePayload | None = None, returning: JsonReturning | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class JsonParseExpr(Node): + expr: JsonValueExpr | None + output: JsonOutput | None + unique_keys: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, expr: JsonValueExpr | _NodePayload | None = None, output: JsonOutput | _NodePayload | None = None, unique_keys: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonReturning(Node): + format: JsonFormat | None + typmod: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, format: JsonFormat | _NodePayload | None = None, typmod: int | None = None) -> None: ... # noqa: E501 + + +class JsonScalarExpr(Node): + expr: Expr | None + output: JsonOutput | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, expr: Expr | _NodePayload | None = None, output: JsonOutput | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonSerializeExpr(Node): + expr: JsonValueExpr | None + output: JsonOutput | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, expr: JsonValueExpr | _NodePayload | None = None, output: JsonOutput | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonTable(Node): + context_item: JsonValueExpr | None + pathspec: JsonTablePathSpec | None + passing: tuple[Any, ...] | None + columns: tuple[Any, ...] | None + on_error: JsonBehavior | None + alias: Alias | None + lateral: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, context_item: JsonValueExpr | _NodePayload | None = None, pathspec: JsonTablePathSpec | _NodePayload | None = None, passing: _ListInput | None = None, columns: _ListInput | None = None, on_error: JsonBehavior | _NodePayload | None = None, alias: Alias | _NodePayload | None = None, lateral: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonTableColumn(Node): + coltype: enums.JsonTableColumnType | None + name: str | None + typeName: TypeName | None + pathspec: JsonTablePathSpec | None + format: JsonFormat | None + wrapper: enums.JsonWrapper | None + quotes: enums.JsonQuotes | None + columns: tuple[Any, ...] | None + on_empty: JsonBehavior | None + on_error: JsonBehavior | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, coltype: enums.JsonTableColumnType | int | str | dict[str, Any] | None = None, name: str | None = None, typeName: TypeName | _NodePayload | None = None, pathspec: JsonTablePathSpec | _NodePayload | None = None, format: JsonFormat | _NodePayload | None = None, wrapper: enums.JsonWrapper | int | str | dict[str, Any] | None = None, quotes: enums.JsonQuotes | int | str | dict[str, Any] | None = None, columns: _ListInput | None = None, on_empty: JsonBehavior | _NodePayload | None = None, on_error: JsonBehavior | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonTablePathSpec(Node): + string: Node | None + name: str | None + name_location: int | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, string: Node | _NodePayload | None = None, name: str | None = None, name_location: int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class JsonValueExpr(Node): + raw_expr: Expr | None + formatted_expr: Expr | None + format: JsonFormat | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, raw_expr: Expr | _NodePayload | None = None, formatted_expr: Expr | _NodePayload | None = None, format: JsonFormat | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class ListenStmt(Node): + conditionname: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, conditionname: str | None = None) -> None: ... # noqa: E501 + + +class LoadStmt(Node): + filename: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, filename: str | None = None) -> None: ... # noqa: E501 + + +class LockStmt(Node): + relations: tuple[Any, ...] | None + mode: int | None + nowait: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, relations: _ListInput | None = None, mode: int | None = None, nowait: bool | int | None = None) -> None: ... # noqa: E501 + + +class LockingClause(Node): + lockedRels: tuple[Any, ...] | None + strength: enums.LockClauseStrength | None + waitPolicy: enums.LockWaitPolicy | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, lockedRels: _ListInput | None = None, strength: enums.LockClauseStrength | int | str | dict[str, Any] | None = None, waitPolicy: enums.LockWaitPolicy | int | str | dict[str, Any] | None = None) -> None: ... # noqa: E501 + + +class MergeAction(Node): + matchKind: enums.MergeMatchKind | None + commandType: enums.CmdType | None + override: enums.OverridingKind | None + qual: Node | None + targetList: tuple[Any, ...] | None + updateColnos: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, matchKind: enums.MergeMatchKind | int | str | dict[str, Any] | None = None, commandType: enums.CmdType | int | str | dict[str, Any] | None = None, override: enums.OverridingKind | int | str | dict[str, Any] | None = None, qual: Node | _NodePayload | None = None, targetList: _ListInput | None = None, updateColnos: _ListInput | None = None) -> None: ... # noqa: E501 + + +class MergeStmt(Node): + relation: RangeVar | None + sourceRelation: Node | None + joinCondition: Node | None + mergeWhenClauses: tuple[Any, ...] | None + returningClause: ReturningClause | None + withClause: WithClause | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, relation: RangeVar | _NodePayload | None = None, sourceRelation: Node | _NodePayload | None = None, joinCondition: Node | _NodePayload | None = None, mergeWhenClauses: _ListInput | None = None, returningClause: ReturningClause | _NodePayload | None = None, withClause: WithClause | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class MergeSupportFunc(Expr): + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, location: int | None = None) -> None: ... # noqa: E501 + + +class MergeWhenClause(Node): + matchKind: enums.MergeMatchKind | None + commandType: enums.CmdType | None + override: enums.OverridingKind | None + condition: Node | None + targetList: tuple[Any, ...] | None + values: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, matchKind: enums.MergeMatchKind | int | str | dict[str, Any] | None = None, commandType: enums.CmdType | int | str | dict[str, Any] | None = None, override: enums.OverridingKind | int | str | dict[str, Any] | None = None, condition: Node | _NodePayload | None = None, targetList: _ListInput | None = None, values: _ListInput | None = None) -> None: ... # noqa: E501 + + +class MinMaxExpr(Expr): + op: enums.MinMaxOp | None + args: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, op: enums.MinMaxOp | int | str | dict[str, Any] | None = None, args: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class MultiAssignRef(Node): + source: Node | None + colno: int | None + ncolumns: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, source: Node | _NodePayload | None = None, colno: int | None = None, ncolumns: int | None = None) -> None: ... # noqa: E501 + + +class NamedArgExpr(Expr): + arg: Expr | None + name: str | None + argnumber: int | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, arg: Expr | _NodePayload | None = None, name: str | None = None, argnumber: int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class NotifyStmt(Node): + conditionname: str | None + payload: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, conditionname: str | None = None, payload: str | None = None) -> None: ... # noqa: E501 + + +class NullTest(Expr): + arg: Expr | None + nulltesttype: enums.NullTestType | None + argisrow: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, arg: Expr | _NodePayload | None = None, nulltesttype: enums.NullTestType | int | str | dict[str, Any] | None = None, argisrow: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class ObjectWithArgs(Node): + objname: tuple[Any, ...] | None + objargs: tuple[Any, ...] | None + objfuncargs: tuple[Any, ...] | None + args_unspecified: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, objname: _ListInput | None = None, objargs: _ListInput | None = None, objfuncargs: _ListInput | None = None, args_unspecified: bool | int | None = None) -> None: ... # noqa: E501 + + +class OnConflictClause(Node): + action: enums.OnConflictAction | None + infer: InferClause | None + targetList: tuple[Any, ...] | None + whereClause: Node | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, action: enums.OnConflictAction | int | str | dict[str, Any] | None = None, infer: InferClause | _NodePayload | None = None, targetList: _ListInput | None = None, whereClause: Node | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class OnConflictExpr(Node): + action: enums.OnConflictAction | None + arbiterElems: tuple[Any, ...] | None + arbiterWhere: Node | None + onConflictSet: tuple[Any, ...] | None + onConflictWhere: Node | None + exclRelIndex: int | None + exclRelTlist: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, action: enums.OnConflictAction | int | str | dict[str, Any] | None = None, arbiterElems: _ListInput | None = None, arbiterWhere: Node | _NodePayload | None = None, onConflictSet: _ListInput | None = None, onConflictWhere: Node | _NodePayload | None = None, exclRelIndex: int | None = None, exclRelTlist: _ListInput | None = None) -> None: ... # noqa: E501 + + +class OpExpr(Expr): + opretset: bool | None + args: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, opretset: bool | int | None = None, args: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class PLAssignStmt(Node): + name: str | None + indirection: tuple[Any, ...] | None + nnames: int | None + val: SelectStmt | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, name: str | None = None, indirection: _ListInput | None = None, nnames: int | None = None, val: SelectStmt | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class Param(Expr): + paramkind: enums.ParamKind | None + paramid: int | None + paramtypmod: int | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, paramkind: enums.ParamKind | int | str | dict[str, Any] | None = None, paramid: int | None = None, paramtypmod: int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class ParamRef(Node): + number: int | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, number: int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class PartitionBoundSpec(Node): + strategy: str | None + is_default: bool | None + modulus: int | None + remainder: int | None + listdatums: tuple[Any, ...] | None + lowerdatums: tuple[Any, ...] | None + upperdatums: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, strategy: _CharInput | None = None, is_default: bool | int | None = None, modulus: int | None = None, remainder: int | None = None, listdatums: _ListInput | None = None, lowerdatums: _ListInput | None = None, upperdatums: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class PartitionCmd(Node): + name: RangeVar | None + bound: PartitionBoundSpec | None + concurrent: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, name: RangeVar | _NodePayload | None = None, bound: PartitionBoundSpec | _NodePayload | None = None, concurrent: bool | int | None = None) -> None: ... # noqa: E501 + + +class PartitionElem(Node): + name: str | None + expr: Node | None + collation: tuple[Any, ...] | None + opclass: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, name: str | None = None, expr: Node | _NodePayload | None = None, collation: _ListInput | None = None, opclass: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class PartitionRangeDatum(Node): + kind: enums.PartitionRangeDatumKind | None + value: Node | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, kind: enums.PartitionRangeDatumKind | int | str | dict[str, Any] | None = None, value: Node | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class PartitionSpec(Node): + strategy: enums.PartitionStrategy | None + partParams: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, strategy: enums.PartitionStrategy | int | str | dict[str, Any] | None = None, partParams: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class PrepareStmt(Node): + name: str | None + argtypes: tuple[Any, ...] | None + query: Node | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, name: str | None = None, argtypes: _ListInput | None = None, query: Node | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class PublicationObjSpec(Node): + pubobjtype: enums.PublicationObjSpecType | None + name: str | None + pubtable: PublicationTable | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, pubobjtype: enums.PublicationObjSpecType | int | str | dict[str, Any] | None = None, name: str | None = None, pubtable: PublicationTable | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class PublicationTable(Node): + relation: RangeVar | None + whereClause: Node | None + columns: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, relation: RangeVar | _NodePayload | None = None, whereClause: Node | _NodePayload | None = None, columns: _ListInput | None = None) -> None: ... # noqa: E501 + + +class Query(Node): + commandType: enums.CmdType | None + querySource: enums.QuerySource | None + canSetTag: bool | None + utilityStmt: Node | None + resultRelation: int | None + hasAggs: bool | None + hasWindowFuncs: bool | None + hasTargetSRFs: bool | None + hasSubLinks: bool | None + hasDistinctOn: bool | None + hasRecursive: bool | None + hasModifyingCTE: bool | None + hasForUpdate: bool | None + hasRowSecurity: bool | None + hasGroupRTE: bool | None + isReturn: bool | None + cteList: tuple[Any, ...] | None + rtable: tuple[Any, ...] | None + rteperminfos: tuple[Any, ...] | None + jointree: FromExpr | None + mergeActionList: tuple[Any, ...] | None + mergeTargetRelation: int | None + mergeJoinCondition: Node | None + targetList: tuple[Any, ...] | None + override: enums.OverridingKind | None + onConflict: OnConflictExpr | None + returningOldAlias: str | None + returningNewAlias: str | None + returningList: tuple[Any, ...] | None + groupClause: tuple[Any, ...] | None + groupDistinct: bool | None + groupingSets: tuple[Any, ...] | None + havingQual: Node | None + windowClause: tuple[Any, ...] | None + distinctClause: tuple[Any, ...] | None + sortClause: tuple[Any, ...] | None + limitOffset: Node | None + limitCount: Node | None + limitOption: enums.LimitOption | None + rowMarks: tuple[Any, ...] | None + setOperations: Node | None + constraintDeps: tuple[Any, ...] | None + withCheckOptions: tuple[Any, ...] | None + stmt_location: int | None + stmt_len: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, commandType: enums.CmdType | int | str | dict[str, Any] | None = None, querySource: enums.QuerySource | int | str | dict[str, Any] | None = None, canSetTag: bool | int | None = None, utilityStmt: Node | _NodePayload | None = None, resultRelation: int | None = None, hasAggs: bool | int | None = None, hasWindowFuncs: bool | int | None = None, hasTargetSRFs: bool | int | None = None, hasSubLinks: bool | int | None = None, hasDistinctOn: bool | int | None = None, hasRecursive: bool | int | None = None, hasModifyingCTE: bool | int | None = None, hasForUpdate: bool | int | None = None, hasRowSecurity: bool | int | None = None, hasGroupRTE: bool | int | None = None, isReturn: bool | int | None = None, cteList: _ListInput | None = None, rtable: _ListInput | None = None, rteperminfos: _ListInput | None = None, jointree: FromExpr | _NodePayload | None = None, mergeActionList: _ListInput | None = None, mergeTargetRelation: int | None = None, mergeJoinCondition: Node | _NodePayload | None = None, targetList: _ListInput | None = None, override: enums.OverridingKind | int | str | dict[str, Any] | None = None, onConflict: OnConflictExpr | _NodePayload | None = None, returningOldAlias: str | None = None, returningNewAlias: str | None = None, returningList: _ListInput | None = None, groupClause: _ListInput | None = None, groupDistinct: bool | int | None = None, groupingSets: _ListInput | None = None, havingQual: Node | _NodePayload | None = None, windowClause: _ListInput | None = None, distinctClause: _ListInput | None = None, sortClause: _ListInput | None = None, limitOffset: Node | _NodePayload | None = None, limitCount: Node | _NodePayload | None = None, limitOption: enums.LimitOption | int | str | dict[str, Any] | None = None, rowMarks: _ListInput | None = None, setOperations: Node | _NodePayload | None = None, constraintDeps: _ListInput | None = None, withCheckOptions: _ListInput | None = None, stmt_location: int | None = None, stmt_len: int | None = None) -> None: ... # noqa: E501 + + +class RTEPermissionInfo(Node): + inh: bool | None + requiredPerms: int | None + selectedCols: set[int] | None + insertedCols: set[int] | None + updatedCols: set[int] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, inh: bool | int | None = None, requiredPerms: int | None = None, selectedCols: _BitmapsetInput | None = None, insertedCols: _BitmapsetInput | None = None, updatedCols: _BitmapsetInput | None = None) -> None: ... # noqa: E501 + + +class RangeFunction(Node): + lateral: bool | None + ordinality: bool | None + is_rowsfrom: bool | None + functions: tuple[Any, ...] | None + alias: Alias | None + coldeflist: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, lateral: bool | int | None = None, ordinality: bool | int | None = None, is_rowsfrom: bool | int | None = None, functions: _ListInput | None = None, alias: Alias | _NodePayload | None = None, coldeflist: _ListInput | None = None) -> None: ... # noqa: E501 + + +class RangeSubselect(Node): + lateral: bool | None + subquery: Node | None + alias: Alias | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, lateral: bool | int | None = None, subquery: Node | _NodePayload | None = None, alias: Alias | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class RangeTableFunc(Node): + lateral: bool | None + docexpr: Node | None + rowexpr: Node | None + namespaces: tuple[Any, ...] | None + columns: tuple[Any, ...] | None + alias: Alias | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, lateral: bool | int | None = None, docexpr: Node | _NodePayload | None = None, rowexpr: Node | _NodePayload | None = None, namespaces: _ListInput | None = None, columns: _ListInput | None = None, alias: Alias | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class RangeTableFuncCol(Node): + colname: str | None + typeName: TypeName | None + for_ordinality: bool | None + is_not_null: bool | None + colexpr: Node | None + coldefexpr: Node | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, colname: str | None = None, typeName: TypeName | _NodePayload | None = None, for_ordinality: bool | int | None = None, is_not_null: bool | int | None = None, colexpr: Node | _NodePayload | None = None, coldefexpr: Node | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class RangeTableSample(Node): + relation: Node | None + method: tuple[Any, ...] | None + args: tuple[Any, ...] | None + repeatable: Node | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, relation: Node | _NodePayload | None = None, method: _ListInput | None = None, args: _ListInput | None = None, repeatable: Node | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class RangeTblEntry(Node): + alias: Alias | None + eref: Alias | None + rtekind: enums.RTEKind | None + inh: bool | None + relkind: str | None + rellockmode: int | None + perminfoindex: int | None + tablesample: TableSampleClause | None + subquery: Query | None + security_barrier: bool | None + jointype: enums.JoinType | None + joinmergedcols: int | None + joinaliasvars: tuple[Any, ...] | None + joinleftcols: tuple[Any, ...] | None + joinrightcols: tuple[Any, ...] | None + join_using_alias: Alias | None + functions: tuple[Any, ...] | None + funcordinality: bool | None + tablefunc: TableFunc | None + values_lists: tuple[Any, ...] | None + ctename: str | None + ctelevelsup: int | None + self_reference: bool | None + coltypes: tuple[Any, ...] | None + coltypmods: tuple[Any, ...] | None + colcollations: tuple[Any, ...] | None + enrname: str | None + enrtuples: float | None + groupexprs: tuple[Any, ...] | None + lateral: bool | None + inFromCl: bool | None + securityQuals: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, alias: Alias | _NodePayload | None = None, eref: Alias | _NodePayload | None = None, rtekind: enums.RTEKind | int | str | dict[str, Any] | None = None, inh: bool | int | None = None, relkind: _CharInput | None = None, rellockmode: int | None = None, perminfoindex: int | None = None, tablesample: TableSampleClause | _NodePayload | None = None, subquery: Query | _NodePayload | None = None, security_barrier: bool | int | None = None, jointype: enums.JoinType | int | str | dict[str, Any] | None = None, joinmergedcols: int | None = None, joinaliasvars: _ListInput | None = None, joinleftcols: _ListInput | None = None, joinrightcols: _ListInput | None = None, join_using_alias: Alias | _NodePayload | None = None, functions: _ListInput | None = None, funcordinality: bool | int | None = None, tablefunc: TableFunc | _NodePayload | None = None, values_lists: _ListInput | None = None, ctename: str | None = None, ctelevelsup: int | None = None, self_reference: bool | int | None = None, coltypes: _ListInput | None = None, coltypmods: _ListInput | None = None, colcollations: _ListInput | None = None, enrname: str | None = None, enrtuples: float | None = None, groupexprs: _ListInput | None = None, lateral: bool | int | None = None, inFromCl: bool | int | None = None, securityQuals: _ListInput | None = None) -> None: ... # noqa: E501 + + +class RangeTblFunction(Node): + funcexpr: Node | None + funccolcount: int | None + funccolnames: tuple[Any, ...] | None + funccoltypes: tuple[Any, ...] | None + funccoltypmods: tuple[Any, ...] | None + funccolcollations: tuple[Any, ...] | None + funcparams: set[int] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, funcexpr: Node | _NodePayload | None = None, funccolcount: int | None = None, funccolnames: _ListInput | None = None, funccoltypes: _ListInput | None = None, funccoltypmods: _ListInput | None = None, funccolcollations: _ListInput | None = None, funcparams: _BitmapsetInput | None = None) -> None: ... # noqa: E501 + + +class RangeTblRef(Node): + rtindex: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, rtindex: int | None = None) -> None: ... # noqa: E501 + + +class RangeVar(Node): + catalogname: str | None + schemaname: str | None + relname: str | None + inh: bool | None + relpersistence: str | None + alias: Alias | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, catalogname: str | None = None, schemaname: str | None = None, relname: str | None = None, inh: bool | int | None = None, relpersistence: _CharInput | None = None, alias: Alias | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class RawStmt(Node): + stmt: Node + stmt_location: int | None + stmt_len: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, stmt: Node | _NodePayload | None = None, stmt_location: int | None = None, stmt_len: int | None = None) -> None: ... # noqa: E501 + + +class ReassignOwnedStmt(Node): + roles: tuple[Any, ...] | None + newrole: RoleSpec | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, roles: _ListInput | None = None, newrole: RoleSpec | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class RefreshMatViewStmt(Node): + concurrent: bool | None + skipData: bool | None + relation: RangeVar | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, concurrent: bool | int | None = None, skipData: bool | int | None = None, relation: RangeVar | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class ReindexStmt(Node): + kind: enums.ReindexObjectType | None + relation: RangeVar | None + name: str | None + params: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, kind: enums.ReindexObjectType | int | str | dict[str, Any] | None = None, relation: RangeVar | _NodePayload | None = None, name: str | None = None, params: _ListInput | None = None) -> None: ... # noqa: E501 + + +class RelabelType(Expr): + arg: Expr | None + resulttypmod: int | None + relabelformat: enums.CoercionForm | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, arg: Expr | _NodePayload | None = None, resulttypmod: int | None = None, relabelformat: enums.CoercionForm | int | str | dict[str, Any] | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class RenameStmt(Node): + renameType: enums.ObjectType | None + relationType: enums.ObjectType | None + relation: RangeVar | None + object: Node | None + subname: str | None + newname: str | None + behavior: enums.DropBehavior | None + missing_ok: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, renameType: enums.ObjectType | int | str | dict[str, Any] | None = None, relationType: enums.ObjectType | int | str | dict[str, Any] | None = None, relation: RangeVar | _NodePayload | None = None, object: Node | _NodePayload | None = None, subname: str | None = None, newname: str | None = None, behavior: enums.DropBehavior | int | str | dict[str, Any] | None = None, missing_ok: bool | int | None = None) -> None: ... # noqa: E501 + + +class ReplicaIdentityStmt(Node): + identity_type: str | None + name: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, identity_type: _CharInput | None = None, name: str | None = None) -> None: ... # noqa: E501 + + +class ResTarget(Node): + name: str | None + indirection: tuple[Any, ...] | None + val: Node | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, name: str | None = None, indirection: _ListInput | None = None, val: Node | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class ReturnStmt(Node): + returnval: Node | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, returnval: Node | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class ReturningClause(Node): + options: tuple[Any, ...] | None + exprs: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, options: _ListInput | None = None, exprs: _ListInput | None = None) -> None: ... # noqa: E501 + + +class ReturningExpr(Expr): + retlevelsup: int | None + retold: bool | None + retexpr: Expr | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, retlevelsup: int | None = None, retold: bool | int | None = None, retexpr: Expr | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class ReturningOption(Node): + option: enums.ReturningOptionKind | None + value: str | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, option: enums.ReturningOptionKind | int | str | dict[str, Any] | None = None, value: str | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class RoleSpec(Node): + roletype: enums.RoleSpecType | None + rolename: str | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, roletype: enums.RoleSpecType | int | str | dict[str, Any] | None = None, rolename: str | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class RowCompareExpr(Expr): + cmptype: enums.CompareType | None + opnos: tuple[Any, ...] | None + opfamilies: tuple[Any, ...] | None + inputcollids: tuple[Any, ...] | None + largs: tuple[Any, ...] | None + rargs: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, cmptype: enums.CompareType | int | str | dict[str, Any] | None = None, opnos: _ListInput | None = None, opfamilies: _ListInput | None = None, inputcollids: _ListInput | None = None, largs: _ListInput | None = None, rargs: _ListInput | None = None) -> None: ... # noqa: E501 + + +class RowExpr(Expr): + args: tuple[Any, ...] | None + row_format: enums.CoercionForm | None + colnames: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, args: _ListInput | None = None, row_format: enums.CoercionForm | int | str | dict[str, Any] | None = None, colnames: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class RowMarkClause(Node): + rti: int | None + strength: enums.LockClauseStrength | None + waitPolicy: enums.LockWaitPolicy | None + pushedDown: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, rti: int | None = None, strength: enums.LockClauseStrength | int | str | dict[str, Any] | None = None, waitPolicy: enums.LockWaitPolicy | int | str | dict[str, Any] | None = None, pushedDown: bool | int | None = None) -> None: ... # noqa: E501 + + +class RuleStmt(Node): + relation: RangeVar | None + rulename: str | None + whereClause: Node | None + event: enums.CmdType | None + instead: bool | None + actions: tuple[Any, ...] | None + replace: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, relation: RangeVar | _NodePayload | None = None, rulename: str | None = None, whereClause: Node | _NodePayload | None = None, event: enums.CmdType | int | str | dict[str, Any] | None = None, instead: bool | int | None = None, actions: _ListInput | None = None, replace: bool | int | None = None) -> None: ... # noqa: E501 + + +class SQLValueFunction(Expr): + op: enums.SQLValueFunctionOp | None + typmod: int | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, op: enums.SQLValueFunctionOp | int | str | dict[str, Any] | None = None, typmod: int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class ScalarArrayOpExpr(Expr): + useOr: bool | None + args: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, useOr: bool | int | None = None, args: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class SecLabelStmt(Node): + objtype: enums.ObjectType | None + object: Node | None + provider: str | None + label: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, objtype: enums.ObjectType | int | str | dict[str, Any] | None = None, object: Node | _NodePayload | None = None, provider: str | None = None, label: str | None = None) -> None: ... # noqa: E501 + + +class SelectStmt(Node): + distinctClause: tuple[Any, ...] | None + intoClause: IntoClause | None + targetList: tuple[Any, ...] | None + fromClause: tuple[Any, ...] | None + whereClause: Node | None + groupClause: tuple[Any, ...] | None + groupDistinct: bool | None + havingClause: Node | None + windowClause: tuple[Any, ...] | None + valuesLists: tuple[Any, ...] | None + sortClause: tuple[Any, ...] | None + limitOffset: Node | None + limitCount: Node | None + limitOption: enums.LimitOption | None + lockingClause: tuple[Any, ...] | None + withClause: WithClause | None + op: enums.SetOperation | None + all: bool | None + larg: SelectStmt | None + rarg: SelectStmt | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, distinctClause: _ListInput | None = None, intoClause: IntoClause | _NodePayload | None = None, targetList: _ListInput | None = None, fromClause: _ListInput | None = None, whereClause: Node | _NodePayload | None = None, groupClause: _ListInput | None = None, groupDistinct: bool | int | None = None, havingClause: Node | _NodePayload | None = None, windowClause: _ListInput | None = None, valuesLists: _ListInput | None = None, sortClause: _ListInput | None = None, limitOffset: Node | _NodePayload | None = None, limitCount: Node | _NodePayload | None = None, limitOption: enums.LimitOption | int | str | dict[str, Any] | None = None, lockingClause: _ListInput | None = None, withClause: WithClause | _NodePayload | None = None, op: enums.SetOperation | int | str | dict[str, Any] | None = None, all: bool | int | None = None, larg: SelectStmt | _NodePayload | None = None, rarg: SelectStmt | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class SetOperationStmt(Node): + op: enums.SetOperation | None + all: bool | None + larg: Node | None + rarg: Node | None + colTypes: tuple[Any, ...] | None + colTypmods: tuple[Any, ...] | None + colCollations: tuple[Any, ...] | None + groupClauses: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, op: enums.SetOperation | int | str | dict[str, Any] | None = None, all: bool | int | None = None, larg: Node | _NodePayload | None = None, rarg: Node | _NodePayload | None = None, colTypes: _ListInput | None = None, colTypmods: _ListInput | None = None, colCollations: _ListInput | None = None, groupClauses: _ListInput | None = None) -> None: ... # noqa: E501 + + +class SetToDefault(Expr): + typeMod: int | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, typeMod: int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class SortBy(Node): + node: Node | None + sortby_dir: enums.SortByDir | None + sortby_nulls: enums.SortByNulls | None + useOp: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, node: Node | _NodePayload | None = None, sortby_dir: enums.SortByDir | int | str | dict[str, Any] | None = None, sortby_nulls: enums.SortByNulls | int | str | dict[str, Any] | None = None, useOp: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class SortGroupClause(Node): + tleSortGroupRef: int | None + reverse_sort: bool | None + nulls_first: bool | None + hashable: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, tleSortGroupRef: int | None = None, reverse_sort: bool | int | None = None, nulls_first: bool | int | None = None, hashable: bool | int | None = None) -> None: ... # noqa: E501 + + +class StatsElem(Node): + name: str | None + expr: Node | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, name: str | None = None, expr: Node | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class String(Node): + sval: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, sval: str | None = None) -> None: ... # noqa: E501 + + +class SubLink(Expr): + subLinkType: enums.SubLinkType | None + subLinkId: int | None + testexpr: Node | None + operName: tuple[Any, ...] | None + subselect: Node | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, subLinkType: enums.SubLinkType | int | str | dict[str, Any] | None = None, subLinkId: int | None = None, testexpr: Node | _NodePayload | None = None, operName: _ListInput | None = None, subselect: Node | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class SubPlan(Expr): + subLinkType: enums.SubLinkType | None + testexpr: Node | None + paramIds: tuple[Any, ...] | None + plan_id: int | None + plan_name: str | None + firstColTypmod: int | None + useHashTable: bool | None + unknownEqFalse: bool | None + parallel_safe: bool | None + setParam: tuple[Any, ...] | None + parParam: tuple[Any, ...] | None + args: tuple[Any, ...] | None + startup_cost: float | None + per_call_cost: float | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, subLinkType: enums.SubLinkType | int | str | dict[str, Any] | None = None, testexpr: Node | _NodePayload | None = None, paramIds: _ListInput | None = None, plan_id: int | None = None, plan_name: str | None = None, firstColTypmod: int | None = None, useHashTable: bool | int | None = None, unknownEqFalse: bool | int | None = None, parallel_safe: bool | int | None = None, setParam: _ListInput | None = None, parParam: _ListInput | None = None, args: _ListInput | None = None, startup_cost: float | None = None, per_call_cost: float | None = None) -> None: ... # noqa: E501 + + +class SubscriptingRef(Expr): + reftypmod: int | None + refupperindexpr: tuple[Any, ...] | None + reflowerindexpr: tuple[Any, ...] | None + refexpr: Expr | None + refassgnexpr: Expr | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, reftypmod: int | None = None, refupperindexpr: _ListInput | None = None, reflowerindexpr: _ListInput | None = None, refexpr: Expr | _NodePayload | None = None, refassgnexpr: Expr | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class TableFunc(Node): + functype: enums.TableFuncType | None + ns_uris: tuple[Any, ...] | None + ns_names: tuple[Any, ...] | None + docexpr: Node | None + rowexpr: Node | None + colnames: tuple[Any, ...] | None + coltypes: tuple[Any, ...] | None + coltypmods: tuple[Any, ...] | None + colcollations: tuple[Any, ...] | None + colexprs: tuple[Any, ...] | None + coldefexprs: tuple[Any, ...] | None + colvalexprs: tuple[Any, ...] | None + passingvalexprs: tuple[Any, ...] | None + notnulls: set[int] | None + plan: Node | None + ordinalitycol: int | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, functype: enums.TableFuncType | int | str | dict[str, Any] | None = None, ns_uris: _ListInput | None = None, ns_names: _ListInput | None = None, docexpr: Node | _NodePayload | None = None, rowexpr: Node | _NodePayload | None = None, colnames: _ListInput | None = None, coltypes: _ListInput | None = None, coltypmods: _ListInput | None = None, colcollations: _ListInput | None = None, colexprs: _ListInput | None = None, coldefexprs: _ListInput | None = None, colvalexprs: _ListInput | None = None, passingvalexprs: _ListInput | None = None, notnulls: _BitmapsetInput | None = None, plan: Node | _NodePayload | None = None, ordinalitycol: int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class TableLikeClause(Node): + relation: RangeVar | None + options: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, relation: RangeVar | _NodePayload | None = None, options: int | None = None) -> None: ... # noqa: E501 + + +class TableSampleClause(Node): + args: tuple[Any, ...] | None + repeatable: Expr | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, args: _ListInput | None = None, repeatable: Expr | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class TargetEntry(Expr): + expr: Expr | None + resno: int | None + resname: str | None + ressortgroupref: int | None + resorigcol: int | None + resjunk: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, expr: Expr | _NodePayload | None = None, resno: int | None = None, resname: str | None = None, ressortgroupref: int | None = None, resorigcol: int | None = None, resjunk: bool | int | None = None) -> None: ... # noqa: E501 + + +class TransactionStmt(Node): + kind: enums.TransactionStmtKind | None + options: tuple[Any, ...] | None + savepoint_name: str | None + gid: str | None + chain: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, kind: enums.TransactionStmtKind | int | str | dict[str, Any] | None = None, options: _ListInput | None = None, savepoint_name: str | None = None, gid: str | None = None, chain: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class TriggerTransition(Node): + name: str | None + isNew: bool | None + isTable: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, name: str | None = None, isNew: bool | int | None = None, isTable: bool | int | None = None) -> None: ... # noqa: E501 + + +class TruncateStmt(Node): + relations: tuple[Any, ...] | None + restart_seqs: bool | None + behavior: enums.DropBehavior | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, relations: _ListInput | None = None, restart_seqs: bool | int | None = None, behavior: enums.DropBehavior | int | str | dict[str, Any] | None = None) -> None: ... # noqa: E501 + + +class TypeCast(Node): + arg: Node | None + typeName: TypeName | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, arg: Node | _NodePayload | None = None, typeName: TypeName | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class TypeName(Node): + names: tuple[Any, ...] | None + setof: bool | None + pct_type: bool | None + typmods: tuple[Any, ...] | None + typemod: int | None + arrayBounds: tuple[Any, ...] | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, names: _ListInput | None = None, setof: bool | int | None = None, pct_type: bool | int | None = None, typmods: _ListInput | None = None, typemod: int | None = None, arrayBounds: _ListInput | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class UnlistenStmt(Node): + conditionname: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, conditionname: str | None = None) -> None: ... # noqa: E501 + + +class UpdateStmt(Node): + relation: RangeVar | None + targetList: tuple[Any, ...] | None + whereClause: Node | None + fromClause: tuple[Any, ...] | None + returningClause: ReturningClause | None + withClause: WithClause | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, relation: RangeVar | _NodePayload | None = None, targetList: _ListInput | None = None, whereClause: Node | _NodePayload | None = None, fromClause: _ListInput | None = None, returningClause: ReturningClause | _NodePayload | None = None, withClause: WithClause | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class VacuumRelation(Node): + relation: RangeVar | None + va_cols: tuple[Any, ...] | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, relation: RangeVar | _NodePayload | None = None, va_cols: _ListInput | None = None) -> None: ... # noqa: E501 + + +class VacuumStmt(Node): + options: tuple[Any, ...] | None + rels: tuple[Any, ...] | None + is_vacuumcmd: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, options: _ListInput | None = None, rels: _ListInput | None = None, is_vacuumcmd: bool | int | None = None) -> None: ... # noqa: E501 + + +class Var(Expr): + varno: int | None + varattno: int | None + vartypmod: int | None + varnullingrels: set[int] | None + varlevelsup: int | None + varreturningtype: enums.VarReturningType | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, varno: int | None = None, varattno: int | None = None, vartypmod: int | None = None, varnullingrels: _BitmapsetInput | None = None, varlevelsup: int | None = None, varreturningtype: enums.VarReturningType | int | str | dict[str, Any] | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class VariableSetStmt(Node): + kind: enums.VariableSetKind | None + name: str | None + args: tuple[Any, ...] | None + jumble_args: bool | None + is_local: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, kind: enums.VariableSetKind | int | str | dict[str, Any] | None = None, name: str | None = None, args: _ListInput | None = None, jumble_args: bool | int | None = None, is_local: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class VariableShowStmt(Node): + name: str | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, name: str | None = None) -> None: ... # noqa: E501 + + +class ViewStmt(Node): + view: RangeVar | None + aliases: tuple[Any, ...] | None + query: Node | None + replace: bool | None + options: tuple[Any, ...] | None + withCheckOption: enums.ViewCheckOption | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, view: RangeVar | _NodePayload | None = None, aliases: _ListInput | None = None, query: Node | _NodePayload | None = None, replace: bool | int | None = None, options: _ListInput | None = None, withCheckOption: enums.ViewCheckOption | int | str | dict[str, Any] | None = None) -> None: ... # noqa: E501 + + +class WindowClause(Node): + name: str | None + refname: str | None + partitionClause: tuple[Any, ...] | None + orderClause: tuple[Any, ...] | None + frameOptions: int | None + startOffset: Node | None + endOffset: Node | None + inRangeAsc: bool | None + inRangeNullsFirst: bool | None + winref: int | None + copiedOrder: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, name: str | None = None, refname: str | None = None, partitionClause: _ListInput | None = None, orderClause: _ListInput | None = None, frameOptions: int | None = None, startOffset: Node | _NodePayload | None = None, endOffset: Node | _NodePayload | None = None, inRangeAsc: bool | int | None = None, inRangeNullsFirst: bool | int | None = None, winref: int | None = None, copiedOrder: bool | int | None = None) -> None: ... # noqa: E501 + + +class WindowDef(Node): + name: str | None + refname: str | None + partitionClause: tuple[Any, ...] | None + orderClause: tuple[Any, ...] | None + frameOptions: int | None + startOffset: Node | None + endOffset: Node | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, name: str | None = None, refname: str | None = None, partitionClause: _ListInput | None = None, orderClause: _ListInput | None = None, frameOptions: int | None = None, startOffset: Node | _NodePayload | None = None, endOffset: Node | _NodePayload | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class WindowFunc(Expr): + args: tuple[Any, ...] | None + aggfilter: Expr | None + runCondition: tuple[Any, ...] | None + winref: int | None + winstar: bool | None + winagg: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, args: _ListInput | None = None, aggfilter: Expr | _NodePayload | None = None, runCondition: _ListInput | None = None, winref: int | None = None, winstar: bool | int | None = None, winagg: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class WindowFuncRunCondition(Expr): + wfunc_left: bool | None + arg: Expr | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, wfunc_left: bool | int | None = None, arg: Expr | _NodePayload | None = None) -> None: ... # noqa: E501 + + +class WithCheckOption(Node): + kind: enums.WCOKind | None + relname: str | None + polname: str | None + qual: Node | None + cascaded: bool | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, kind: enums.WCOKind | int | str | dict[str, Any] | None = None, relname: str | None = None, polname: str | None = None, qual: Node | _NodePayload | None = None, cascaded: bool | int | None = None) -> None: ... # noqa: E501 + + +class WithClause(Node): + ctes: tuple[Any, ...] | None + recursive: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, ctes: _ListInput | None = None, recursive: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class XmlExpr(Expr): + op: enums.XmlExprOp | None + name: str | None + named_args: tuple[Any, ...] | None + arg_names: tuple[Any, ...] | None + args: tuple[Any, ...] | None + xmloption: enums.XmlOptionType | None + indent: bool | None + typmod: int | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, op: enums.XmlExprOp | int | str | dict[str, Any] | None = None, name: str | None = None, named_args: _ListInput | None = None, arg_names: _ListInput | None = None, args: _ListInput | None = None, xmloption: enums.XmlOptionType | int | str | dict[str, Any] | None = None, indent: bool | int | None = None, typmod: int | None = None, location: int | None = None) -> None: ... # noqa: E501 + + +class XmlSerialize(Node): + xmloption: enums.XmlOptionType | None + expr: Node | None + typeName: TypeName | None + indent: bool | None + location: int | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, xmloption: enums.XmlOptionType | int | str | dict[str, Any] | None = None, expr: Node | _NodePayload | None = None, typeName: TypeName | _NodePayload | None = None, indent: bool | int | None = None, location: int | None = None) -> None: ... # noqa: E501 diff --git a/pglast/enums/__init__.pyi b/pglast/enums/__init__.pyi new file mode 100644 index 0000000..e9494bf --- /dev/null +++ b/pglast/enums/__init__.pyi @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from __init__.py +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# + +from .cmptype import * # noqa +from .pg_am import * # noqa +from .pg_attribute import * # noqa +from .pg_class import * # noqa +from .pg_trigger import * # noqa +from .lockoptions import * # noqa +from .nodes import * # noqa +from .parsenodes import * # noqa +from .primnodes import * # noqa +from .lockdefs import * # noqa +from .xml import * # noqa diff --git a/pglast/enums/cmptype.pyi b/pglast/enums/cmptype.pyi new file mode 100644 index 0000000..747f509 --- /dev/null +++ b/pglast/enums/cmptype.pyi @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from cmptype.h @ 18.0.0-0-g204fbdb +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2017-2026 Lele Gaifax +# + +from enum import IntEnum + + +class CompareType(IntEnum): + COMPARE_INVALID = ... + COMPARE_LT = ... + COMPARE_LE = ... + COMPARE_EQ = ... + COMPARE_GE = ... + COMPARE_GT = ... + COMPARE_NE = ... + COMPARE_OVERLAP = ... + COMPARE_CONTAINED_BY = ... diff --git a/pglast/enums/lockdefs.pyi b/pglast/enums/lockdefs.pyi new file mode 100644 index 0000000..aac1601 --- /dev/null +++ b/pglast/enums/lockdefs.pyi @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from lockdefs.h @ 18.0.0-0-g204fbdb +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2017-2026 Lele Gaifax +# + +NoLock: int + +AccessShareLock: int + +RowShareLock: int + +RowExclusiveLock: int + +ShareUpdateExclusiveLock: int + +ShareLock: int + +ShareRowExclusiveLock: int + +ExclusiveLock: int + +AccessExclusiveLock: int + +MaxLockMode: int diff --git a/pglast/enums/lockoptions.pyi b/pglast/enums/lockoptions.pyi new file mode 100644 index 0000000..4af0155 --- /dev/null +++ b/pglast/enums/lockoptions.pyi @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from lockoptions.h @ 18.0.0-0-g204fbdb +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2017-2026 Lele Gaifax +# + +from enum import IntEnum + + +class LockClauseStrength(IntEnum): + LCS_NONE = ... + LCS_FORKEYSHARE = ... + LCS_FORSHARE = ... + LCS_FORNOKEYUPDATE = ... + LCS_FORUPDATE = ... + + +class LockTupleMode(IntEnum): + LockTupleKeyShare = ... + LockTupleShare = ... + LockTupleNoKeyExclusive = ... + LockTupleExclusive = ... + + +class LockWaitPolicy(IntEnum): + LockWaitBlock = ... + LockWaitSkip = ... + LockWaitError = ... diff --git a/pglast/enums/nodes.pyi b/pglast/enums/nodes.pyi new file mode 100644 index 0000000..d3bcd82 --- /dev/null +++ b/pglast/enums/nodes.pyi @@ -0,0 +1,560 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from nodes.h @ 18.0.0-0-g204fbdb +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2017-2026 Lele Gaifax +# + +from enum import IntEnum + + +class AggSplit(IntEnum): + AGGSPLIT_SIMPLE = ... + AGGSPLIT_INITIAL_SERIAL = ... + AGGSPLIT_FINAL_DESERIAL = ... + + +class AggStrategy(IntEnum): + AGG_PLAIN = ... + AGG_SORTED = ... + AGG_HASHED = ... + AGG_MIXED = ... + + +class CmdType(IntEnum): + CMD_UNKNOWN = ... + CMD_SELECT = ... + CMD_UPDATE = ... + CMD_INSERT = ... + CMD_DELETE = ... + CMD_MERGE = ... + CMD_UTILITY = ... + CMD_NOTHING = ... + + +class JoinType(IntEnum): + JOIN_INNER = ... + JOIN_LEFT = ... + JOIN_FULL = ... + JOIN_RIGHT = ... + JOIN_SEMI = ... + JOIN_ANTI = ... + JOIN_RIGHT_SEMI = ... + JOIN_RIGHT_ANTI = ... + JOIN_UNIQUE_OUTER = ... + JOIN_UNIQUE_INNER = ... + + +class LimitOption(IntEnum): + LIMIT_OPTION_DEFAULT = ... + LIMIT_OPTION_COUNT = ... + LIMIT_OPTION_WITH_TIES = ... + + +class NodeTag(IntEnum): + T_Invalid = ... + T_List = ... + T_Alias = ... + T_RangeVar = ... + T_TableFunc = ... + T_IntoClause = ... + T_Var = ... + T_Const = ... + T_Param = ... + T_Aggref = ... + T_GroupingFunc = ... + T_WindowFunc = ... + T_WindowFuncRunCondition = ... + T_MergeSupportFunc = ... + T_SubscriptingRef = ... + T_FuncExpr = ... + T_NamedArgExpr = ... + T_OpExpr = ... + T_DistinctExpr = ... + T_NullIfExpr = ... + T_ScalarArrayOpExpr = ... + T_BoolExpr = ... + T_SubLink = ... + T_SubPlan = ... + T_AlternativeSubPlan = ... + T_FieldSelect = ... + T_FieldStore = ... + T_RelabelType = ... + T_CoerceViaIO = ... + T_ArrayCoerceExpr = ... + T_ConvertRowtypeExpr = ... + T_CollateExpr = ... + T_CaseExpr = ... + T_CaseWhen = ... + T_CaseTestExpr = ... + T_ArrayExpr = ... + T_RowExpr = ... + T_RowCompareExpr = ... + T_CoalesceExpr = ... + T_MinMaxExpr = ... + T_SQLValueFunction = ... + T_XmlExpr = ... + T_JsonFormat = ... + T_JsonReturning = ... + T_JsonValueExpr = ... + T_JsonConstructorExpr = ... + T_JsonIsPredicate = ... + T_JsonBehavior = ... + T_JsonExpr = ... + T_JsonTablePath = ... + T_JsonTablePathScan = ... + T_JsonTableSiblingJoin = ... + T_NullTest = ... + T_BooleanTest = ... + T_MergeAction = ... + T_CoerceToDomain = ... + T_CoerceToDomainValue = ... + T_SetToDefault = ... + T_CurrentOfExpr = ... + T_NextValueExpr = ... + T_InferenceElem = ... + T_ReturningExpr = ... + T_TargetEntry = ... + T_RangeTblRef = ... + T_JoinExpr = ... + T_FromExpr = ... + T_OnConflictExpr = ... + T_Query = ... + T_TypeName = ... + T_ColumnRef = ... + T_ParamRef = ... + T_A_Expr = ... + T_A_Const = ... + T_TypeCast = ... + T_CollateClause = ... + T_RoleSpec = ... + T_FuncCall = ... + T_A_Star = ... + T_A_Indices = ... + T_A_Indirection = ... + T_A_ArrayExpr = ... + T_ResTarget = ... + T_MultiAssignRef = ... + T_SortBy = ... + T_WindowDef = ... + T_RangeSubselect = ... + T_RangeFunction = ... + T_RangeTableFunc = ... + T_RangeTableFuncCol = ... + T_RangeTableSample = ... + T_ColumnDef = ... + T_TableLikeClause = ... + T_IndexElem = ... + T_DefElem = ... + T_LockingClause = ... + T_XmlSerialize = ... + T_PartitionElem = ... + T_PartitionSpec = ... + T_PartitionBoundSpec = ... + T_PartitionRangeDatum = ... + T_PartitionCmd = ... + T_RangeTblEntry = ... + T_RTEPermissionInfo = ... + T_RangeTblFunction = ... + T_TableSampleClause = ... + T_WithCheckOption = ... + T_SortGroupClause = ... + T_GroupingSet = ... + T_WindowClause = ... + T_RowMarkClause = ... + T_WithClause = ... + T_InferClause = ... + T_OnConflictClause = ... + T_CTESearchClause = ... + T_CTECycleClause = ... + T_CommonTableExpr = ... + T_MergeWhenClause = ... + T_ReturningOption = ... + T_ReturningClause = ... + T_TriggerTransition = ... + T_JsonOutput = ... + T_JsonArgument = ... + T_JsonFuncExpr = ... + T_JsonTablePathSpec = ... + T_JsonTable = ... + T_JsonTableColumn = ... + T_JsonKeyValue = ... + T_JsonParseExpr = ... + T_JsonScalarExpr = ... + T_JsonSerializeExpr = ... + T_JsonObjectConstructor = ... + T_JsonArrayConstructor = ... + T_JsonArrayQueryConstructor = ... + T_JsonAggConstructor = ... + T_JsonObjectAgg = ... + T_JsonArrayAgg = ... + T_RawStmt = ... + T_InsertStmt = ... + T_DeleteStmt = ... + T_UpdateStmt = ... + T_MergeStmt = ... + T_SelectStmt = ... + T_SetOperationStmt = ... + T_ReturnStmt = ... + T_PLAssignStmt = ... + T_CreateSchemaStmt = ... + T_AlterTableStmt = ... + T_AlterTableCmd = ... + T_ATAlterConstraint = ... + T_ReplicaIdentityStmt = ... + T_AlterCollationStmt = ... + T_AlterDomainStmt = ... + T_GrantStmt = ... + T_ObjectWithArgs = ... + T_AccessPriv = ... + T_GrantRoleStmt = ... + T_AlterDefaultPrivilegesStmt = ... + T_CopyStmt = ... + T_VariableSetStmt = ... + T_VariableShowStmt = ... + T_CreateStmt = ... + T_Constraint = ... + T_CreateTableSpaceStmt = ... + T_DropTableSpaceStmt = ... + T_AlterTableSpaceOptionsStmt = ... + T_AlterTableMoveAllStmt = ... + T_CreateExtensionStmt = ... + T_AlterExtensionStmt = ... + T_AlterExtensionContentsStmt = ... + T_CreateFdwStmt = ... + T_AlterFdwStmt = ... + T_CreateForeignServerStmt = ... + T_AlterForeignServerStmt = ... + T_CreateForeignTableStmt = ... + T_CreateUserMappingStmt = ... + T_AlterUserMappingStmt = ... + T_DropUserMappingStmt = ... + T_ImportForeignSchemaStmt = ... + T_CreatePolicyStmt = ... + T_AlterPolicyStmt = ... + T_CreateAmStmt = ... + T_CreateTrigStmt = ... + T_CreateEventTrigStmt = ... + T_AlterEventTrigStmt = ... + T_CreatePLangStmt = ... + T_CreateRoleStmt = ... + T_AlterRoleStmt = ... + T_AlterRoleSetStmt = ... + T_DropRoleStmt = ... + T_CreateSeqStmt = ... + T_AlterSeqStmt = ... + T_DefineStmt = ... + T_CreateDomainStmt = ... + T_CreateOpClassStmt = ... + T_CreateOpClassItem = ... + T_CreateOpFamilyStmt = ... + T_AlterOpFamilyStmt = ... + T_DropStmt = ... + T_TruncateStmt = ... + T_CommentStmt = ... + T_SecLabelStmt = ... + T_DeclareCursorStmt = ... + T_ClosePortalStmt = ... + T_FetchStmt = ... + T_IndexStmt = ... + T_CreateStatsStmt = ... + T_StatsElem = ... + T_AlterStatsStmt = ... + T_CreateFunctionStmt = ... + T_FunctionParameter = ... + T_AlterFunctionStmt = ... + T_DoStmt = ... + T_InlineCodeBlock = ... + T_CallStmt = ... + T_CallContext = ... + T_RenameStmt = ... + T_AlterObjectDependsStmt = ... + T_AlterObjectSchemaStmt = ... + T_AlterOwnerStmt = ... + T_AlterOperatorStmt = ... + T_AlterTypeStmt = ... + T_RuleStmt = ... + T_NotifyStmt = ... + T_ListenStmt = ... + T_UnlistenStmt = ... + T_TransactionStmt = ... + T_CompositeTypeStmt = ... + T_CreateEnumStmt = ... + T_CreateRangeStmt = ... + T_AlterEnumStmt = ... + T_ViewStmt = ... + T_LoadStmt = ... + T_CreatedbStmt = ... + T_AlterDatabaseStmt = ... + T_AlterDatabaseRefreshCollStmt = ... + T_AlterDatabaseSetStmt = ... + T_DropdbStmt = ... + T_AlterSystemStmt = ... + T_ClusterStmt = ... + T_VacuumStmt = ... + T_VacuumRelation = ... + T_ExplainStmt = ... + T_CreateTableAsStmt = ... + T_RefreshMatViewStmt = ... + T_CheckPointStmt = ... + T_DiscardStmt = ... + T_LockStmt = ... + T_ConstraintsSetStmt = ... + T_ReindexStmt = ... + T_CreateConversionStmt = ... + T_CreateCastStmt = ... + T_CreateTransformStmt = ... + T_PrepareStmt = ... + T_ExecuteStmt = ... + T_DeallocateStmt = ... + T_DropOwnedStmt = ... + T_ReassignOwnedStmt = ... + T_AlterTSDictionaryStmt = ... + T_AlterTSConfigurationStmt = ... + T_PublicationTable = ... + T_PublicationObjSpec = ... + T_CreatePublicationStmt = ... + T_AlterPublicationStmt = ... + T_CreateSubscriptionStmt = ... + T_AlterSubscriptionStmt = ... + T_DropSubscriptionStmt = ... + T_PlannerGlobal = ... + T_PlannerInfo = ... + T_RelOptInfo = ... + T_IndexOptInfo = ... + T_ForeignKeyOptInfo = ... + T_StatisticExtInfo = ... + T_JoinDomain = ... + T_EquivalenceClass = ... + T_EquivalenceMember = ... + T_PathKey = ... + T_GroupByOrdering = ... + T_PathTarget = ... + T_ParamPathInfo = ... + T_Path = ... + T_IndexPath = ... + T_IndexClause = ... + T_BitmapHeapPath = ... + T_BitmapAndPath = ... + T_BitmapOrPath = ... + T_TidPath = ... + T_TidRangePath = ... + T_SubqueryScanPath = ... + T_ForeignPath = ... + T_CustomPath = ... + T_AppendPath = ... + T_MergeAppendPath = ... + T_GroupResultPath = ... + T_MaterialPath = ... + T_MemoizePath = ... + T_UniquePath = ... + T_GatherPath = ... + T_GatherMergePath = ... + T_NestPath = ... + T_MergePath = ... + T_HashPath = ... + T_ProjectionPath = ... + T_ProjectSetPath = ... + T_SortPath = ... + T_IncrementalSortPath = ... + T_GroupPath = ... + T_UpperUniquePath = ... + T_AggPath = ... + T_GroupingSetData = ... + T_RollupData = ... + T_GroupingSetsPath = ... + T_MinMaxAggPath = ... + T_WindowAggPath = ... + T_SetOpPath = ... + T_RecursiveUnionPath = ... + T_LockRowsPath = ... + T_ModifyTablePath = ... + T_LimitPath = ... + T_RestrictInfo = ... + T_PlaceHolderVar = ... + T_SpecialJoinInfo = ... + T_OuterJoinClauseInfo = ... + T_AppendRelInfo = ... + T_RowIdentityVarInfo = ... + T_PlaceHolderInfo = ... + T_MinMaxAggInfo = ... + T_PlannerParamItem = ... + T_AggInfo = ... + T_AggTransInfo = ... + T_UniqueRelInfo = ... + T_PlannedStmt = ... + T_Result = ... + T_ProjectSet = ... + T_ModifyTable = ... + T_Append = ... + T_MergeAppend = ... + T_RecursiveUnion = ... + T_BitmapAnd = ... + T_BitmapOr = ... + T_SeqScan = ... + T_SampleScan = ... + T_IndexScan = ... + T_IndexOnlyScan = ... + T_BitmapIndexScan = ... + T_BitmapHeapScan = ... + T_TidScan = ... + T_TidRangeScan = ... + T_SubqueryScan = ... + T_FunctionScan = ... + T_ValuesScan = ... + T_TableFuncScan = ... + T_CteScan = ... + T_NamedTuplestoreScan = ... + T_WorkTableScan = ... + T_ForeignScan = ... + T_CustomScan = ... + T_NestLoop = ... + T_NestLoopParam = ... + T_MergeJoin = ... + T_HashJoin = ... + T_Material = ... + T_Memoize = ... + T_Sort = ... + T_IncrementalSort = ... + T_Group = ... + T_Agg = ... + T_WindowAgg = ... + T_Unique = ... + T_Gather = ... + T_GatherMerge = ... + T_Hash = ... + T_SetOp = ... + T_LockRows = ... + T_Limit = ... + T_PlanRowMark = ... + T_PartitionPruneInfo = ... + T_PartitionedRelPruneInfo = ... + T_PartitionPruneStepOp = ... + T_PartitionPruneStepCombine = ... + T_PlanInvalItem = ... + T_ExprState = ... + T_IndexInfo = ... + T_ExprContext = ... + T_ReturnSetInfo = ... + T_ProjectionInfo = ... + T_JunkFilter = ... + T_OnConflictSetState = ... + T_MergeActionState = ... + T_ResultRelInfo = ... + T_EState = ... + T_WindowFuncExprState = ... + T_SetExprState = ... + T_SubPlanState = ... + T_DomainConstraintState = ... + T_ResultState = ... + T_ProjectSetState = ... + T_ModifyTableState = ... + T_AppendState = ... + T_MergeAppendState = ... + T_RecursiveUnionState = ... + T_BitmapAndState = ... + T_BitmapOrState = ... + T_ScanState = ... + T_SeqScanState = ... + T_SampleScanState = ... + T_IndexScanState = ... + T_IndexOnlyScanState = ... + T_BitmapIndexScanState = ... + T_BitmapHeapScanState = ... + T_TidScanState = ... + T_TidRangeScanState = ... + T_SubqueryScanState = ... + T_FunctionScanState = ... + T_ValuesScanState = ... + T_TableFuncScanState = ... + T_CteScanState = ... + T_NamedTuplestoreScanState = ... + T_WorkTableScanState = ... + T_ForeignScanState = ... + T_CustomScanState = ... + T_JoinState = ... + T_NestLoopState = ... + T_MergeJoinState = ... + T_HashJoinState = ... + T_MaterialState = ... + T_MemoizeState = ... + T_SortState = ... + T_IncrementalSortState = ... + T_GroupState = ... + T_AggState = ... + T_WindowAggState = ... + T_UniqueState = ... + T_GatherState = ... + T_GatherMergeState = ... + T_HashState = ... + T_SetOpState = ... + T_LockRowsState = ... + T_LimitState = ... + T_IndexAmRoutine = ... + T_TableAmRoutine = ... + T_TsmRoutine = ... + T_EventTriggerData = ... + T_TriggerData = ... + T_TupleTableSlot = ... + T_FdwRoutine = ... + T_Bitmapset = ... + T_ExtensibleNode = ... + T_ErrorSaveContext = ... + T_IdentifySystemCmd = ... + T_BaseBackupCmd = ... + T_CreateReplicationSlotCmd = ... + T_DropReplicationSlotCmd = ... + T_AlterReplicationSlotCmd = ... + T_StartReplicationCmd = ... + T_ReadReplicationSlotCmd = ... + T_TimeLineHistoryCmd = ... + T_UploadManifestCmd = ... + T_SupportRequestSimplify = ... + T_SupportRequestSelectivity = ... + T_SupportRequestCost = ... + T_SupportRequestRows = ... + T_SupportRequestIndexCondition = ... + T_SupportRequestWFuncMonotonic = ... + T_SupportRequestOptimizeWindowClause = ... + T_SupportRequestModifyInPlace = ... + T_Integer = ... + T_Float = ... + T_Boolean = ... + T_String = ... + T_BitString = ... + T_ForeignKeyCacheInfo = ... + T_IntList = ... + T_OidList = ... + T_XidList = ... + T_AllocSetContext = ... + T_GenerationContext = ... + T_SlabContext = ... + T_BumpContext = ... + T_TIDBitmap = ... + T_WindowObjectData = ... + + +class OnConflictAction(IntEnum): + ONCONFLICT_NONE = ... + ONCONFLICT_NOTHING = ... + ONCONFLICT_UPDATE = ... + + +class SetOpCmd(IntEnum): + SETOPCMD_INTERSECT = ... + SETOPCMD_INTERSECT_ALL = ... + SETOPCMD_EXCEPT = ... + SETOPCMD_EXCEPT_ALL = ... + + +class SetOpStrategy(IntEnum): + SETOP_SORTED = ... + SETOP_HASHED = ... + +AGGSPLITOP_COMBINE: int + +AGGSPLITOP_SKIPFINAL: int + +AGGSPLITOP_SERIALIZE: int + +AGGSPLITOP_DESERIALIZE: int diff --git a/pglast/enums/parsenodes.pyi b/pglast/enums/parsenodes.pyi new file mode 100644 index 0000000..6f0befe --- /dev/null +++ b/pglast/enums/parsenodes.pyi @@ -0,0 +1,523 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from parsenodes.h @ 18.0.0-0-g204fbdb +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2017-2026 Lele Gaifax +# + +from enum import Enum, IntEnum, IntFlag + + +class A_Expr_Kind(IntEnum): + AEXPR_OP = ... + AEXPR_OP_ANY = ... + AEXPR_OP_ALL = ... + AEXPR_DISTINCT = ... + AEXPR_NOT_DISTINCT = ... + AEXPR_NULLIF = ... + AEXPR_IN = ... + AEXPR_LIKE = ... + AEXPR_ILIKE = ... + AEXPR_SIMILAR = ... + AEXPR_BETWEEN = ... + AEXPR_NOT_BETWEEN = ... + AEXPR_BETWEEN_SYM = ... + AEXPR_NOT_BETWEEN_SYM = ... + + +class AlterPublicationAction(IntEnum): + AP_AddObjects = ... + AP_DropObjects = ... + AP_SetObjects = ... + + +class AlterSubscriptionType(IntEnum): + ALTER_SUBSCRIPTION_OPTIONS = ... + ALTER_SUBSCRIPTION_CONNECTION = ... + ALTER_SUBSCRIPTION_SET_PUBLICATION = ... + ALTER_SUBSCRIPTION_ADD_PUBLICATION = ... + ALTER_SUBSCRIPTION_DROP_PUBLICATION = ... + ALTER_SUBSCRIPTION_REFRESH = ... + ALTER_SUBSCRIPTION_ENABLED = ... + ALTER_SUBSCRIPTION_SKIP = ... + + +class AlterTSConfigType(IntEnum): + ALTER_TSCONFIG_ADD_MAPPING = ... + ALTER_TSCONFIG_ALTER_MAPPING_FOR_TOKEN = ... + ALTER_TSCONFIG_REPLACE_DICT = ... + ALTER_TSCONFIG_REPLACE_DICT_FOR_TOKEN = ... + ALTER_TSCONFIG_DROP_MAPPING = ... + + +class AlterTableType(IntEnum): + AT_AddColumn = ... + AT_AddColumnToView = ... + AT_ColumnDefault = ... + AT_CookedColumnDefault = ... + AT_DropNotNull = ... + AT_SetNotNull = ... + AT_SetExpression = ... + AT_DropExpression = ... + AT_SetStatistics = ... + AT_SetOptions = ... + AT_ResetOptions = ... + AT_SetStorage = ... + AT_SetCompression = ... + AT_DropColumn = ... + AT_AddIndex = ... + AT_ReAddIndex = ... + AT_AddConstraint = ... + AT_ReAddConstraint = ... + AT_ReAddDomainConstraint = ... + AT_AlterConstraint = ... + AT_ValidateConstraint = ... + AT_AddIndexConstraint = ... + AT_DropConstraint = ... + AT_ReAddComment = ... + AT_AlterColumnType = ... + AT_AlterColumnGenericOptions = ... + AT_ChangeOwner = ... + AT_ClusterOn = ... + AT_DropCluster = ... + AT_SetLogged = ... + AT_SetUnLogged = ... + AT_DropOids = ... + AT_SetAccessMethod = ... + AT_SetTableSpace = ... + AT_SetRelOptions = ... + AT_ResetRelOptions = ... + AT_ReplaceRelOptions = ... + AT_EnableTrig = ... + AT_EnableAlwaysTrig = ... + AT_EnableReplicaTrig = ... + AT_DisableTrig = ... + AT_EnableTrigAll = ... + AT_DisableTrigAll = ... + AT_EnableTrigUser = ... + AT_DisableTrigUser = ... + AT_EnableRule = ... + AT_EnableAlwaysRule = ... + AT_EnableReplicaRule = ... + AT_DisableRule = ... + AT_AddInherit = ... + AT_DropInherit = ... + AT_AddOf = ... + AT_DropOf = ... + AT_ReplicaIdentity = ... + AT_EnableRowSecurity = ... + AT_DisableRowSecurity = ... + AT_ForceRowSecurity = ... + AT_NoForceRowSecurity = ... + AT_GenericOptions = ... + AT_AttachPartition = ... + AT_DetachPartition = ... + AT_DetachPartitionFinalize = ... + AT_AddIdentity = ... + AT_SetIdentity = ... + AT_DropIdentity = ... + AT_ReAddStatistics = ... + + +class CTEMaterialize(IntEnum): + CTEMaterializeDefault = ... + CTEMaterializeAlways = ... + CTEMaterializeNever = ... + + +class ConstrType(IntEnum): + CONSTR_NULL = ... + CONSTR_NOTNULL = ... + CONSTR_DEFAULT = ... + CONSTR_IDENTITY = ... + CONSTR_GENERATED = ... + CONSTR_CHECK = ... + CONSTR_PRIMARY = ... + CONSTR_UNIQUE = ... + CONSTR_EXCLUSION = ... + CONSTR_FOREIGN = ... + CONSTR_ATTR_DEFERRABLE = ... + CONSTR_ATTR_NOT_DEFERRABLE = ... + CONSTR_ATTR_DEFERRED = ... + CONSTR_ATTR_IMMEDIATE = ... + CONSTR_ATTR_ENFORCED = ... + CONSTR_ATTR_NOT_ENFORCED = ... + + +class DefElemAction(IntEnum): + DEFELEM_UNSPEC = ... + DEFELEM_SET = ... + DEFELEM_ADD = ... + DEFELEM_DROP = ... + + +class DiscardMode(IntEnum): + DISCARD_ALL = ... + DISCARD_PLANS = ... + DISCARD_SEQUENCES = ... + DISCARD_TEMP = ... + + +class DropBehavior(IntEnum): + DROP_RESTRICT = ... + DROP_CASCADE = ... + + +class FetchDirection(IntEnum): + FETCH_FORWARD = ... + FETCH_BACKWARD = ... + FETCH_ABSOLUTE = ... + FETCH_RELATIVE = ... + + +class FunctionParameterMode(str, Enum): + FUNC_PARAM_IN = ... + FUNC_PARAM_OUT = ... + FUNC_PARAM_INOUT = ... + FUNC_PARAM_VARIADIC = ... + FUNC_PARAM_TABLE = ... + FUNC_PARAM_DEFAULT = ... + + +class GrantTargetType(IntEnum): + ACL_TARGET_OBJECT = ... + ACL_TARGET_ALL_IN_SCHEMA = ... + ACL_TARGET_DEFAULTS = ... + + +class GroupingSetKind(IntEnum): + GROUPING_SET_EMPTY = ... + GROUPING_SET_SIMPLE = ... + GROUPING_SET_ROLLUP = ... + GROUPING_SET_CUBE = ... + GROUPING_SET_SETS = ... + + +class ImportForeignSchemaType(IntEnum): + FDW_IMPORT_SCHEMA_ALL = ... + FDW_IMPORT_SCHEMA_LIMIT_TO = ... + FDW_IMPORT_SCHEMA_EXCEPT = ... + + +class JsonQuotes(IntEnum): + JS_QUOTES_UNSPEC = ... + JS_QUOTES_KEEP = ... + JS_QUOTES_OMIT = ... + + +class JsonTableColumnType(IntEnum): + JTC_FOR_ORDINALITY = ... + JTC_REGULAR = ... + JTC_EXISTS = ... + JTC_FORMATTED = ... + JTC_NESTED = ... + + +class ObjectType(IntEnum): + OBJECT_ACCESS_METHOD = ... + OBJECT_AGGREGATE = ... + OBJECT_AMOP = ... + OBJECT_AMPROC = ... + OBJECT_ATTRIBUTE = ... + OBJECT_CAST = ... + OBJECT_COLUMN = ... + OBJECT_COLLATION = ... + OBJECT_CONVERSION = ... + OBJECT_DATABASE = ... + OBJECT_DEFAULT = ... + OBJECT_DEFACL = ... + OBJECT_DOMAIN = ... + OBJECT_DOMCONSTRAINT = ... + OBJECT_EVENT_TRIGGER = ... + OBJECT_EXTENSION = ... + OBJECT_FDW = ... + OBJECT_FOREIGN_SERVER = ... + OBJECT_FOREIGN_TABLE = ... + OBJECT_FUNCTION = ... + OBJECT_INDEX = ... + OBJECT_LANGUAGE = ... + OBJECT_LARGEOBJECT = ... + OBJECT_MATVIEW = ... + OBJECT_OPCLASS = ... + OBJECT_OPERATOR = ... + OBJECT_OPFAMILY = ... + OBJECT_PARAMETER_ACL = ... + OBJECT_POLICY = ... + OBJECT_PROCEDURE = ... + OBJECT_PUBLICATION = ... + OBJECT_PUBLICATION_NAMESPACE = ... + OBJECT_PUBLICATION_REL = ... + OBJECT_ROLE = ... + OBJECT_ROUTINE = ... + OBJECT_RULE = ... + OBJECT_SCHEMA = ... + OBJECT_SEQUENCE = ... + OBJECT_SUBSCRIPTION = ... + OBJECT_STATISTIC_EXT = ... + OBJECT_TABCONSTRAINT = ... + OBJECT_TABLE = ... + OBJECT_TABLESPACE = ... + OBJECT_TRANSFORM = ... + OBJECT_TRIGGER = ... + OBJECT_TSCONFIGURATION = ... + OBJECT_TSDICTIONARY = ... + OBJECT_TSPARSER = ... + OBJECT_TSTEMPLATE = ... + OBJECT_TYPE = ... + OBJECT_USER_MAPPING = ... + OBJECT_VIEW = ... + + +class PartitionRangeDatumKind(IntEnum): + PARTITION_RANGE_DATUM_MINVALUE = ... + PARTITION_RANGE_DATUM_VALUE = ... + PARTITION_RANGE_DATUM_MAXVALUE = ... + + +class PartitionStrategy(str, Enum): + PARTITION_STRATEGY_LIST = ... + PARTITION_STRATEGY_RANGE = ... + PARTITION_STRATEGY_HASH = ... + + +class PublicationObjSpecType(IntEnum): + PUBLICATIONOBJ_TABLE = ... + PUBLICATIONOBJ_TABLES_IN_SCHEMA = ... + PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA = ... + PUBLICATIONOBJ_CONTINUATION = ... + + +class QuerySource(IntEnum): + QSRC_ORIGINAL = ... + QSRC_PARSER = ... + QSRC_INSTEAD_RULE = ... + QSRC_QUAL_INSTEAD_RULE = ... + QSRC_NON_INSTEAD_RULE = ... + + +class RTEKind(IntEnum): + RTE_RELATION = ... + RTE_SUBQUERY = ... + RTE_JOIN = ... + RTE_FUNCTION = ... + RTE_TABLEFUNC = ... + RTE_VALUES = ... + RTE_CTE = ... + RTE_NAMEDTUPLESTORE = ... + RTE_RESULT = ... + RTE_GROUP = ... + + +class ReindexObjectType(IntEnum): + REINDEX_OBJECT_INDEX = ... + REINDEX_OBJECT_TABLE = ... + REINDEX_OBJECT_SCHEMA = ... + REINDEX_OBJECT_SYSTEM = ... + REINDEX_OBJECT_DATABASE = ... + + +class ReturningOptionKind(IntEnum): + RETURNING_OPTION_OLD = ... + RETURNING_OPTION_NEW = ... + + +class RoleSpecType(IntEnum): + ROLESPEC_CSTRING = ... + ROLESPEC_CURRENT_ROLE = ... + ROLESPEC_CURRENT_USER = ... + ROLESPEC_SESSION_USER = ... + ROLESPEC_PUBLIC = ... + + +class RoleStmtType(IntEnum): + ROLESTMT_ROLE = ... + ROLESTMT_USER = ... + ROLESTMT_GROUP = ... + + +class SetOperation(IntEnum): + SETOP_NONE = ... + SETOP_UNION = ... + SETOP_INTERSECT = ... + SETOP_EXCEPT = ... + + +class SetQuantifier(IntEnum): + SET_QUANTIFIER_DEFAULT = ... + SET_QUANTIFIER_ALL = ... + SET_QUANTIFIER_DISTINCT = ... + + +class SortByDir(IntEnum): + SORTBY_DEFAULT = ... + SORTBY_ASC = ... + SORTBY_DESC = ... + SORTBY_USING = ... + + +class SortByNulls(IntEnum): + SORTBY_NULLS_DEFAULT = ... + SORTBY_NULLS_FIRST = ... + SORTBY_NULLS_LAST = ... + + +class TableLikeOption(IntFlag): + CREATE_TABLE_LIKE_COMMENTS = ... + CREATE_TABLE_LIKE_COMPRESSION = ... + CREATE_TABLE_LIKE_CONSTRAINTS = ... + CREATE_TABLE_LIKE_DEFAULTS = ... + CREATE_TABLE_LIKE_GENERATED = ... + CREATE_TABLE_LIKE_IDENTITY = ... + CREATE_TABLE_LIKE_INDEXES = ... + CREATE_TABLE_LIKE_STATISTICS = ... + CREATE_TABLE_LIKE_STORAGE = ... + CREATE_TABLE_LIKE_ALL = ... + + +class TransactionStmtKind(IntEnum): + TRANS_STMT_BEGIN = ... + TRANS_STMT_START = ... + TRANS_STMT_COMMIT = ... + TRANS_STMT_ROLLBACK = ... + TRANS_STMT_SAVEPOINT = ... + TRANS_STMT_RELEASE = ... + TRANS_STMT_ROLLBACK_TO = ... + TRANS_STMT_PREPARE = ... + TRANS_STMT_COMMIT_PREPARED = ... + TRANS_STMT_ROLLBACK_PREPARED = ... + + +class VariableSetKind(IntEnum): + VAR_SET_VALUE = ... + VAR_SET_DEFAULT = ... + VAR_SET_CURRENT = ... + VAR_SET_MULTI = ... + VAR_RESET = ... + VAR_RESET_ALL = ... + + +class ViewCheckOption(IntEnum): + NO_CHECK_OPTION = ... + LOCAL_CHECK_OPTION = ... + CASCADED_CHECK_OPTION = ... + + +class WCOKind(IntEnum): + WCO_VIEW_CHECK = ... + WCO_RLS_INSERT_CHECK = ... + WCO_RLS_UPDATE_CHECK = ... + WCO_RLS_CONFLICT_CHECK = ... + WCO_RLS_MERGE_UPDATE_CHECK = ... + WCO_RLS_MERGE_DELETE_CHECK = ... + +ACL_INSERT: int + +ACL_SELECT: int + +ACL_UPDATE: int + +ACL_DELETE: int + +ACL_TRUNCATE: int + +ACL_REFERENCES: int + +ACL_TRIGGER: int + +ACL_EXECUTE: int + +ACL_USAGE: int + +ACL_CREATE: int + +ACL_CREATE_TEMP: int + +ACL_CONNECT: int + +ACL_SET: int + +ACL_ALTER_SYSTEM: int + +ACL_MAINTAIN: int + +N_ACL_RIGHTS: int + +ACL_NO_RIGHTS: int + +FRAMEOPTION_NONDEFAULT: int + +FRAMEOPTION_RANGE: int + +FRAMEOPTION_ROWS: int + +FRAMEOPTION_GROUPS: int + +FRAMEOPTION_BETWEEN: int + +FRAMEOPTION_START_UNBOUNDED_PRECEDING: int + +FRAMEOPTION_END_UNBOUNDED_PRECEDING: int + +FRAMEOPTION_START_UNBOUNDED_FOLLOWING: int + +FRAMEOPTION_END_UNBOUNDED_FOLLOWING: int + +FRAMEOPTION_START_CURRENT_ROW: int + +FRAMEOPTION_END_CURRENT_ROW: int + +FRAMEOPTION_START_OFFSET_PRECEDING: int + +FRAMEOPTION_END_OFFSET_PRECEDING: int + +FRAMEOPTION_START_OFFSET_FOLLOWING: int + +FRAMEOPTION_END_OFFSET_FOLLOWING: int + +FRAMEOPTION_EXCLUDE_CURRENT_ROW: int + +FRAMEOPTION_EXCLUDE_GROUP: int + +FRAMEOPTION_EXCLUDE_TIES: int + +FKCONSTR_ACTION_NOACTION: str + +FKCONSTR_ACTION_RESTRICT: str + +FKCONSTR_ACTION_CASCADE: str + +FKCONSTR_ACTION_SETNULL: str + +FKCONSTR_ACTION_SETDEFAULT: str + +FKCONSTR_MATCH_FULL: str + +FKCONSTR_MATCH_PARTIAL: str + +FKCONSTR_MATCH_SIMPLE: str + +OPCLASS_ITEM_OPERATOR: int + +OPCLASS_ITEM_FUNCTION: int + +OPCLASS_ITEM_STORAGETYPE: int + +CURSOR_OPT_BINARY: int + +CURSOR_OPT_SCROLL: int + +CURSOR_OPT_NO_SCROLL: int + +CURSOR_OPT_INSENSITIVE: int + +CURSOR_OPT_ASENSITIVE: int + +CURSOR_OPT_HOLD: int + +CURSOR_OPT_FAST_PLAN: int + +CURSOR_OPT_GENERIC_PLAN: int + +CURSOR_OPT_CUSTOM_PLAN: int + +CURSOR_OPT_PARALLEL_OK: int diff --git a/pglast/enums/pg_am.pyi b/pglast/enums/pg_am.pyi new file mode 100644 index 0000000..be868af --- /dev/null +++ b/pglast/enums/pg_am.pyi @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from pg_am.h @ 18.0.0-0-g204fbdb +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2017-2026 Lele Gaifax +# + +AMTYPE_INDEX: str + +AMTYPE_TABLE: str diff --git a/pglast/enums/pg_attribute.pyi b/pglast/enums/pg_attribute.pyi new file mode 100644 index 0000000..fc1d333 --- /dev/null +++ b/pglast/enums/pg_attribute.pyi @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from pg_attribute.h @ 18.0.0-0-g204fbdb +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2017-2026 Lele Gaifax +# + +ATTRIBUTE_IDENTITY_ALWAYS: str + +ATTRIBUTE_IDENTITY_BY_DEFAULT: str + +ATTRIBUTE_GENERATED_STORED: str + +ATTRIBUTE_GENERATED_VIRTUAL: str diff --git a/pglast/enums/pg_class.pyi b/pglast/enums/pg_class.pyi new file mode 100644 index 0000000..88dde18 --- /dev/null +++ b/pglast/enums/pg_class.pyi @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from pg_class.h @ 18.0.0-0-g204fbdb +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2017-2026 Lele Gaifax +# + +RELKIND_RELATION: str + +RELKIND_INDEX: str + +RELKIND_SEQUENCE: str + +RELKIND_TOASTVALUE: str + +RELKIND_VIEW: str + +RELKIND_MATVIEW: str + +RELKIND_COMPOSITE_TYPE: str + +RELKIND_FOREIGN_TABLE: str + +RELKIND_PARTITIONED_TABLE: str + +RELKIND_PARTITIONED_INDEX: str + +RELPERSISTENCE_PERMANENT: str + +RELPERSISTENCE_UNLOGGED: str + +RELPERSISTENCE_TEMP: str + +REPLICA_IDENTITY_DEFAULT: str + +REPLICA_IDENTITY_NOTHING: str + +REPLICA_IDENTITY_FULL: str + +REPLICA_IDENTITY_INDEX: str diff --git a/pglast/enums/pg_trigger.pyi b/pglast/enums/pg_trigger.pyi new file mode 100644 index 0000000..96d3c8f --- /dev/null +++ b/pglast/enums/pg_trigger.pyi @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from pg_trigger.h @ 18.0.0-0-g204fbdb +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2017-2026 Lele Gaifax +# + +TRIGGER_TYPE_ROW: int + +TRIGGER_TYPE_BEFORE: int + +TRIGGER_TYPE_INSERT: int + +TRIGGER_TYPE_DELETE: int + +TRIGGER_TYPE_UPDATE: int + +TRIGGER_TYPE_TRUNCATE: int + +TRIGGER_TYPE_INSTEAD: int + +TRIGGER_TYPE_STATEMENT: int + +TRIGGER_TYPE_AFTER: int diff --git a/pglast/enums/primnodes.pyi b/pglast/enums/primnodes.pyi new file mode 100644 index 0000000..0682dc1 --- /dev/null +++ b/pglast/enums/primnodes.pyi @@ -0,0 +1,185 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from primnodes.h @ 18.0.0-0-g204fbdb +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2017-2026 Lele Gaifax +# + +from enum import IntEnum + + +class BoolExprType(IntEnum): + AND_EXPR = ... + OR_EXPR = ... + NOT_EXPR = ... + + +class BoolTestType(IntEnum): + IS_TRUE = ... + IS_NOT_TRUE = ... + IS_FALSE = ... + IS_NOT_FALSE = ... + IS_UNKNOWN = ... + IS_NOT_UNKNOWN = ... + + +class CoercionContext(IntEnum): + COERCION_IMPLICIT = ... + COERCION_ASSIGNMENT = ... + COERCION_PLPGSQL = ... + COERCION_EXPLICIT = ... + + +class CoercionForm(IntEnum): + COERCE_EXPLICIT_CALL = ... + COERCE_EXPLICIT_CAST = ... + COERCE_IMPLICIT_CAST = ... + COERCE_SQL_SYNTAX = ... + + +class JsonBehaviorType(IntEnum): + JSON_BEHAVIOR_NULL = ... + JSON_BEHAVIOR_ERROR = ... + JSON_BEHAVIOR_EMPTY = ... + JSON_BEHAVIOR_TRUE = ... + JSON_BEHAVIOR_FALSE = ... + JSON_BEHAVIOR_UNKNOWN = ... + JSON_BEHAVIOR_EMPTY_ARRAY = ... + JSON_BEHAVIOR_EMPTY_OBJECT = ... + JSON_BEHAVIOR_DEFAULT = ... + + +class JsonConstructorType(IntEnum): + JSCTOR_JSON_OBJECT = ... + JSCTOR_JSON_ARRAY = ... + JSCTOR_JSON_OBJECTAGG = ... + JSCTOR_JSON_ARRAYAGG = ... + JSCTOR_JSON_PARSE = ... + JSCTOR_JSON_SCALAR = ... + JSCTOR_JSON_SERIALIZE = ... + + +class JsonEncoding(IntEnum): + JS_ENC_DEFAULT = ... + JS_ENC_UTF8 = ... + JS_ENC_UTF16 = ... + JS_ENC_UTF32 = ... + + +class JsonExprOp(IntEnum): + JSON_EXISTS_OP = ... + JSON_QUERY_OP = ... + JSON_VALUE_OP = ... + JSON_TABLE_OP = ... + + +class JsonFormatType(IntEnum): + JS_FORMAT_DEFAULT = ... + JS_FORMAT_JSON = ... + JS_FORMAT_JSONB = ... + + +class JsonValueType(IntEnum): + JS_TYPE_ANY = ... + JS_TYPE_OBJECT = ... + JS_TYPE_ARRAY = ... + JS_TYPE_SCALAR = ... + + +class JsonWrapper(IntEnum): + JSW_UNSPEC = ... + JSW_NONE = ... + JSW_CONDITIONAL = ... + JSW_UNCONDITIONAL = ... + + +class MergeMatchKind(IntEnum): + MERGE_WHEN_MATCHED = ... + MERGE_WHEN_NOT_MATCHED_BY_SOURCE = ... + MERGE_WHEN_NOT_MATCHED_BY_TARGET = ... + + +class MinMaxOp(IntEnum): + IS_GREATEST = ... + IS_LEAST = ... + + +class NullTestType(IntEnum): + IS_NULL = ... + IS_NOT_NULL = ... + + +class OnCommitAction(IntEnum): + ONCOMMIT_NOOP = ... + ONCOMMIT_PRESERVE_ROWS = ... + ONCOMMIT_DELETE_ROWS = ... + ONCOMMIT_DROP = ... + + +class OverridingKind(IntEnum): + OVERRIDING_NOT_SET = ... + OVERRIDING_USER_VALUE = ... + OVERRIDING_SYSTEM_VALUE = ... + + +class ParamKind(IntEnum): + PARAM_EXTERN = ... + PARAM_EXEC = ... + PARAM_SUBLINK = ... + PARAM_MULTIEXPR = ... + + +class SQLValueFunctionOp(IntEnum): + SVFOP_CURRENT_DATE = ... + SVFOP_CURRENT_TIME = ... + SVFOP_CURRENT_TIME_N = ... + SVFOP_CURRENT_TIMESTAMP = ... + SVFOP_CURRENT_TIMESTAMP_N = ... + SVFOP_LOCALTIME = ... + SVFOP_LOCALTIME_N = ... + SVFOP_LOCALTIMESTAMP = ... + SVFOP_LOCALTIMESTAMP_N = ... + SVFOP_CURRENT_ROLE = ... + SVFOP_CURRENT_USER = ... + SVFOP_USER = ... + SVFOP_SESSION_USER = ... + SVFOP_CURRENT_CATALOG = ... + SVFOP_CURRENT_SCHEMA = ... + + +class SubLinkType(IntEnum): + EXISTS_SUBLINK = ... + ALL_SUBLINK = ... + ANY_SUBLINK = ... + ROWCOMPARE_SUBLINK = ... + EXPR_SUBLINK = ... + MULTIEXPR_SUBLINK = ... + ARRAY_SUBLINK = ... + CTE_SUBLINK = ... + + +class TableFuncType(IntEnum): + TFT_XMLTABLE = ... + TFT_JSON_TABLE = ... + + +class VarReturningType(IntEnum): + VAR_RETURNING_DEFAULT = ... + VAR_RETURNING_OLD = ... + VAR_RETURNING_NEW = ... + + +class XmlExprOp(IntEnum): + IS_XMLCONCAT = ... + IS_XMLELEMENT = ... + IS_XMLFOREST = ... + IS_XMLPARSE = ... + IS_XMLPI = ... + IS_XMLROOT = ... + IS_XMLSERIALIZE = ... + IS_DOCUMENT = ... + + +class XmlOptionType(IntEnum): + XMLOPTION_DOCUMENT = ... + XMLOPTION_CONTENT = ... diff --git a/pglast/enums/xml.pyi b/pglast/enums/xml.pyi new file mode 100644 index 0000000..4d88420 --- /dev/null +++ b/pglast/enums/xml.pyi @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from xml.h @ 18.0.0-0-g204fbdb +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2017-2026 Lele Gaifax +# + +from enum import IntEnum + + +class PgXmlStrictness(IntEnum): + PG_XML_STRICTNESS_LEGACY = ... + PG_XML_STRICTNESS_WELLFORMED = ... + PG_XML_STRICTNESS_ALL = ... + + +class XmlBinaryType(IntEnum): + XMLBINARY_BASE64 = ... + XMLBINARY_HEX = ... + + +class XmlStandaloneType(IntEnum): + XML_STANDALONE_YES = ... + XML_STANDALONE_NO = ... + XML_STANDALONE_NO_VALUE = ... + XML_STANDALONE_OMITTED = ... diff --git a/pglast/error.pyi b/pglast/error.pyi new file mode 100644 index 0000000..845da72 --- /dev/null +++ b/pglast/error.pyi @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — Type stubs for pglast.error module +# :License: GNU General Public License version 3 or later +# + +class Error(Exception): + pass diff --git a/pglast/keywords.pyi b/pglast/keywords.pyi new file mode 100644 index 0000000..ad77682 --- /dev/null +++ b/pglast/keywords.pyi @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from kwlist.h @ 18.4 +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2017-2026 Lele Gaifax +# + +COL_NAME_KEYWORDS: set[str] + +RESERVED_KEYWORDS: set[str] + +TYPE_FUNC_NAME_KEYWORDS: set[str] + +UNRESERVED_KEYWORDS: set[str] diff --git a/pglast/parser.pyi b/pglast/parser.pyi index 49b0070..300c23f 100644 --- a/pglast/parser.pyi +++ b/pglast/parser.pyi @@ -5,11 +5,13 @@ # :License: GNU General Public License version 3 or later # -from typing import NamedTuple +from typing import Literal, NamedTuple, overload from .ast import RawStmt from .error import Error +LONG_MAX: int + class ParseError(Error): def __init__(self, message: str, location: int | None = None) -> None: ... @@ -43,19 +45,50 @@ def parse_plpgsql_json(query: str) -> str: ... def fingerprint(query: str) -> str: ... +@overload +def split( + stmts: str, + with_parser: bool = True, + only_slices: Literal[False] = False, +) -> tuple[str, ...]: ... + +@overload +def split( + stmts: str, + with_parser: bool = True, + *, + only_slices: Literal[True], +) -> tuple[slice, ...]: ... + +@overload +def split( + stmts: str, + with_parser: bool, + only_slices: Literal[True], +) -> tuple[slice, ...]: ... + +@overload def split( stmts: str, with_parser: bool = True, + *, + only_slices: bool, +) -> tuple[str | slice, ...]: ... + +@overload +def split( + stmts: str, + with_parser: bool, only_slices: bool = False, ) -> tuple[str | slice, ...]: ... def deparse_protobuf( protobuf: bytes, pretty_print: bool = False, - indent_size: int = 2, - max_line_length: int = 150, - trailing_newline: bool = True, - commas_start_of_line: bool = True, + indent_size: int = 4, + max_line_length: int = 80, + trailing_newline: bool = False, + commas_start_of_line: bool = False, ) -> str: ... def scan(query: str) -> list[Token]: ... @@ -66,4 +99,4 @@ class Comment(NamedTuple): newlines_after_comment: int str: str -def comments(query: str) -> tuple[Comment]: ... +def comments(query: str) -> tuple[Comment, ...]: ... diff --git a/pglast/printers/__init__.pyi b/pglast/printers/__init__.pyi new file mode 100644 index 0000000..55aa304 --- /dev/null +++ b/pglast/printers/__init__.pyi @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — Type stubs for pglast.printers package +# :License: GNU General Public License version 3 or later +# + +from collections.abc import Callable, Sequence +from enum import IntEnum +from typing import Any, Generic, TypeVar, overload + +from .. import ast +from ..error import Error +from ..stream import RawStream +from . import ddl as ddl +from . import dml as dml +from . import sfuncs as sfuncs + +Printer = Callable[..., Any] +PrinterKey = type[ast.Node] | tuple[type[ast.Node] | None, type[ast.Node]] +_T = TypeVar("_T") +_EnumT = TypeVar("_EnumT", bound=IntEnum) + +NODE_PRINTERS: dict[PrinterKey, Printer] +SPECIAL_FUNCTIONS: dict[str, Printer] + +class PrinterAlreadyPresentError(Error): + pass + +def get_printer_for_node(node: ast.Node) -> Printer: ... +def node_printer( + *nodes: type[ast.Node] | Sequence[type[ast.Node]], + override: bool = False, +) -> Callable[[Printer], Printer]: ... +def special_function( + name: str, + override: bool = False, +) -> Callable[[Printer], Printer]: ... +@overload +def get_special_function(name: str) -> Printer | None: ... +@overload +def get_special_function(name: str, default: _T) -> Printer | _T: ... + +class IntEnumPrinter(Generic[_EnumT]): + value_to_symbol: dict[int, str] + + def __init__(self) -> None: ... + def __call__( + self, + value: _EnumT | ast.Integer | str | None, + node: ast.Node, + output: RawStream, + ) -> None: ... + +def get_string_value(lst: Sequence[ast.String]) -> str: ... diff --git a/pglast/printers/ddl.pyi b/pglast/printers/ddl.pyi new file mode 100644 index 0000000..84c57b3 --- /dev/null +++ b/pglast/printers/ddl.pyi @@ -0,0 +1,484 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from ddl.py +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2017-2026 Lele Gaifax +# + +from typing import Any, ClassVar + +from .. import ast, enums +from ..stream import RawStream +from . import IntEnumPrinter + +def access_priv(node: ast.AccessPriv, output: RawStream) -> None: ... + +OBJECT_NAMES: Any + +def alter_collation_stmt(node: ast.AlterCollationStmt, output: RawStream) -> None: ... + +def alter_database_stmt(node: ast.AlterDatabaseStmt, output: RawStream) -> None: ... + +def alter_database_set_stmt(node: ast.AlterDatabaseSetStmt, output: RawStream) -> None: ... + +def alter_extension_stmt(node: ast.AlterExtensionStmt, output: RawStream) -> None: ... + +def alter_extension_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def alter_extension_contents_stmt(node: ast.AlterExtensionContentsStmt, output: RawStream) -> None: ... + +def alter_enum_stmt(node: ast.AlterEnumStmt, output: RawStream) -> None: ... + +def alter_default_privileges_stmt(node: ast.AlterDefaultPrivilegesStmt, output: RawStream) -> None: ... + +def alter_function_stmt(node: ast.AlterFunctionStmt, output: RawStream) -> None: ... + +def alter_object_schema_stmt(node: ast.AlterObjectSchemaStmt, output: RawStream) -> None: ... + +def alter_operator_stmt(node: ast.AlterOperatorStmt, output: RawStream) -> None: ... + +def alter_operator_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def alter_op_family_stmt(node: ast.AlterOpFamilyStmt, output: RawStream) -> None: ... + +def alter_owner_stmt(node: ast.AlterOwnerStmt, output: RawStream) -> None: ... + +def alter_policy_stmt(node: ast.AlterPolicyStmt, output: RawStream) -> None: ... + +def alter_role_stmt(node: ast.AlterRoleStmt, output: RawStream) -> None: ... + +def alter_seq_stmt(node: ast.AlterSeqStmt, output: RawStream) -> None: ... + +def alter_tablespace_options_stmt(node: ast.AlterTableSpaceOptionsStmt, output: RawStream) -> None: ... + +def alter_table_stmt(node: ast.AlterTableStmt, output: RawStream) -> None: ... + +def alter_def_elem(node: ast.Node, output: RawStream) -> None: ... + +def range_var(node: ast.RangeVar, output: RawStream) -> None: ... + +class AlterTableTypePrinter(IntEnumPrinter[enums.AlterTableType]): + enum: ClassVar[type[enums.AlterTableType]] + def AT_AddColumn(self, node: ast.Node, output: RawStream) -> None: ... + def AT_AddConstraint(self, node: ast.Node, output: RawStream) -> None: ... + def AT_AddInherit(self, node: ast.Node, output: RawStream) -> None: ... + def AT_AddOf(self, node: ast.Node, output: RawStream) -> None: ... + def AT_AlterColumnType(self, node: ast.Node, output: RawStream) -> None: ... + def AT_AlterConstraint(self, node: ast.Node, output: RawStream) -> None: ... + def AT_AttachPartition(self, node: ast.Node, output: RawStream) -> None: ... + def AT_ChangeOwner(self, node: ast.Node, output: RawStream) -> None: ... + def AT_ClusterOn(self, node: ast.Node, output: RawStream) -> None: ... + def AT_ColumnDefault(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DetachPartition(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DetachPartitionFinalize(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DisableRowSecurity(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DisableTrig(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DropCluster(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DropColumn(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DropConstraint(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DropInherit(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DropNotNull(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DropOf(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DropOids(self, node: ast.Node, output: RawStream) -> None: ... + def AT_EnableRowSecurity(self, node: ast.Node, output: RawStream) -> None: ... + def AT_EnableTrig(self, node: ast.Node, output: RawStream) -> None: ... + def AT_EnableTrigAll(self, node: ast.Node, output: RawStream) -> None: ... + def AT_ForceRowSecurity(self, node: ast.Node, output: RawStream) -> None: ... + def AT_SetCompression(self, node: ast.Node, output: RawStream) -> None: ... + def AT_ReplicaIdentity(self, node: ast.Node, output: RawStream) -> None: ... + def AT_ResetOptions(self, node: ast.Node, output: RawStream) -> None: ... + def AT_ResetRelOptions(self, node: ast.Node, output: RawStream) -> None: ... + def AT_SetNotNull(self, node: ast.Node, output: RawStream) -> None: ... + def AT_SetRelOptions(self, node: ast.Node, output: RawStream) -> None: ... + def AT_SetStatistics(self, node: ast.Node, output: RawStream) -> None: ... + def AT_SetStorage(self, node: ast.Node, output: RawStream) -> None: ... + def AT_SetUnLogged(self, node: ast.Node, output: RawStream) -> None: ... + def AT_SetLogged(self, node: ast.Node, output: RawStream) -> None: ... + def AT_SetOptions(self, node: ast.Node, output: RawStream) -> None: ... + def AT_ValidateConstraint(self, node: ast.Node, output: RawStream) -> None: ... + def AT_AlterColumnGenericOptions(self, node: ast.Node, output: RawStream) -> None: ... + def AT_GenericOptions(self, node: ast.Node, output: RawStream) -> None: ... + def AT_SetTableSpace(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DropExpression(self, node: ast.Node, output: RawStream) -> None: ... + def AT_AddIdentity(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DropIdentity(self, node: ast.Node, output: RawStream) -> None: ... + def AT_NoForceRowSecurity(self, node: ast.Node, output: RawStream) -> None: ... + def AT_EnableRule(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DisableRule(self, node: ast.Node, output: RawStream) -> None: ... + def AT_EnableReplicaRule(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DisableTrigUser(self, node: ast.Node, output: RawStream) -> None: ... + def AT_EnableReplicaTrig(self, node: ast.Node, output: RawStream) -> None: ... + def AT_EnableAlwaysTrig(self, node: ast.Node, output: RawStream) -> None: ... + def AT_DisableTrigAll(self, node: ast.Node, output: RawStream) -> None: ... + def AT_SetIdentity(self, node: ast.Node, output: RawStream) -> None: ... + def AT_SetAccessMethod(self, node: ast.Node, output: RawStream) -> None: ... + def AT_SetExpression(self, node: ast.Node, output: RawStream) -> None: ... + + +alter_table_type_printer: AlterTableTypePrinter + +def alter_table_cmd(node: ast.AlterTableCmd, output: RawStream) -> None: ... + +def alter_table_cmd_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def alter_table_move_all_stmt(node: ast.AlterTableMoveAllStmt, output: RawStream) -> None: ... + +class AlterTSConfigTypePrinter(IntEnumPrinter[enums.AlterTSConfigType]): + enum: ClassVar[type[enums.AlterTSConfigType]] + def print_simple_name(self, node: ast.Node, output: RawStream) -> None: ... + def print_simple_list(self, nodes: Any, output: RawStream) -> None: ... + def ALTER_TSCONFIG_ADD_MAPPING(self, node: ast.Node, output: RawStream) -> None: ... + def ALTER_TSCONFIG_ALTER_MAPPING_FOR_TOKEN(self, node: ast.Node, output: RawStream) -> None: ... + def ALTER_TSCONFIG_REPLACE_DICT(self, node: ast.Node, output: RawStream) -> None: ... + def ALTER_TSCONFIG_REPLACE_DICT_FOR_TOKEN(self, node: ast.Node, output: RawStream) -> None: ... + def ALTER_TSCONFIG_DROP_MAPPING(self, node: ast.Node, output: RawStream) -> None: ... + + +alter_ts_config_type_printer: AlterTSConfigTypePrinter + +def alter_ts_configuration_stmt(node: ast.AlterTSConfigurationStmt, output: RawStream) -> None: ... + +def alter_ts_dictionary_stmt(node: ast.AlterTSDictionaryStmt, output: RawStream) -> None: ... + +def alter_stats_stmt(node: ast.AlterStatsStmt, output: RawStream) -> None: ... + +class AlterSubscriptionTypePrinter(IntEnumPrinter[enums.AlterSubscriptionType]): + enum: ClassVar[type[enums.AlterSubscriptionType]] + def ALTER_SUBSCRIPTION_OPTIONS(self, node: ast.Node, output: RawStream) -> None: ... + def ALTER_SUBSCRIPTION_CONNECTION(self, node: ast.Node, output: RawStream) -> None: ... + def ALTER_SUBSCRIPTION_SET_PUBLICATION(self, node: ast.Node, output: RawStream) -> None: ... + def ALTER_SUBSCRIPTION_ADD_PUBLICATION(self, node: ast.Node, output: RawStream) -> None: ... + def ALTER_SUBSCRIPTION_DROP_PUBLICATION(self, node: ast.Node, output: RawStream) -> None: ... + def ALTER_SUBSCRIPTION_REFRESH(self, node: ast.Node, output: RawStream) -> None: ... + def ALTER_SUBSCRIPTION_ENABLED(self, node: ast.Node, output: RawStream) -> None: ... + def ALTER_SUBSCRIPTION_SKIP(self, node: ast.Node, output: RawStream) -> None: ... + + +alter_subscription_type_printer: AlterSubscriptionTypePrinter + +def alter_subscription_stmt(node: ast.AlterSubscriptionStmt, output: RawStream) -> None: ... + +class AlterPublicationActionPrinter(IntEnumPrinter[enums.AlterPublicationAction]): + enum: ClassVar[type[enums.AlterPublicationAction]] + def AP_AddObjects(self, node: ast.Node, output: RawStream) -> None: ... + def AP_DropObjects(self, node: ast.Node, output: RawStream) -> None: ... + def AP_SetObjects(self, node: ast.Node, output: RawStream) -> None: ... + + +alter_publication_action_printer: AlterPublicationActionPrinter + +def alter_publication_stmt(node: ast.AlterPublicationStmt, output: RawStream) -> None: ... + +def alter_fdw_stmt(node: ast.AlterFdwStmt, output: RawStream) -> None: ... + +def alter_fdw_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def alter_foreign_server_stmt(node: ast.AlterForeignServerStmt, output: RawStream) -> None: ... + +def alter_user_mapping_stmt(node: ast.AlterUserMappingStmt, output: RawStream) -> None: ... + +def alter_role_set_stmt(node: ast.AlterRoleSetStmt, output: RawStream) -> None: ... + +def alter_domain_stmt(node: ast.AlterDomainStmt, output: RawStream) -> None: ... + +def alter_event_trig_stmt(node: ast.AlterEventTrigStmt, output: RawStream) -> None: ... + +def alter_type_stmt(node: ast.AlterTypeStmt, output: RawStream) -> None: ... + +def at_alter_constraint(node: ast.ATAlterConstraint, output: RawStream) -> None: ... + +def check_point_stmt(node: ast.CheckPointStmt, output: RawStream) -> None: ... + +def cluster_stmt(node: ast.ClusterStmt, output: RawStream) -> None: ... + +def column_def(node: ast.ColumnDef, output: RawStream) -> None: ... + +def comment_stmt(node: ast.CommentStmt, output: RawStream) -> None: ... + +def composite_type_stmt(node: ast.CompositeTypeStmt, output: RawStream) -> None: ... + +def composite_type_stmt_range_var(node: ast.RangeVar, output: RawStream) -> None: ... + +class ConstrTypePrinter(IntEnumPrinter[enums.ConstrType]): + enum: ClassVar[type[enums.ConstrType]] + def CONSTR_NULL(self, node: ast.Node, output: RawStream) -> None: ... + def CONSTR_NOTNULL(self, node: ast.Node, output: RawStream) -> None: ... + def CONSTR_DEFAULT(self, node: ast.Node, output: RawStream) -> None: ... + def CONSTR_IDENTITY(self, node: ast.Node, output: RawStream) -> None: ... + def CONSTR_GENERATED(self, node: ast.Node, output: RawStream) -> None: ... + def CONSTR_CHECK(self, node: ast.Node, output: RawStream) -> None: ... + def CONSTR_PRIMARY(self, node: ast.Node, output: RawStream) -> None: ... + def CONSTR_UNIQUE(self, node: ast.Node, output: RawStream) -> None: ... + def CONSTR_EXCLUSION(self, node: ast.Node, output: RawStream) -> None: ... + def CONSTR_FOREIGN(self, node: ast.Node, output: RawStream) -> None: ... + def CONSTR_ATTR_DEFERRABLE(self, node: ast.Node, output: RawStream) -> None: ... + def CONSTR_ATTR_NOT_DEFERRABLE(self, node: ast.Node, output: RawStream) -> None: ... + def CONSTR_ATTR_DEFERRED(self, node: ast.Node, output: RawStream) -> None: ... + def CONSTR_ATTR_IMMEDIATE(self, node: ast.Node, output: RawStream) -> None: ... + def CONSTR_ATTR_ENFORCED(self, node: ast.Node, output: RawStream) -> None: ... + def CONSTR_ATTR_NOT_ENFORCED(self, node: ast.Node, output: RawStream) -> None: ... + + +constr_type_printer: ConstrTypePrinter + +def constraint(node: ast.Constraint, output: RawStream) -> None: ... + +def create_am_stmt(node: ast.CreateAmStmt, output: RawStream) -> None: ... + +def create_db_stmt(node: ast.CreatedbStmt, output: RawStream) -> None: ... + +def create_db_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def create_cast_stmt(node: ast.CreateCastStmt, output: RawStream) -> None: ... + +def create_conversion_stmt(node: ast.CreateConversionStmt, output: RawStream) -> None: ... + +def create_domain_stmt(node: ast.CreateDomainStmt, output: RawStream) -> None: ... + +def create_enum_stmt(node: ast.CreateEnumStmt, output: RawStream) -> None: ... + +def create_event_trig_stmt(node: ast.CreateEventTrigStmt, output: RawStream) -> None: ... + +def create_event_trig_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def create_extension_stmt(node: ast.CreateExtensionStmt, output: RawStream) -> None: ... + +def create_extension_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def create_fdw_stmt(node: ast.CreateFdwStmt, output: RawStream) -> None: ... + +def create_fdw_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def create_foreign_server_stmt(node: ast.CreateForeignServerStmt, output: RawStream) -> None: ... + +def create_foreign_table_stmt(node: ast.CreateForeignTableStmt, output: RawStream) -> None: ... + +def create_foreign_table_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def create_function_stmt(node: ast.CreateFunctionStmt, output: RawStream) -> None: ... + +def create_function_option(node: ast.DefElem, output: RawStream) -> None: ... + +def create_opclass_stmt(node: ast.CreateOpClassStmt, output: RawStream) -> None: ... + +def create_opclass_item(node: ast.CreateOpClassItem, output: RawStream) -> None: ... + +def create_op_family_stmt(node: ast.CreateOpFamilyStmt, output: RawStream) -> None: ... + +def create_plang_stmt(node: ast.CreatePLangStmt, output: RawStream) -> None: ... + +def create_policy_stmt(node: ast.CreatePolicyStmt, output: RawStream) -> None: ... + +def create_publication_stmt(node: ast.CreatePublicationStmt, output: RawStream) -> None: ... + +def create_range_stmt(node: ast.CreateRangeStmt, output: RawStream) -> None: ... + +class RoleStmtTypePrinter(IntEnumPrinter[enums.RoleStmtType]): + enum: ClassVar[type[enums.RoleStmtType]] + def ROLESTMT_ROLE(self, node: ast.Node, output: RawStream) -> None: ... + def ROLESTMT_USER(self, node: ast.Node, output: RawStream) -> None: ... + def ROLESTMT_GROUP(self, node: ast.Node, output: RawStream) -> None: ... + + +role_stmt_type_printer: RoleStmtTypePrinter + +def create_role_stmt(node: ast.CreateRoleStmt, output: RawStream) -> None: ... + +def create_or_alter_role_option(node: ast.DefElem, output: RawStream) -> None: ... + +def create_schema_stmt(node: ast.CreateSchemaStmt, output: RawStream) -> None: ... + +def create_seq_stmt(node: ast.CreateSeqStmt, output: RawStream) -> None: ... + +def create_seq_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def create_stats_stmt(node: ast.CreateStatsStmt, output: RawStream) -> None: ... + +def create_stmt(node: ast.CreateStmt, output: RawStream) -> None: ... + +def create_table_as_stmt(node: ast.CreateTableAsStmt, output: RawStream) -> None: ... + +def create_table_space_stmt(node: ast.CreateTableSpaceStmt, output: RawStream) -> None: ... + +def create_trig_stmt(node: ast.CreateTrigStmt, output: RawStream) -> None: ... + +def create_subscription_stmt_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def create_subscription_stmt(node: ast.CreateSubscriptionStmt, output: RawStream) -> None: ... + +def current_of_expr(node: ast.CurrentOfExpr, output: RawStream) -> None: ... + +def create_transform_stmt(node: ast.CreateTransformStmt, output: RawStream) -> None: ... + +def close_portal_stmt(node: ast.ClosePortalStmt, output: RawStream) -> None: ... + +def create_user_mapping_stmt(node: ast.CreateUserMappingStmt, output: RawStream) -> None: ... + +def deallocate_stmt(node: ast.DeallocateStmt, output: RawStream) -> None: ... + +def define_stmt(node: ast.DefineStmt, output: RawStream) -> None: ... + +def def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def define_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +class DiscardModePrinter(IntEnumPrinter[enums.DiscardMode]): + enum: ClassVar[type[enums.DiscardMode]] + def DISCARD_ALL(self, node: ast.Node, output: RawStream) -> None: ... + def DISCARD_PLANS(self, node: ast.Node, output: RawStream) -> None: ... + def DISCARD_SEQUENCES(self, node: ast.Node, output: RawStream) -> None: ... + def DISCARD_TEMP(self, node: ast.Node, output: RawStream) -> None: ... + + +discard_mode_printer: DiscardModePrinter + +def discard_stmt(node: ast.DiscardStmt, output: RawStream) -> None: ... + +def do_stmt(node: ast.DoStmt, output: RawStream) -> None: ... + +def drop_db_stmt(node: ast.DropdbStmt, output: RawStream) -> None: ... + +def drop_owned_stmt(node: ast.DropOwnedStmt, output: RawStream) -> None: ... + +def drop_role_stmt(node: ast.DropRoleStmt, output: RawStream) -> None: ... + +def drop_stmt(node: ast.DropStmt, output: RawStream) -> None: ... + +def drop_subscription_stmt(node: ast.DropSubscriptionStmt, output: RawStream) -> None: ... + +def drop_table_space_stmt(node: ast.DropTableSpaceStmt, output: RawStream) -> None: ... + +def drop_user_mapping_stmt(node: ast.DropUserMappingStmt, output: RawStream) -> None: ... + +def function_parameter(node: ast.FunctionParameter, output: RawStream) -> None: ... + +def grant_stmt(node: ast.GrantStmt, output: RawStream) -> None: ... + +def grant_role_stmt(node: ast.GrantRoleStmt, output: RawStream) -> None: ... + +def grant_role_stmt_opt(node: ast.DefElem, output: RawStream) -> None: ... + +def import_foreign_schema_stmt(node: ast.ImportForeignSchemaStmt, output: RawStream) -> None: ... + +def index_stmt(node: ast.IndexStmt, output: RawStream) -> None: ... + +def load_stmt(node: ast.LoadStmt, output: RawStream) -> None: ... + +LOCK_MODE_NAMES: Any + +def lock_stmt(node: ast.LockStmt, output: RawStream) -> None: ... + +def notify_stmt(node: ast.NotifyStmt, output: RawStream) -> None: ... + +def object_with_args(node: ast.ObjectWithArgs, output: RawStream) -> None: ... + +def alter_object_schema_stmt_object_with_args(node: ast.ObjectWithArgs, output: RawStream) -> None: ... + +def alter_operator_stmt_object_with_args(node: ast.ObjectWithArgs, output: RawStream) -> None: ... + +def alter_owner_stmt_object_with_args(node: ast.ObjectWithArgs, output: RawStream) -> None: ... + +def comment_stmt_object_with_args(node: ast.ObjectWithArgs, output: RawStream) -> None: ... + +def drop_stmt_object_with_args(node: ast.ObjectWithArgs, output: RawStream) -> None: ... + +def partition_bound_spec(node: ast.PartitionBoundSpec, output: RawStream) -> None: ... + +def partition_cmd(node: ast.PartitionCmd, output: RawStream) -> None: ... + +def partition_elem(node: ast.PartitionElem, output: RawStream) -> None: ... + +def partition_range_datum(node: ast.PartitionRangeDatum, output: RawStream) -> None: ... + +def partition_spec(node: ast.PartitionSpec, output: RawStream) -> None: ... + +class PublicationObjSpecTypePrinter(IntEnumPrinter[enums.PublicationObjSpecType]): + enum: ClassVar[type[enums.PublicationObjSpecType]] + def PUBLICATIONOBJ_TABLE(self, node: ast.Node, output: RawStream) -> None: ... + def PUBLICATIONOBJ_TABLES_IN_SCHEMA(self, node: ast.Node, output: RawStream) -> None: ... + def PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA(self, node: ast.Node, output: RawStream) -> None: ... + + +publication_obj_spec_type_printer: PublicationObjSpecTypePrinter + +def publication_obj_spec(node: ast.PublicationObjSpec, output: RawStream) -> None: ... + +def publication_table(node: ast.PublicationTable, output: RawStream) -> None: ... + +class ReindexKindPrinter(IntEnumPrinter[enums.ReindexObjectType]): + enum: ClassVar[type[enums.ReindexObjectType]] + def REINDEX_OBJECT_DATABASE(self, node: ast.Node, output: RawStream) -> None: ... + def REINDEX_OBJECT_INDEX(self, node: ast.Node, output: RawStream) -> None: ... + def REINDEX_OBJECT_TABLE(self, node: ast.Node, output: RawStream) -> None: ... + def REINDEX_OBJECT_SCHEMA(self, node: ast.Node, output: RawStream) -> None: ... + def REINDEX_OBJECT_SYSTEM(self, node: ast.Node, output: RawStream) -> None: ... + + +reindex_kind_printer: ReindexKindPrinter + +def reindex_stmt(node: ast.ReindexStmt, output: RawStream) -> None: ... + +def reindex_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def rename_stmt(node: ast.RenameStmt, output: RawStream) -> None: ... + +def rename_stmt_range_var(node: ast.RangeVar, output: RawStream) -> None: ... + +def replica_identity_stmt(node: ast.ReplicaIdentityStmt, output: RawStream) -> None: ... + +def role_spec(node: ast.RoleSpec, output: RawStream) -> None: ... + +EVENT_NAMES: Any + +def rule_stmt_printer(node: ast.RuleStmt, output: RawStream) -> None: ... + +def refresh_mat_view_stmt(node: ast.RefreshMatViewStmt, output: RawStream) -> None: ... + +def reassign_owned_stmt(node: ast.ReassignOwnedStmt, output: RawStream) -> None: ... + +def return_stmt(node: ast.ReturnStmt, output: RawStream) -> None: ... + +def sec_label_stmt(node: ast.SecLabelStmt, output: RawStream) -> None: ... + +def stats_elem(node: ast.StatsElem, output: RawStream) -> None: ... + +def table_like_clause(node: ast.TableLikeClause, output: RawStream) -> None: ... + +def trigger_transition(node: ast.TriggerTransition, output: RawStream) -> None: ... + +def vacuum_stmt(node: ast.VacuumStmt, output: RawStream) -> None: ... + +def vacuum_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def vacuum_relation(node: ast.VacuumRelation, output: RawStream) -> None: ... + +def print_transaction_mode_list(node: ast.Node, output: RawStream) -> None: ... + +class VariableSetKindPrinter(IntEnumPrinter[enums.VariableSetKind]): + enum: ClassVar[type[enums.VariableSetKind]] + def VAR_SET_VALUE(self, node: ast.Node, output: RawStream) -> None: ... + def VAR_SET_DEFAULT(self, node: ast.Node, output: RawStream) -> None: ... + def VAR_SET_CURRENT(self, node: ast.Node, output: RawStream) -> None: ... + def VAR_SET_MULTI(self, node: ast.Node, output: RawStream) -> None: ... + def VAR_RESET(self, node: ast.Node, output: RawStream) -> None: ... + def VAR_RESET_ALL(self, node: ast.Node, output: RawStream) -> None: ... + + +variable_set_kind_printer: VariableSetKindPrinter + +def variable_set_stmt(node: ast.VariableSetStmt, output: RawStream) -> None: ... + +def variable_show_statement(node: ast.VariableShowStmt, output: RawStream) -> None: ... + +class ViewCheckOptionPrinter(IntEnumPrinter[enums.ViewCheckOption]): + enum: ClassVar[type[enums.ViewCheckOption]] + def NO_CHECK_OPTION(self, node: ast.Node, output: RawStream) -> None: ... + def LOCAL_CHECK_OPTION(self, node: ast.Node, output: RawStream) -> None: ... + def CASCADED_CHECK_OPTION(self, node: ast.Node, output: RawStream) -> None: ... + + +view_check_option_printer: ViewCheckOptionPrinter + +def view_stmt(node: ast.ViewStmt, output: RawStream) -> None: ... + +def view_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... diff --git a/pglast/printers/dml.pyi b/pglast/printers/dml.pyi new file mode 100644 index 0000000..2dd478c --- /dev/null +++ b/pglast/printers/dml.pyi @@ -0,0 +1,422 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from dml.py +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2017-2026 Lele Gaifax +# + +from typing import Any, ClassVar + +from .. import ast, enums +from ..stream import RawStream +from . import IntEnumPrinter + +def a_array_expr(node: ast.A_ArrayExpr, output: RawStream) -> None: ... + +def a_const(node: ast.A_Const, output: RawStream) -> None: ... + +class AExprKindPrinter(IntEnumPrinter[enums.A_Expr_Kind]): + enum: ClassVar[type[enums.A_Expr_Kind]] + def AEXPR_BETWEEN(self, node: ast.Node, output: RawStream) -> None: ... + def AEXPR_BETWEEN_SYM(self, node: ast.Node, output: RawStream) -> None: ... + def AEXPR_DISTINCT(self, node: ast.Node, output: RawStream) -> None: ... + def AEXPR_ILIKE(self, node: ast.Node, output: RawStream) -> None: ... + def AEXPR_IN(self, node: ast.Node, output: RawStream) -> None: ... + def AEXPR_LIKE(self, node: ast.Node, output: RawStream) -> None: ... + def AEXPR_NOT_BETWEEN(self, node: ast.Node, output: RawStream) -> None: ... + def AEXPR_NOT_BETWEEN_SYM(self, node: ast.Node, output: RawStream) -> None: ... + def AEXPR_NOT_DISTINCT(self, node: ast.Node, output: RawStream) -> None: ... + def AEXPR_NULLIF(self, node: ast.Node, output: RawStream) -> None: ... + def AEXPR_OP(self, node: ast.Node, output: RawStream) -> None: ... + def AEXPR_OP_ALL(self, node: ast.Node, output: RawStream) -> None: ... + def AEXPR_OP_ANY(self, node: ast.Node, output: RawStream) -> None: ... + def AEXPR_SIMILAR(self, node: ast.Node, output: RawStream) -> None: ... + + +a_expr_kind_printer: AExprKindPrinter + +def a_expr(node: ast.A_Expr, output: RawStream) -> None: ... + +def a_indices(node: ast.A_Indices, output: RawStream) -> None: ... + +def a_indirection(node: ast.A_Indirection, output: RawStream) -> None: ... + +def a_indirection_a_star(node: ast.A_Star, output: RawStream) -> None: ... + +def a_indirection_column_ref(node: ast.ColumnRef, output: RawStream) -> None: ... + +def a_indirection_func_call(node: ast.FuncCall, output: RawStream) -> None: ... + +def a_indirection_field(node: ast.String, output: RawStream) -> None: ... + +def a_star(node: ast.A_Star, output: RawStream) -> None: ... + +def alias(node: ast.Alias, output: RawStream) -> None: ... + +def bitstring(node: ast.BitString, output: RawStream) -> None: ... + +def boolean(node: ast.Boolean, output: RawStream) -> None: ... + +def bool_expr(node: ast.BoolExpr, output: RawStream) -> None: ... + +class BooleanTestPrinter(IntEnumPrinter[enums.BoolTestType]): + enum: ClassVar[type[enums.BoolTestType]] + def IS_FALSE(self, node: ast.Node, output: RawStream) -> None: ... + def IS_NOT_FALSE(self, node: ast.Node, output: RawStream) -> None: ... + def IS_NOT_TRUE(self, node: ast.Node, output: RawStream) -> None: ... + def IS_NOT_UNKNOWN(self, node: ast.Node, output: RawStream) -> None: ... + def IS_TRUE(self, node: ast.Node, output: RawStream) -> None: ... + def IS_UNKNOWN(self, node: ast.Node, output: RawStream) -> None: ... + + +boolean_test_printer: BooleanTestPrinter + +def boolean_test(node: ast.BooleanTest, output: RawStream) -> None: ... + +def call_stmt(node: ast.CallStmt, output: RawStream) -> None: ... + +def case_expr(node: ast.CaseExpr, output: RawStream) -> None: ... + +def case_when(node: ast.CaseWhen, output: RawStream) -> None: ... + +def coalesce_expr(node: ast.CoalesceExpr, output: RawStream) -> None: ... + +def collate_clause(node: ast.CollateClause, output: RawStream) -> None: ... + +def column_ref(node: ast.ColumnRef, output: RawStream) -> None: ... + +class CTEMaterializedPrinter(IntEnumPrinter[enums.CTEMaterialize]): + enum: ClassVar[type[enums.CTEMaterialize]] + def CTEMaterializeAlways(self, node: ast.Node, output: RawStream) -> None: ... + def CTEMaterializeDefault(self, node: ast.Node, output: RawStream) -> None: ... + def CTEMaterializeNever(self, node: ast.Node, output: RawStream) -> None: ... + + +cte_materialize_printer: CTEMaterializedPrinter + +def cte_cycle_clause(node: ast.CTECycleClause, output: RawStream) -> None: ... + +def cte_cycle_clause_type_cast(node: ast.TypeCast, output: RawStream) -> None: ... + +def cte_search_clause(node: ast.CTESearchClause, output: RawStream) -> None: ... + +def common_table_expr(node: ast.CommonTableExpr, output: RawStream) -> None: ... + +def constraints_set_stmt(node: ast.ConstraintsSetStmt, output: RawStream) -> None: ... + +def copy_stmt(node: ast.CopyStmt, output: RawStream) -> None: ... + +def copy_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def declare_cursor_stmt(node: ast.DeclareCursorStmt, output: RawStream) -> None: ... + +def delete_stmt(node: ast.DeleteStmt, output: RawStream) -> None: ... + +def execute_stmt(node: ast.ExecuteStmt, output: RawStream) -> None: ... + +def explain_stmt(node: ast.ExplainStmt, output: RawStream) -> None: ... + +def explain_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +class FetchDirectionPrinter(IntEnumPrinter[enums.FetchDirection]): + enum: ClassVar[type[enums.FetchDirection]] + def FETCH_FORWARD(self, node: ast.Node, output: RawStream) -> None: ... + def FETCH_BACKWARD(self, node: ast.Node, output: RawStream) -> None: ... + def FETCH_ABSOLUTE(self, node: ast.Node, output: RawStream) -> None: ... + def FETCH_RELATIVE(self, node: ast.Node, output: RawStream) -> None: ... + + +fetch_direction_printer: FetchDirectionPrinter + +def fetch_stmt(node: ast.FetchStmt, output: RawStream) -> None: ... + +def float(node: ast.Float, output: RawStream) -> None: ... + +def func_call(node: ast.FuncCall, output: RawStream) -> None: ... + +def func_call_window_def(node: ast.WindowDef, output: RawStream) -> None: ... + +def grouping_set(node: ast.GroupingSet, output: RawStream) -> None: ... + +def grouping_func(node: ast.GroupingFunc, output: RawStream) -> None: ... + +def index_elem(node: ast.IndexElem, output: RawStream) -> None: ... + +def infer_clause(node: ast.InferClause, output: RawStream) -> None: ... + +def integer(node: ast.Integer, output: RawStream) -> None: ... + +def insert_stmt(node: ast.InsertStmt, output: RawStream) -> None: ... + +def into_clause(node: ast.IntoClause, output: RawStream) -> None: ... + +def join_expr(node: ast.JoinExpr, output: RawStream) -> None: ... + +def json_agg_constructor(node: ast.JsonAggConstructor, output: RawStream) -> None: ... + +def json_argument(node: ast.JsonArgument, output: RawStream) -> None: ... + +def json_array_agg(node: ast.JsonArrayAgg, output: RawStream) -> None: ... + +def json_array_constructor(node: ast.JsonArrayConstructor, output: RawStream) -> None: ... + +def json_array_query_constructor(node: ast.JsonArrayQueryConstructor, output: RawStream) -> None: ... + +class JsonBehaviorTypePrinter(IntEnumPrinter[enums.JsonBehaviorType]): + enum: ClassVar[type[enums.JsonBehaviorType]] + def JSON_BEHAVIOR_NULL(self, node: ast.Node, output: RawStream) -> None: ... + def JSON_BEHAVIOR_ERROR(self, node: ast.Node, output: RawStream) -> None: ... + def JSON_BEHAVIOR_EMPTY(self, node: ast.Node, output: RawStream) -> None: ... + def JSON_BEHAVIOR_TRUE(self, node: ast.Node, output: RawStream) -> None: ... + def JSON_BEHAVIOR_FALSE(self, node: ast.Node, output: RawStream) -> None: ... + def JSON_BEHAVIOR_UNKNOWN(self, node: ast.Node, output: RawStream) -> None: ... + def JSON_BEHAVIOR_EMPTY_ARRAY(self, node: ast.Node, output: RawStream) -> None: ... + def JSON_BEHAVIOR_EMPTY_OBJECT(self, node: ast.Node, output: RawStream) -> None: ... + def JSON_BEHAVIOR_DEFAULT(self, node: ast.Node, output: RawStream) -> None: ... + + +json_behavior_type_printer: JsonBehaviorTypePrinter + +def json_behavior(node: ast.JsonBehavior, output: RawStream) -> None: ... + +class JsonEncodingPrinter(IntEnumPrinter[enums.JsonEncoding]): + enum: ClassVar[type[enums.JsonEncoding]] + def JS_ENC_UTF8(self, node: ast.Node, output: RawStream) -> None: ... + def JS_ENC_UTF16(self, node: ast.Node, output: RawStream) -> None: ... + def JS_ENC_UTF32(self, node: ast.Node, output: RawStream) -> None: ... + + +json_encoding_printer: JsonEncodingPrinter + +class JsonFormatTypePrinter(IntEnumPrinter[enums.JsonFormatType]): + enum: ClassVar[type[enums.JsonFormatType]] + def JS_FORMAT_JSON(self, node: ast.Node, output: RawStream) -> None: ... + def JS_FORMAT_JSONB(self, node: ast.Node, output: RawStream) -> None: ... + + +json_format_type_printer: JsonFormatTypePrinter + +def json_format(node: ast.JsonFormat, output: RawStream) -> None: ... + +class JsonExprOpPrinter(IntEnumPrinter[enums.JsonExprOp]): + enum: ClassVar[type[enums.JsonExprOp]] + def JSON_EXISTS_OP(self, node: ast.Node, output: RawStream) -> None: ... + def JSON_QUERY_OP(self, node: ast.Node, output: RawStream) -> None: ... + def JSON_VALUE_OP(self, node: ast.Node, output: RawStream) -> None: ... + def JSON_TABLE_OP(self, node: ast.Node, output: RawStream) -> None: ... + + +json_expr_op_printer: JsonExprOpPrinter + +def json_func_expr(node: ast.JsonFuncExpr, output: RawStream) -> None: ... + +def json_is_predicate(node: ast.JsonIsPredicate, output: RawStream) -> None: ... + +def json_key_value(node: ast.JsonKeyValue, output: RawStream) -> None: ... + +def json_object_agg(node: ast.JsonObjectAgg, output: RawStream) -> None: ... + +def json_object_constructor(node: ast.JsonObjectConstructor, output: RawStream) -> None: ... + +def json_output(node: ast.JsonOutput, output: RawStream) -> None: ... + +def json_parse_expr(node: ast.JsonParseExpr, output: RawStream) -> None: ... + +def json_returning(node: ast.JsonReturning, output: RawStream) -> None: ... + +def json_scalar_expr(node: ast.JsonScalarExpr, output: RawStream) -> None: ... + +def json_serialize_expr(node: ast.JsonSerializeExpr, output: RawStream) -> None: ... + +def json_table(node: ast.JsonTable, output: RawStream) -> None: ... + +class JsonQuotesPrinter(IntEnumPrinter[enums.JsonQuotes]): + enum: ClassVar[type[enums.JsonQuotes]] + def JS_QUOTES_UNSPEC(self, node: ast.Node, output: RawStream) -> None: ... + def JS_QUOTES_KEEP(self, node: ast.Node, output: RawStream) -> None: ... + def JS_QUOTES_OMIT(self, node: ast.Node, output: RawStream) -> None: ... + + +json_quotes_printer: JsonQuotesPrinter + +def json_table_column(node: ast.JsonTableColumn, output: RawStream) -> None: ... + +def json_table_path_spec(node: ast.JsonTablePathSpec, output: RawStream) -> None: ... + +def json_value_expr(node: ast.JsonValueExpr, output: RawStream) -> None: ... + +class JsonValueTypePrinter(IntEnumPrinter[enums.JsonValueType]): + enum: ClassVar[type[enums.JsonValueType]] + def JS_TYPE_ANY(self, node: ast.Node, output: RawStream) -> None: ... + def JS_TYPE_OBJECT(self, node: ast.Node, output: RawStream) -> None: ... + def JS_TYPE_ARRAY(self, node: ast.Node, output: RawStream) -> None: ... + def JS_TYPE_SCALAR(self, node: ast.Node, output: RawStream) -> None: ... + + +json_value_type_printer: JsonValueTypePrinter + +def locking_clause(node: ast.LockingClause, output: RawStream) -> None: ... + +def listen_stmt(node: ast.ListenStmt, output: RawStream) -> None: ... + +class MergeMatchKindPrinter(IntEnumPrinter[enums.MergeMatchKind]): + enum: ClassVar[type[enums.MergeMatchKind]] + def MERGE_WHEN_MATCHED(self, node: ast.Node, output: RawStream) -> None: ... + def MERGE_WHEN_NOT_MATCHED_BY_SOURCE(self, node: ast.Node, output: RawStream) -> None: ... + def MERGE_WHEN_NOT_MATCHED_BY_TARGET(self, node: ast.Node, output: RawStream) -> None: ... + + +merge_match_kind_printer: MergeMatchKindPrinter + +def merge_stmt(node: ast.MergeStmt, output: RawStream) -> None: ... + +def merge_support_func(node: ast.MergeSupportFunc, output: RawStream) -> None: ... + +def merge_when_clause(node: ast.MergeWhenClause, output: RawStream) -> None: ... + +def min_max_expr(node: ast.MinMaxExpr, output: RawStream) -> None: ... + +def multi_assign_ref(node: ast.MultiAssignRef, output: RawStream) -> None: ... + +def named_arg_expr(node: ast.NamedArgExpr, output: RawStream) -> None: ... + +def null_test(node: ast.NullTest, output: RawStream) -> None: ... + +def param_ref(node: ast.ParamRef, output: RawStream) -> None: ... + +def prepare_stmt(node: ast.PrepareStmt, output: RawStream) -> None: ... + +def on_conflict_clause(node: ast.OnConflictClause, output: RawStream) -> None: ... + +def range_function(node: ast.RangeFunction, output: RawStream) -> None: ... + +def range_subselect(node: ast.RangeSubselect, output: RawStream) -> None: ... + +def range_table_func(node: ast.RangeTableFunc, output: RawStream) -> None: ... + +def range_table_func_res_target(node: ast.ResTarget, output: RawStream) -> None: ... + +def range_table_func_col(node: ast.RangeTableFuncCol, output: RawStream) -> None: ... + +def range_var(node: ast.RangeVar, output: RawStream) -> None: ... + +def range_table_sample(node: ast.RangeTableSample, output: RawStream) -> None: ... + +def raw_stmt(node: ast.RawStmt, output: RawStream) -> None: ... + +def returning_clause(node: ast.ReturningClause, output: RawStream) -> None: ... + +def returning_option(node: ast.ReturningOption, output: RawStream) -> None: ... + +def res_target(node: ast.ResTarget, output: RawStream) -> None: ... + +def row_expr(node: ast.RowExpr, output: RawStream) -> None: ... + +def select_stmt(node: ast.SelectStmt, output: RawStream) -> None: ... + +def set_to_default(node: ast.SetToDefault, output: RawStream) -> None: ... + +def sort_by(node: ast.SortBy, output: RawStream) -> None: ... + +class SQLValueFunctionOpPrinter(IntEnumPrinter[enums.SQLValueFunctionOp]): + enum: ClassVar[type[enums.SQLValueFunctionOp]] + def SVFOP_CURRENT_CATALOG(self, node: ast.Node, output: RawStream) -> None: ... + def SVFOP_CURRENT_DATE(self, node: ast.Node, output: RawStream) -> None: ... + def SVFOP_CURRENT_ROLE(self, node: ast.Node, output: RawStream) -> None: ... + def SVFOP_CURRENT_SCHEMA(self, node: ast.Node, output: RawStream) -> None: ... + def SVFOP_CURRENT_TIME(self, node: ast.Node, output: RawStream) -> None: ... + def SVFOP_CURRENT_TIMESTAMP(self, node: ast.Node, output: RawStream) -> None: ... + def SVFOP_CURRENT_TIMESTAMP_N(self, node: ast.Node, output: RawStream) -> None: ... + def SVFOP_CURRENT_TIME_N(self, node: ast.Node, output: RawStream) -> None: ... + def SVFOP_CURRENT_USER(self, node: ast.Node, output: RawStream) -> None: ... + def SVFOP_LOCALTIME(self, node: ast.Node, output: RawStream) -> None: ... + def SVFOP_LOCALTIMESTAMP(self, node: ast.Node, output: RawStream) -> None: ... + def SVFOP_LOCALTIMESTAMP_N(self, node: ast.Node, output: RawStream) -> None: ... + def SVFOP_LOCALTIME_N(self, node: ast.Node, output: RawStream) -> None: ... + def SVFOP_SESSION_USER(self, node: ast.Node, output: RawStream) -> None: ... + def SVFOP_USER(self, node: ast.Node, output: RawStream) -> None: ... + + +sql_value_function_op_printer: SQLValueFunctionOpPrinter + +def sql_value_function(node: ast.SQLValueFunction, output: RawStream) -> None: ... + +def string(node: ast.String, output: RawStream, is_name: bool = ..., is_symbol: bool = ...) -> None: ... + +def sub_link(node: ast.SubLink, output: RawStream) -> None: ... + +def transaction_stmt(node: ast.TransactionStmt, output: RawStream) -> None: ... + +def transaction_stmt_def_elem(node: ast.DefElem, output: RawStream) -> None: ... + +def truncate_stmt(node: ast.TruncateStmt, output: RawStream) -> None: ... + +def type_cast(node: ast.TypeCast, output: RawStream) -> None: ... + +MONTH: int + +YEAR: int + +DAY: int + +HOUR: int + +MINUTE: int + +SECOND: int + +interval_ranges: Any + +system_types: Any + +def type_name(node: ast.TypeName, output: RawStream) -> None: ... + +def variable_set_stmt_type_cast(node: ast.TypeCast, output: RawStream) -> None: ... + +def update_stmt(node: ast.UpdateStmt, output: RawStream) -> None: ... + +def unlisten_stmt(node: ast.UnlistenStmt, output: RawStream) -> None: ... + +def with_clause(node: ast.WithClause, output: RawStream) -> None: ... + +def window_def(node: ast.WindowDef, output: RawStream) -> None: ... + +def print_indirection(node: ast.Node, output: RawStream) -> None: ... + +def update_stmt_res_target(node: ast.ResTarget, output: RawStream) -> None: ... + +class XmlOptionTypePrinter(IntEnumPrinter[enums.XmlOptionType]): + enum: ClassVar[type[enums.XmlOptionType]] + def XMLOPTION_DOCUMENT(self, node: ast.Node, output: RawStream) -> None: ... + def XMLOPTION_CONTENT(self, node: ast.Node, output: RawStream) -> None: ... + + +xml_option_type_printer: XmlOptionTypePrinter + +class XmlStandaloneTypePrinter(IntEnumPrinter[enums.XmlStandaloneType]): + enum: ClassVar[type[enums.XmlStandaloneType]] + def XML_STANDALONE_YES(self, node: ast.Node, output: RawStream) -> None: ... + def XML_STANDALONE_NO(self, node: ast.Node, output: RawStream) -> None: ... + def XML_STANDALONE_NO_VALUE(self, node: ast.Node, output: RawStream) -> None: ... + def XML_STANDALONE_OMITTED(self, node: ast.Node, output: RawStream) -> None: ... + + +xml_standalone_type_printer: XmlStandaloneTypePrinter + +class XmlExprOpPrinter(IntEnumPrinter[enums.XmlExprOp]): + enum: ClassVar[type[enums.XmlExprOp]] + def IS_XMLCONCAT(self, node: ast.Node, output: RawStream) -> None: ... + def IS_XMLELEMENT(self, node: ast.Node, output: RawStream) -> None: ... + def IS_XMLFOREST(self, node: ast.Node, output: RawStream) -> None: ... + def IS_XMLPARSE(self, node: ast.Node, output: RawStream) -> None: ... + def IS_XMLPI(self, node: ast.Node, output: RawStream) -> None: ... + def IS_XMLROOT(self, node: ast.Node, output: RawStream) -> None: ... + def IS_XMLSERIALIZE(self, node: ast.Node, output: RawStream) -> None: ... + def IS_DOCUMENT(self, node: ast.Node, output: RawStream) -> None: ... + + +xml_expr_op_printer: XmlExprOpPrinter + +def xml_expr(node: ast.XmlExpr, output: RawStream) -> None: ... + +def xml_serialize(node: ast.XmlSerialize, output: RawStream) -> None: ... diff --git a/pglast/printers/sfuncs.pyi b/pglast/printers/sfuncs.pyi new file mode 100644 index 0000000..6c4faaf --- /dev/null +++ b/pglast/printers/sfuncs.pyi @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from sfuncs.py +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © 2017-2026 Lele Gaifax +# + +from .. import ast +from ..stream import RawStream + +def btrim(node: ast.FuncCall, output: RawStream) -> None: ... + +def pg_collation_for(node: ast.FuncCall, output: RawStream) -> None: ... + +def extract(node: ast.FuncCall, output: RawStream) -> None: ... + +def ltrim(node: ast.FuncCall, output: RawStream) -> None: ... + +def normalize(node: ast.FuncCall, output: RawStream) -> None: ... + +def overlaps(node: ast.FuncCall, output: RawStream) -> None: ... + +def overlay(node: ast.FuncCall, output: RawStream) -> None: ... + +def position(node: ast.FuncCall, output: RawStream) -> None: ... + +def rtrim(node: ast.FuncCall, output: RawStream) -> None: ... + +def substring(node: ast.FuncCall, output: RawStream) -> None: ... + +def timezone(node: ast.FuncCall, output: RawStream) -> None: ... + +def xmlexists(node: ast.FuncCall, output: RawStream) -> None: ... diff --git a/pglast/stream.pyi b/pglast/stream.pyi new file mode 100644 index 0000000..296050f --- /dev/null +++ b/pglast/stream.pyi @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — Type stubs for pglast.stream module +# :License: GNU General Public License version 3 or later +# + +from collections.abc import Callable, Iterable, Sequence +from contextlib import AbstractContextManager +from io import StringIO +from re import Match +from typing import Any, TextIO + +from . import Comment +from . import ast + +SQLInput = str | ast.Node | tuple[ast.Node, ...] +Printer = Callable[..., Any] + +is_simple_name: Callable[[str], Match[str] | None] + +def maybe_double_quote_name(name: str) -> str: ... + +class OutputStream(StringIO): + pending_separator: bool + last_emitted_char: str + + def __init__(self) -> None: ... + def show(self, where: TextIO = ...) -> None: ... + def separator(self) -> None: ... + def maybe_write_space( + self, + nextc: str | None = None, + _special_chars: set[str] = ..., + ) -> int: ... + def write(self, s: str, /) -> int: ... + def writes(self, s: str) -> int: ... + def swrite(self, s: str) -> int: ... + def swrites(self, s: str) -> int: ... + +class RawStream(OutputStream): + current_column: int + separate_statements: int + special_functions: bool + comma_at_eoln: bool + semicolon_after_last_statement: bool + comments: list[Comment] | None + remove_pg_catalog_from_functions: bool + + def __init__( + self, + separate_statements: int = 1, + special_functions: bool = False, + comma_at_eoln: bool = False, + semicolon_after_last_statement: bool = False, + comments: list[Comment] | None = None, + remove_pg_catalog_from_functions: bool = False, + ) -> None: ... + def show(self, where: TextIO = ...) -> None: ... + def __call__(self, sql: SQLInput, plpgsql: bool = False) -> str: ... + def dedent(self) -> None: ... + def get_printer_for_function(self, name: str) -> Printer | None: ... + def indent(self, amount: int = 0, relative: bool = True) -> None: ... + def newline(self) -> None: ... + def space(self, count: int = 1, force: bool = False) -> None: ... + def push_indent( + self, + amount: int = 0, + relative: bool = True, + ) -> AbstractContextManager[None]: ... + def expression(self, need_parens: bool) -> AbstractContextManager[None]: ... + def write_quoted_string(self, s: str) -> None: ... + def print_comment(self, comment: Comment) -> None: ... + def print_name(self, nodes: Any, sep: str = ".") -> None: ... + def print_symbol(self, nodes: Any, sep: str = ".") -> None: ... + def print_node( + self, + node: Any, + is_name: bool = False, + is_symbol: bool = False, + ) -> None: ... + def print_list( + self, + nodes: Sequence[Any], + sep: str = ",", + relative_indent: int | None = None, + standalone_items: bool | None = None, + are_names: bool = False, + is_symbol: bool = False, + item_needs_parens: Callable[[Any], bool] | None = None, + ) -> None: ... + def print_lists( + self, + lists: Iterable[Sequence[Any]], + sep: str = ",", + relative_indent: int | None = None, + standalone_items: bool | None = None, + are_names: bool = False, + sublist_open: str = "(", + sublist_close: str = ")", + sublist_sep: str = ",", + sublist_relative_indent: int | None = None, + ) -> None: ... + +class IndentedStream(RawStream): + compact_lists_margin: int | None + split_string_literals_threshold: int | None + current_indent: int + indentation_stack: list[int] + + def __init__( + self, + compact_lists_margin: int | None = None, + split_string_literals_threshold: int | None = None, + **options: Any, + ) -> None: ... + def show(self, where: TextIO = ...) -> None: ... + def dedent(self) -> None: ... + def indent(self, amount: int = 0, relative: bool = True) -> None: ... + def push_indent( + self, + amount: int = 0, + relative: bool = True, + ) -> AbstractContextManager[None]: ... + def newline(self) -> None: ... + def space(self, count: int = 1, force: bool = False) -> None: ... + def print_comment(self, comment: Comment) -> None: ... + def print_list( + self, + nodes: Sequence[Any], + sep: str = ",", + relative_indent: int | None = None, + standalone_items: bool | None = None, + are_names: bool = False, + is_symbol: bool = False, + item_needs_parens: Callable[[Any], bool] | None = None, + ) -> None: ... + def write_quoted_string(self, s: str) -> None: ... + def write(self, s: str, /) -> int: ... diff --git a/pglast/visitors.pyi b/pglast/visitors.pyi new file mode 100644 index 0000000..d6aaa54 --- /dev/null +++ b/pglast/visitors.pyi @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — Type stubs for pglast.visitors module +# :License: GNU General Public License version 3 or later +# + +from collections.abc import Callable, Generator +from typing import Any + +from . import ast + +NodeOrNodes = ast.Node | tuple[Any, ...] + +class ActionMeta(type): + def __repr__(cls) -> str: ... + +class Action(metaclass=ActionMeta): + def __new__(cls) -> Any: ... + +class Add(Action): + pass + +class Continue(Action): + pass + +class Delete(Action): + pass + +class Skip(Action): + pass + +class Ancestor: + parent: Ancestor | None + node: Any + member: str | int | None + pending_update: Any + + def __init__( + self, + parent: Ancestor | None = None, + node: Any = None, + member: str | int | None = None, + ) -> None: ... + def __repr__(self) -> str: ... + def __getitem__(self, n: int) -> Any: ... + def __abs__(self) -> Ancestor | None: ... + def find_nearest(self, cls: type[Any]) -> Ancestor | None: ... + def __contains__(self, cls: type[Any]) -> bool: ... + def __truediv__( + self, + node_and_member: tuple[Any, str | int | None], + ) -> Ancestor: ... + def __matmul__(self, root: Any) -> Any: ... + def update(self, new_value: Any) -> Ancestor: ... + def apply(self) -> None: ... + +class Visitor: + root: Any + visit: Callable[[Ancestor, ast.Node], Any] | None + + def __call__(self, node: NodeOrNodes) -> Any: ... + def iterate( + self, + node: NodeOrNodes, + ) -> Generator[tuple[Ancestor, ast.Node], Any, None]: ... + +class ReferencedRelations(Visitor): + cte_names: set[str] + skip_with_clause: Any + r_names: set[str] + + def __init__( + self, + cte_names: set[str] | None = None, + skip_with_clause: Any = None, + ) -> None: ... + def __call__(self, node: NodeOrNodes) -> set[str]: ... + def visit_DropStmt(self, ancestors: Ancestor, node: ast.DropStmt) -> None: ... + def visit_SelectStmt(self, ancestors: Ancestor, node: ast.SelectStmt) -> Any: ... + visit_UpdateStmt: Callable[[Ancestor, ast.UpdateStmt], Any] + visit_InsertStmt: Callable[[Ancestor, ast.InsertStmt], Any] + visit_DeleteStmt: Callable[[Ancestor, ast.DeleteStmt], Any] + def visit_WithClause(self, ancestors: Ancestor, node: ast.WithClause) -> Any: ... + def visit_RangeVar(self, ancestors: Ancestor, node: ast.RangeVar) -> None: ... + +def referenced_relations(stmt: str | NodeOrNodes) -> set[str]: ... diff --git a/pyproject.toml b/pyproject.toml index 3cb07ab..45de03a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -93,6 +93,11 @@ packages = [ "pglast.printers", ] +[tool.setuptools.package-data] +pglast = ["py.typed", "*.pyi"] +"pglast.enums" = ["*.pyi"] +"pglast.printers" = ["*.pyi"] + [tool.bumpversion] current_version = "8.0.dev0" parse = "(?P\\d+)\\.(?P\\d+)(?:\\.(?P[a-zA-Z-]+)(?P\\d*))?" diff --git a/tests/test_typehints.py b/tests/test_typehints.py index 7bd7e3f..4d9d9b4 100644 --- a/tests/test_typehints.py +++ b/tests/test_typehints.py @@ -32,6 +32,7 @@ def stub_parse_sql_basic() -> None: # These should work fine first_stmt: Node = result[0] stmt_count: int = len(result) + assert isinstance(first_stmt, Node), f'Expected Node, got {type(first_stmt)}' assert isinstance(stmt_count, int), f'Expected int, got {type(stmt_count)}' @@ -129,6 +130,112 @@ def stub_parse_plpgsql_function() -> None: assert isinstance(first_item, dict), f'Expected dict, got {type(first_item)}' +def stub_ast_fields() -> None: + """Stub function to test generated AST field type hints.""" + from pglast import ast, parse_sql + + stmt = parse_sql('SELECT 1')[0] + raw: ast.RawStmt = stmt + node: ast.Node = stmt.stmt + location: int | None = stmt.stmt_location + length: int | None = stmt.stmt_len + + assert isinstance(raw, ast.RawStmt) + assert isinstance(node, ast.Node) + assert isinstance(location, int) + assert isinstance(length, int) + + if isinstance(node, ast.SelectStmt): + targets: tuple[object, ...] | None = node.targetList + where_clause: ast.Node | None = node.whereClause + select_all: bool | None = node.all + + assert targets is not None + assert where_clause is None + assert isinstance(select_all, bool) + + +def stub_ast_constructors() -> None: + """Stub function to test permissive generated AST constructors.""" + from pglast import ast + + relation = ast.RangeVar(relname='users', inh=True, relpersistence='p') + relname: str | None = relation.relname + alias: ast.Alias | None = relation.alias + + const = ast.A_Const(isnull=False, val=ast.Integer(ival=1)) + value: ast.Node | None = const.val + + assert relname == 'users' + assert alias is None + assert isinstance(value, ast.Integer) + + +def stub_enums_and_streams() -> None: + """Stub function to test generated enum and stream type hints.""" + from pglast import enums, parse_sql + from pglast.stream import IndentedStream, RawStream + + tag: enums.NodeTag = enums.NodeTag.T_RawStmt + kind: enums.A_Expr_Kind = enums.A_Expr_Kind.AEXPR_OP + lock_mode: int = enums.AccessShareLock + + raw_sql: str = RawStream()(parse_sql('SELECT 1')) + pretty_sql: str = IndentedStream(compact_lists_margin=80)('SELECT 1') + + assert tag is enums.NodeTag.T_RawStmt + assert kind is enums.A_Expr_Kind.AEXPR_OP + assert isinstance(lock_mode, int) + assert raw_sql == 'SELECT 1' + assert pretty_sql == 'SELECT 1' + + +def stub_public_module_types() -> None: + """Stub function to test handwritten public module type hints.""" + from pglast.parser import Comment, comments, split + from pglast.visitors import referenced_relations + + statements: tuple[str, ...] = split('SELECT 1; SELECT 2') + slices: tuple[slice, ...] = split('SELECT 1; SELECT 2', only_slices=True) + parsed_comments: tuple[Comment, ...] = comments('SELECT 1 -- comment') + relations: set[str] = referenced_relations('SELECT * FROM users') + + assert statements == ('SELECT 1', 'SELECT 2') + assert slices == (slice(0, 8), slice(10, 18)) + assert parsed_comments[0].str == '-- comment' + assert relations == {'users'} + + +def stub_remaining_importable_modules() -> None: + """Stub function to test every remaining importable module has useful stubs.""" + from argparse import Namespace + from typing import Any, Callable, Sequence + + from pglast import ast, enums, keywords + from pglast.__main__ import main, workhorse + from pglast.printers import ddl, dml, sfuncs + + reserved: set[str] = keywords.RESERVED_KEYWORDS + unreserved: set[str] = keywords.UNRESERVED_KEYWORDS + main_fn: Callable[[Sequence[str] | None], None] = main + workhorse_fn: Callable[[Namespace], None] = workhorse + select_printer: Callable[[ast.SelectStmt, Any], None] = dml.select_stmt + access_printer: Callable[[ast.AccessPriv, Any], None] = ddl.access_priv + special_printer: Callable[[ast.FuncCall, Any], None] = sfuncs.btrim + alter_enum: type[enums.AlterTableType] = ddl.AlterTableTypePrinter.enum + expr_enum: type[enums.A_Expr_Kind] = dml.AExprKindPrinter.enum + + assert 'select' in reserved + assert 'abort' in unreserved + assert main_fn is main + assert workhorse_fn is workhorse + assert select_printer is dml.select_stmt + assert access_printer is ddl.access_priv + assert special_printer is sfuncs.btrim + assert alter_enum is enums.AlterTableType + assert expr_enum is enums.A_Expr_Kind + + def stub_type_errors() -> None: """ Stub function that should cause type checker errors. @@ -137,7 +244,38 @@ def stub_type_errors() -> None: query: str = 'SELECT 1' # Intentional error, to assert that the type checker is not cheating - wrong_type: int = parse_sql(query) + _wrong_type: int = parse_sql(query) + + +def stub_ast_field_type_errors() -> None: + """ + Stub function that should cause type checker errors on AST field access. + """ + from pglast.parser import parse_sql + + _wrong_type: int = parse_sql('SELECT 1')[0].stmt + + +def stub_ast_constructor_type_errors() -> None: + """ + Stub function that should cause type checker errors for invalid AST construction. + """ + from pglast import ast + + ast.A_Const(isnull=False, val=1) + ast.RangeVar(alias=1) + ast.SelectStmt(all='yes') + + +def stub_stream_type_errors() -> None: + """ + Stub function that should cause type checker errors for stream list inputs. + """ + from pglast import ast + from pglast.stream import RawStream + + nodes = (ast.String(sval='a'), ast.String(sval='b')) + RawStream().print_list((node for node in nodes), sep='.') def run_type_checker_on_stub( @@ -245,7 +383,15 @@ def run_type_checker_on_stub( (stub_parser_functions, True), (stub_prettify_function, True), (stub_parse_plpgsql_function, True), + (stub_ast_fields, True), + (stub_ast_constructors, True), + (stub_enums_and_streams, True), + (stub_public_module_types, True), + (stub_remaining_importable_modules, True), (stub_type_errors, False), + (stub_ast_field_type_errors, False), + (stub_ast_constructor_type_errors, False), + (stub_stream_type_errors, False), ) ) def test_type_check(checker, stub_function, expected_to_pass) -> None: diff --git a/tools/extract_ast.py b/tools/extract_ast.py index c163a7d..d268bf7 100644 --- a/tools/extract_ast.py +++ b/tools/extract_ast.py @@ -233,6 +233,65 @@ class Expr(Node): """ +AST_PYI_HEADER = f"""\ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from struct_defs.json @ %s +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © {CYEARS} Lele Gaifax +# + +from collections.abc import Callable, Iterator +from decimal import Decimal + +from typing import Any, NamedTuple, overload + +from . import enums + + +class SlotTypeInfo(NamedTuple): + c_type: str + py_type: Any + adaptor: Callable[[Any], Any] | None + + +class __Omissis: + def __eq__(self, other: object) -> bool: ... + def __repr__(self) -> str: ... + + +Omissis: __Omissis + + +class Node: + ancestors: Any + _ATTRS_TO_IGNORE_IN_COMPARISON: set[str] + + def __init__(self, data: dict[str, Any]) -> None: ... + def __iter__(self) -> Iterator[str]: ... + def __repr__(self) -> str: ... + def __eq__(self, other: object) -> bool: ... + def __call__( + self, + depth: int | None = None, + ellipsis: Any = ..., + skip_none: bool = False, + ) -> dict[str, Any]: ... + def __setattr__(self, name: str, value: Any) -> None: ... + + +class Expr(Node): + pass + + +_NodePayload = dict[str, Any] +_ListInput = list[Any] | tuple[Any, ...] +_BitmapsetInput = set[int] | list[int] | tuple[int, ...] +_CharInput = str | int +_FloatStringInput = str | int | float | Decimal +""" + + AST_PYX_HEADER = f"""\ # -*- coding: utf-8 -*- # :Project: pglast — DO NOT EDIT: automatically extracted from struct_defs.json @ %s @@ -571,19 +630,25 @@ def import_pglast_enums(): # to generate the AST module, say when the version of libpg_query changes) we usually # cannot import the top-level module, because the parser has not been compiled yet... - try: - from pglast import enums - except ModuleNotFoundError: - from importlib.util import module_from_spec - from importlib.util import spec_from_file_location - from pathlib import Path - import sys - - srcdir = Path(__file__).parent.parent / 'pglast' - spec = spec_from_file_location('pglast.enums', srcdir / 'enums' / '__init__.py') - enums = module_from_spec(spec) - sys.modules['pglast.enums'] = enums - spec.loader.exec_module(enums) + from importlib.util import module_from_spec + from importlib.util import spec_from_file_location + from types import ModuleType + import sys + + srcdir = Path(__file__).parent.parent / 'pglast' + package = ModuleType('pglast') + package.__path__ = [str(srcdir)] + sys.modules['pglast'] = package + + spec = spec_from_file_location( + 'pglast.enums', + srcdir / 'enums' / '__init__.py', + submodule_search_locations=[str(srcdir / 'enums')], + ) + assert spec is not None and spec.loader is not None + enums = module_from_spec(spec) + sys.modules['pglast.enums'] = enums + spec.loader.exec_module(enums) return enums @@ -745,6 +810,141 @@ def __init__(self): # pragma: no cover doc.write(f' {comment}\n\n') +INT_CTYPES = { + 'AclMode', + 'AttrNumber', + 'Index', + 'RelFileNumber', + 'SubTransactionId', + 'bits32', + 'int', + 'int16', + 'int32', + 'long', + 'uint32', + 'uint64', +} + +FLOAT_CTYPES = {'Cardinality', 'Cost'} + + +def stub_read_type_for_attr(cls_name, attr, ctype, enums): + if cls_name == 'RawStmt' and attr == 'stmt': + return 'Node' + if ctype == 'List*': + return 'tuple[Any, ...] | None' + if ctype == 'ParseLoc': + return 'int | None' + if ctype == 'bool': + return 'bool | None' + if ctype in ('char', 'char*'): + return 'str | None' + if ctype in INT_CTYPES: + return 'int | None' + if ctype in FLOAT_CTYPES: + return 'float | None' + if ctype == 'CreateStmt': + return 'CreateStmt | None' + if ctype == 'Bitmapset*': + return 'set[int] | None' + if ctype == 'Expr*': + return 'Expr | None' + if ctype == 'Node*': + return 'Node | None' + if ctype in ('JsonTablePlan', 'ValUnion'): + return 'Node | None' + if ctype in enums: + return f'enums.{ctype} | None' + if ctype.endswith('*'): + return f'{ctype[:-1]} | None' + return 'Any' + + +def stub_input_type_for_attr(cls_name, attr, ctype, enums): + if cls_name == 'RawStmt' and attr == 'stmt': + return 'Node | _NodePayload' + if ctype == 'List*': + return '_ListInput' + if ctype == 'ParseLoc': + return 'int' + if ctype == 'bool': + return 'bool | int' + if ctype == 'char': + return '_CharInput' + if cls_name == 'Float' and ctype == 'char*': + return '_FloatStringInput' + if ctype == 'char*': + return 'str' + if ctype in INT_CTYPES: + return 'int' + if ctype in FLOAT_CTYPES: + return 'float' + if ctype == 'CreateStmt': + return 'CreateStmt | _NodePayload' + if ctype == 'Bitmapset*': + return '_BitmapsetInput' + if ctype == 'Expr*': + return 'Expr | _NodePayload' + if ctype == 'Node*': + return 'Node | _NodePayload' + if ctype in ('JsonTablePlan', 'ValUnion'): + return 'Node' + if ctype in enums: + return f'enums.{ctype} | int | str | dict[str, Any]' + if ctype.endswith('*'): + return f'{ctype[:-1]} | _NodePayload' + return 'Any' + + +def optional_constructor_type(type): + if type == 'Any': + return 'Any' + return f'{type} | None' + + +def emit_node_stub_def(name, fields, enums, output): + attrs = [] + superclass = 'Node' + + for field in fields: + if 'name' not in field or 'c_type' not in field: + continue + + ctype = field['c_type'] + if ctype == 'Expr': + superclass = 'Expr' + continue + if ctype in ('NodeTag', 'Oid'): + continue + + fname = field['name'] + if iskeyword(fname): + fname = f'{fname}_' + + attrs.append( + ( + fname, + stub_read_type_for_attr(name, fname, ctype, enums), + stub_input_type_for_attr(name, fname, ctype, enums), + ) + ) + + output.write(f'\n\nclass {name}({superclass}):\n') + if attrs: + for attr, read_type, __ in attrs: + output.write(f' {attr}: {read_type}\n') + output.write(' @overload\n') + output.write(' def __init__(self, data: _NodePayload, /) -> None: ...\n') + output.write(' @overload\n') + args = ', '.join( + f'{attr}: {optional_constructor_type(input_type)} = None' + for attr, __, input_type in attrs + ) + output.write(f' def __init__(self, {args}) -> None: ... # noqa: E501\n') + else: + output.write(' def __init__(self) -> None: ...\n') + + def emit_node_create_function(nodes, enums, output): pglast_enums = import_pglast_enums() @@ -839,6 +1039,19 @@ def __init__(self, value=None): # pragma: no cover # noqa: E501 """) +def emit_valunion_stub_def(output): + output.write(""" + + +class ValUnion(Node): + val: Node | None + @overload + def __init__(self, data: _NodePayload, /) -> None: ... + @overload + def __init__(self, value: Node | None = None) -> None: ... +""") + + def workhorse(args): libpg_query_version, libpg_query_baseurl = get_libpg_query_info() @@ -1027,6 +1240,15 @@ def adaptor(value): del _fixup_attribute_types_in_slots ''') + ast_pyi = args.output_dir / 'ast.pyi' + with ast_pyi.open('w', encoding='utf-8') as output: + output.write(AST_PYI_HEADER % libpg_query_version) + + for name, fields in sorted(nodes): + if name == 'A_Const': + emit_valunion_stub_def(output) + emit_node_stub_def(name, fields, enums, output) + ast_pyx = args.output_dir / 'ast.pyx' with ast_pyx.open('w', encoding='utf-8') as output: output.write(AST_PYX_HEADER % libpg_query_version) diff --git a/tools/extract_enums.py b/tools/extract_enums.py index 1c06638..aca41e1 100644 --- a/tools/extract_enums.py +++ b/tools/extract_enums.py @@ -7,8 +7,10 @@ # from datetime import date +from os import environ from os.path import basename, splitext from re import match +from shutil import which import subprocess from pycparser import c_ast, c_parser @@ -36,6 +38,16 @@ class StrEnum(str, Enum): """ +PYI_HEADER = f"""\ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from %s @ %s +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © {CYEARS} Lele Gaifax +# +""" + + RST_HEADER = f"""\ .. -*- coding: utf-8 -*- .. :Project: pglast — DO NOT EDIT: generated automatically @@ -68,10 +80,13 @@ def get_libpg_query_info(): return version, baseurl -def preprocess(fname, cpp_args=[]): +def preprocess(fname, cpp_args=()): "Preprocess the given header and return the result." - result = subprocess.check_output(['cpp', '-E', '-include', 'c.h', *cpp_args, fname]) + # macOS /usr/bin/cpp may expose SDK typedef enums that pycparser cannot + # parse. Prefer clang unless the caller selected a preprocessor explicitly. + cpp = environ.get('CPP') or which('clang') or 'cpp' + result = subprocess.check_output([cpp, '-E', '-include', 'c.h', *cpp_args, fname]) return result.decode('utf-8') @@ -127,9 +142,13 @@ def extract_enums(toc, source): parser = c_parser.CParser() for typedef in typedefs: - td = parser.parse(''.join(typedef)) - if td.ext[0].name in toc: - yield td + source = ''.join(typedef) + m = match(r'typedef enum\s+([\w_]+)', source) + if m is None: + m = match(r'.*}\s+([\w_]+)\s*;', source) + if m is None or m.group(1) not in toc: + continue + yield parser.parse(source) def extract_defines(source): @@ -206,6 +225,16 @@ def write_enum(name, enum, output): output.write(' %s = %s\n' % (item.name, value_factory(index, item))) +def write_enum_stub(name, enum, output): + enum_type, __ = determine_enum_type_and_value(enum) + if enum_type == 'StrEnum': + enum_type = 'str, Enum' + output.write('\n\n') + output.write('class %s(%s):\n' % (name, enum_type)) + for item in enum.values.enumerators: + output.write(' %s = ...\n' % item.name) + + def write_enum_doc(name, enum, output, toc, url, mod_name): output.write('\n\n.. class:: pglast.enums.%s.%s\n' % (mod_name, name)) if name in toc: @@ -215,25 +244,39 @@ def write_enum_doc(name, enum, output, toc, url, mod_name): output.write('\n .. data:: %s\n' % item.name) +def define_stub_type(value): + return 'str' if value.startswith("'") else 'int' + + def workhorse(args): libpg_query_version, libpg_query_baseurl = get_libpg_query_info() header_url = libpg_query_baseurl + args.header[12:] toc = extract_toc(args.header) preprocessed = preprocess(args.header, ['-I%s' % idir for idir in args.include_directory]) + enum_nodes = sorted(extract_enums(toc, preprocessed), key=lambda x: x.ext[0].name) with open(args.output, 'w', encoding='utf-8') as output, \ + open(args.output + 'i', 'w', encoding='utf-8') as stub_output, \ open(args.rstdoc, 'w', encoding='utf-8') as rstdoc: header_fname = basename(args.header) mod_name = splitext(header_fname)[0] output.write(PY_HEADER % (header_fname, libpg_query_version)) + stub_output.write(PYI_HEADER % (header_fname, libpg_query_version)) + stub_enum_types = set() + for node in enum_nodes: + enum_type, __ = determine_enum_type_and_value(node.ext[0].type.type) + stub_enum_types.add('Enum' if enum_type == 'StrEnum' else enum_type) + if stub_enum_types: + stub_output.write('\nfrom enum import %s\n' % + ', '.join(sorted(stub_enum_types))) rstdoc.write(RST_HEADER % dict( mod_name=mod_name, header_fname=header_fname, extra_decoration='='*(len(mod_name) + len(header_fname)), header_url=header_url)) - for node in sorted(extract_enums(toc, preprocessed), - key=lambda x: x.ext[0].name): + for node in enum_nodes: enum = node.ext[0].type.type write_enum(enum.name or node.ext[0].name, enum, output) + write_enum_stub(enum.name or node.ext[0].name, enum, stub_output) write_enum_doc(enum.name or node.ext[0].name, enum, rstdoc, toc, header_url, mod_name) @@ -246,6 +289,7 @@ def workhorse(args): rstdoc.write('\n') separator_emitted = True output.write('\n%s = %s\n' % (constant, value)) + stub_output.write('\n%s: %s\n' % (constant, define_stub_type(value))) rstdoc.write('\n.. data:: %s\n' % constant) if constant in toc: rstdoc.write('\n See `here for details <%s#L%d>`__.\n' diff --git a/tools/extract_keywords.py b/tools/extract_keywords.py index a6dbe78..82246df 100644 --- a/tools/extract_keywords.py +++ b/tools/extract_keywords.py @@ -26,6 +26,16 @@ """ +PYI_HEADER = f"""\ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from %s @ %s +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © {CYEARS} Lele Gaifax +# +""" + + def get_target_pg_version(): "Return the target PG version" @@ -67,6 +77,12 @@ def workhorse(args): output.write(keywords[1:].lstrip()) output.write('\n') + with open(args.output + 'i', 'w', encoding='utf-8') as output: + output.write(PYI_HEADER % (basename(args.header), get_target_pg_version())) + for type in sorted(bytype): + output.write('\n') + output.write(type + 'S: set[str]\n') + def main(): from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter diff --git a/tools/extract_printer_stubs.py b/tools/extract_printer_stubs.py new file mode 100644 index 0000000..4dba503 --- /dev/null +++ b/tools/extract_printer_stubs.py @@ -0,0 +1,289 @@ +# -*- coding: utf-8 -*- +# :Project: pglast — Extract type stubs from printer modules +# :License: GNU General Public License version 3 or later +# + +import ast as pyast +from datetime import date +from io import StringIO +from pathlib import Path + + +CYEARS = f'2017-{date.today().year}' + + +HEADER = f"""\ +# -*- coding: utf-8 -*- +# :Project: pglast — DO NOT EDIT: type stubs automatically extracted from %s +# :Author: Lele Gaifax +# :License: GNU General Public License version 3 or later +# :Copyright: © {CYEARS} Lele Gaifax +# + +""" + + +def dotted_name(node): + "Return the dotted name represented by an AST node, or ``None``." + + if isinstance(node, pyast.Name): + return node.id + if isinstance(node, pyast.Attribute): + prefix = dotted_name(node.value) + return None if prefix is None else f'{prefix}.{node.attr}' + return None + + +def node_type_from_decorators(decorators): + "Infer the printed node type from a ``node_printer`` or ``special_function`` decorator." + + for decorator in decorators: + if not isinstance(decorator, pyast.Call): + continue + + decorator_name = dotted_name(decorator.func) + if decorator_name == 'special_function': + return 'ast.FuncCall' + + if decorator_name != 'node_printer' or not decorator.args: + continue + + node_arg = decorator.args[-1] if len(decorator.args) > 1 else decorator.args[0] + node_arg_name = dotted_name(node_arg) + if node_arg_name and node_arg_name.startswith('ast.'): + return node_arg_name + + return None + + +def annotation_for_arg(arg, node_type, default=None): + "Infer an annotation for a printer function argument." + + if arg.arg == 'node' and node_type is not None: + return node_type + if arg.arg == 'node': + return 'ast.Node' + if arg.arg == 'output': + return 'RawStream' + if isinstance(default, pyast.Constant): + if isinstance(default.value, bool): + return 'bool' + if isinstance(default.value, int): + return 'int' + if isinstance(default.value, str): + return 'str' + return 'Any' + + +def return_annotation(function): + "Infer a conservative return annotation for a function body." + + def is_bool_expression(node): + if isinstance(node, pyast.Constant): + return isinstance(node.value, bool) + if isinstance(node, (pyast.BoolOp, pyast.Compare)): + return True + if isinstance(node, pyast.UnaryOp): + return isinstance(node.op, pyast.Not) + if isinstance(node, pyast.Call): + return dotted_name(node.func) in ('bool', 'isinstance') + return False + + def returns_from_body(): + pending = list(function.body) + while pending: + node = pending.pop() + if isinstance(node, pyast.Return): + if node.value is not None: + yield node.value + elif not isinstance( + node, + ( + pyast.FunctionDef, + pyast.AsyncFunctionDef, + pyast.ClassDef, + pyast.Lambda, + ), + ): + pending.extend(pyast.iter_child_nodes(node)) + + returns_with_value = [node for node in returns_from_body()] + if not returns_with_value: + return 'None' + if all(is_bool_expression(value) for value in returns_with_value): + return 'bool' + return 'Any' + + +def emit_function(function, output, node_type=None, method=False): + "Emit a function or method signature." + + args = [] + positional = list(function.args.posonlyargs) + list(function.args.args) + defaults = [None] * (len(positional) - len(function.args.defaults)) + defaults += function.args.defaults + for arg, default in zip(positional, defaults): + if method and arg.arg == 'self': + args.append('self') + continue + annotation = annotation_for_arg(arg, node_type, default) + rendered = f'{arg.arg}: {annotation}' + if default is not None: + rendered += ' = ...' + args.append(rendered) + + if function.args.vararg is not None: + args.append(f'*{function.args.vararg.arg}: Any') + elif function.args.kwonlyargs: + args.append('*') + + for arg, default in zip(function.args.kwonlyargs, function.args.kw_defaults): + rendered = f'{arg.arg}: Any' + if default is not None: + rendered += ' = ...' + args.append(rendered) + + if function.args.kwarg is not None: + args.append(f'**{function.args.kwarg.arg}: Any') + + indent = ' ' if method else '' + output.write( + f'{indent}def {function.name}({", ".join(args)})' + f' -> {return_annotation(function)}: ...\n' + ) + + +def enum_assignment(class_def): + "Return the enum class assigned to an ``IntEnumPrinter`` subclass, if any." + + for item in class_def.body: + if isinstance(item, pyast.Assign): + for target in item.targets: + if isinstance(target, pyast.Name) and target.id == 'enum': + value = dotted_name(item.value) + if value and value.startswith('enums.'): + return value + return None + + +def assignment_type(assign): + "Infer a useful type for a module-level assignment." + + def is_int_expr(node): + if isinstance(node, pyast.Constant): + return type(node.value) is int + if isinstance(node, pyast.BinOp): + return is_int_expr(node.left) and is_int_expr(node.right) + if isinstance(node, pyast.UnaryOp): + return is_int_expr(node.operand) + return False + + if is_int_expr(assign.value): + return 'int' + if isinstance(assign.value, pyast.Constant): + return type(assign.value).__name__ + if isinstance(assign.value, pyast.Call): + name = dotted_name(assign.value.func) + if name and name.split('.')[-1].endswith('Printer'): + return name.split('.')[-1] + return 'Any' + + +def top_level_names(module): + "Collect names needed to decide imports." + + has_classes = any(isinstance(item, pyast.ClassDef) for item in module.body) + uses_enums = False + for item in module.body: + if isinstance(item, pyast.ClassDef) and enum_assignment(item): + uses_enums = True + break + return has_classes, uses_enums + + +def write_stub(source, target): + "Write a printer module stub for ``source``." + + tree = pyast.parse(source.read_text(encoding='utf-8')) + has_classes, uses_enums = top_level_names(tree) + body = StringIO() + + for item in tree.body: + if isinstance(item, pyast.FunctionDef): + if item.name.startswith('_'): + continue + node_type = node_type_from_decorators(item.decorator_list) + emit_function(item, body, node_type) + body.write('\n') + elif isinstance(item, pyast.ClassDef): + if item.name.startswith('_'): + continue + bases = [dotted_name(base) for base in item.bases] + enum = enum_assignment(item) + if 'IntEnumPrinter' in bases and enum is not None: + base = f'IntEnumPrinter[{enum}]' + elif 'IntEnumPrinter' in bases: + base = 'IntEnumPrinter[Any]' + else: + base = 'object' + body.write(f'class {item.name}({base}):\n') + methods = [ + child + for child in item.body + if isinstance(child, pyast.FunctionDef) + and not child.name.startswith('_') + ] + if enum is not None: + body.write(f' enum: ClassVar[type[{enum}]]\n') + if methods: + for method in methods: + emit_function(method, body, 'ast.Node', method=True) + elif enum is None: + body.write(' pass\n') + body.write('\n\n') + elif isinstance(item, pyast.Assign): + for target_node in item.targets: + if isinstance( + target_node, pyast.Name + ) and not target_node.id.startswith('_'): + body.write(f'{target_node.id}: {assignment_type(item)}\n') + body.write('\n') + + body_text = body.getvalue().rstrip() + '\n' + with target.open('w', encoding='utf-8') as output: + output.write(HEADER % source.name) + typing_imports = [] + if 'Any' in body_text: + typing_imports.append('Any') + if 'ClassVar' in body_text: + typing_imports.append('ClassVar') + if typing_imports: + output.write(f'from typing import {", ".join(typing_imports)}\n\n') + output.write('from .. import ast') + if uses_enums: + output.write(', enums') + output.write('\n') + if 'RawStream' in body_text: + output.write('from ..stream import RawStream\n') + if has_classes: + output.write('from . import IntEnumPrinter\n') + output.write('\n') + output.write(body_text) + + +def main(): + from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser + + parser = ArgumentParser( + description='Printer module type stub extractor', + formatter_class=ArgumentDefaultsHelpFormatter, + ) + parser.add_argument('source', type=Path, help="Python source to inspect") + parser.add_argument('output', type=Path, help="Python type stub to create") + + args = parser.parse_args() + write_stub(args.source, args.output) + + +if __name__ == '__main__': + main()