ast

package
v0.0.0-...-be4b795 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package nodes defines PostgreSQL parse tree node types. These types are designed to be 100% compatible with PostgreSQL's internal representation.

Package nodes provides nodeToString functionality for serializing parse tree nodes. This is a Go implementation of PostgreSQL's outfuncs.c.

Index

Constants

View Source
const (
	NoLock                   = 0
	AccessShareLock          = 1
	RowShareLock             = 2
	RowExclusiveLock         = 3
	ShareUpdateExclusiveLock = 4
	ShareLock                = 5
	ShareRowExclusiveLock    = 6
	ExclusiveLock            = 7
	AccessExclusiveLock      = 8
)

Lock mode constants (from PostgreSQL's lockdefs.h)

View Source
const (
	CURSOR_OPT_BINARY       = 0x0001
	CURSOR_OPT_SCROLL       = 0x0002
	CURSOR_OPT_NO_SCROLL    = 0x0004
	CURSOR_OPT_INSENSITIVE  = 0x0008
	CURSOR_OPT_ASENSITIVE   = 0x0010
	CURSOR_OPT_HOLD         = 0x0020
	CURSOR_OPT_FAST_PLAN    = 0x0100
	CURSOR_OPT_GENERIC_PLAN = 0x0200
	CURSOR_OPT_CUSTOM_PLAN  = 0x0400
	CURSOR_OPT_PARALLEL_OK  = 0x0800
)

Cursor option bitmask constants.

View Source
const (
	TRIGGER_TYPE_ROW      = 1 << 0
	TRIGGER_TYPE_BEFORE   = 1 << 1
	TRIGGER_TYPE_INSERT   = 1 << 2
	TRIGGER_TYPE_DELETE   = 1 << 3
	TRIGGER_TYPE_UPDATE   = 1 << 4
	TRIGGER_TYPE_TRUNCATE = 1 << 5
	TRIGGER_TYPE_INSTEAD  = 1 << 6
	TRIGGER_TYPE_AFTER    = 0 // default (not BEFORE, not INSTEAD)
)

Trigger type bitmask constants (from trigger.h).

View Source
const (
	TRIGGER_FIRES_ON_ORIGIN  = 'O'
	TRIGGER_FIRES_ALWAYS     = 'A'
	TRIGGER_FIRES_ON_REPLICA = 'R'
	TRIGGER_DISABLED         = 'D'
)

Trigger fire condition constants (from trigger.h).

View Source
const (
	CAS_NOT_DEFERRABLE      = 1 << 0
	CAS_DEFERRABLE          = 1 << 1
	CAS_INITIALLY_IMMEDIATE = 1 << 2
	CAS_INITIALLY_DEFERRED  = 1 << 3
	CAS_NOT_VALID           = 1 << 4
	CAS_NO_INHERIT          = 1 << 5
)

ConstraintAttributeSpec bit constants (from gram.y).

View Source
const (
	AMTYPE_INDEX = 'i'
	AMTYPE_TABLE = 't'
)

AMTYPE constants for access method types.

View Source
const (
	OPCLASS_ITEM_OPERATOR    = 1
	OPCLASS_ITEM_FUNCTION    = 2
	OPCLASS_ITEM_STORAGETYPE = 3
)

OPCLASS_ITEM_* constants for CreateOpClassItem.

View Source
const (
	FRAMEOPTION_NONDEFAULT                = 0x00001 // any specified?
	FRAMEOPTION_RANGE                     = 0x00002 // RANGE behavior
	FRAMEOPTION_ROWS                      = 0x00004 // ROWS behavior
	FRAMEOPTION_GROUPS                    = 0x00008 // GROUPS behavior
	FRAMEOPTION_BETWEEN                   = 0x00010 // BETWEEN given?
	FRAMEOPTION_START_UNBOUNDED_PRECEDING = 0x00020 // start is U. P.
	FRAMEOPTION_END_UNBOUNDED_PRECEDING   = 0x00040 // (disallowed)
	FRAMEOPTION_START_UNBOUNDED_FOLLOWING = 0x00080 // (disallowed)
	FRAMEOPTION_END_UNBOUNDED_FOLLOWING   = 0x00100 // end is U. F.
	FRAMEOPTION_START_CURRENT_ROW         = 0x00200 // start is C. R.
	FRAMEOPTION_END_CURRENT_ROW           = 0x00400 // end is C. R.
	FRAMEOPTION_START_OFFSET_PRECEDING    = 0x00800 // start is O. P.
	FRAMEOPTION_END_OFFSET_PRECEDING      = 0x01000 // end is O. P.
	FRAMEOPTION_START_OFFSET_FOLLOWING    = 0x02000 // start is O. F.
	FRAMEOPTION_END_OFFSET_FOLLOWING      = 0x04000 // end is O. F.
	FRAMEOPTION_EXCLUDE_CURRENT_ROW       = 0x08000 // omit C.R.
	FRAMEOPTION_EXCLUDE_GROUP             = 0x10000 // omit C.R. & peers
	FRAMEOPTION_EXCLUDE_TIES              = 0x20000 // omit peers only

	FRAMEOPTION_START_OFFSET = FRAMEOPTION_START_OFFSET_PRECEDING | FRAMEOPTION_START_OFFSET_FOLLOWING
	FRAMEOPTION_END_OFFSET   = FRAMEOPTION_END_OFFSET_PRECEDING | FRAMEOPTION_END_OFFSET_FOLLOWING

	FRAMEOPTION_DEFAULTS = FRAMEOPTION_RANGE | FRAMEOPTION_START_UNBOUNDED_PRECEDING | FRAMEOPTION_END_CURRENT_ROW
)

FRAMEOPTION_* constants for WindowDef.FrameOptions (bitmask). These match PostgreSQL's FRAMEOPTION_* defines in parsenodes.h.

View Source
const (
	INTERVAL_MASK_YEAR   = 1 << 2
	INTERVAL_MASK_MONTH  = 1 << 1
	INTERVAL_MASK_DAY    = 1 << 3
	INTERVAL_MASK_HOUR   = 1 << 10
	INTERVAL_MASK_MINUTE = 1 << 11
	INTERVAL_MASK_SECOND = 1 << 12
	INTERVAL_FULL_RANGE  = 0x7FFF
)

Interval field codes (from postgres datetime.h). Used in INTERVAL type modifiers.

View Source
const (
	RELPERSISTENCE_PERMANENT = 'p'
	RELPERSISTENCE_UNLOGGED  = 'u'
	RELPERSISTENCE_TEMP      = 't'
)

RELPERSISTENCE_* constants.

View Source
const (
	XML_STANDALONE_YES      = 0
	XML_STANDALONE_NO       = 1
	XML_STANDALONE_NO_VALUE = 2
	XML_STANDALONE_OMITTED  = 3
)

XML standalone constants

View Source
const (
	CLUOPT_VERBOSE = 1 << 0
)

ClusterOption bitmask values

View Source
const FETCH_ALL int64 = 0x7FFFFFFFFFFFFFFF // LONG_MAX

FETCH_ALL is the special value meaning fetch all rows.

Variables

This section is empty.

Functions

func Inspect

func Inspect(node Node, f func(Node) bool)

Inspect traverses an AST in depth-first order, calling f for each node. If f returns true, Inspect recurses into the node's children.

func NodeTagName

func NodeTagName(tag NodeTag) string

NodeTagName returns the string name of a NodeTag.

func NodeToString

func NodeToString(node Node) string

NodeToString converts a Node to its string representation. This matches PostgreSQL's nodeToString() function format.

func Walk

func Walk(v Visitor, node Node)

Walk traverses an AST in depth-first order. It calls v.Visit(node); if that returns a non-nil visitor w, it walks each child node with w, then calls w.Visit(nil).

Types

type A_ArrayExpr

type A_ArrayExpr struct {
	Elements *List // array element expressions
	Loc      Loc   // token location, or -1 if unknown
}

A_ArrayExpr represents an ARRAY[] construct in raw parse tree.

func (*A_ArrayExpr) Tag

func (n *A_ArrayExpr) Tag() NodeTag

type A_Const

type A_Const struct {
	Isnull bool // if true, value is NULL
	Val    Node // value (Integer, Float, Boolean, String, or BitString node; or NULL if isnull)
	Loc    Loc  // token location, or -1 if unknown
}

A_Const represents a constant value.

func (*A_Const) Tag

func (n *A_Const) Tag() NodeTag

type A_Expr

type A_Expr struct {
	Kind  A_Expr_Kind // see above
	Name  *List       // possibly-qualified name of operator
	Lexpr Node        // left argument, or NULL if none
	Rexpr Node        // right argument, or NULL if none
	Loc   Loc         // token location, or -1 if unknown
}

A_Expr represents an expression with an operator.

func (*A_Expr) Tag

func (n *A_Expr) Tag() NodeTag

type A_Expr_Kind

type A_Expr_Kind int

A_Expr_Kind represents types of A_Expr.

const (
	AEXPR_OP              A_Expr_Kind = iota // normal operator
	AEXPR_OP_ANY                             // scalar op ANY (array)
	AEXPR_OP_ALL                             // scalar op ALL (array)
	AEXPR_DISTINCT                           // IS DISTINCT FROM - name must be "="
	AEXPR_NOT_DISTINCT                       // IS NOT DISTINCT FROM - name must be "="
	AEXPR_NULLIF                             // NULLIF - name must be "="
	AEXPR_IN                                 // [NOT] IN - name must be "=" or "<>"
	AEXPR_LIKE                               // [NOT] LIKE - name must be "~~" or "!~~"
	AEXPR_ILIKE                              // [NOT] ILIKE - name must be "~~*" or "!~~*"
	AEXPR_SIMILAR                            // [NOT] SIMILAR - name must be "~" or "!~"
	AEXPR_BETWEEN                            // name must be "BETWEEN"
	AEXPR_NOT_BETWEEN                        // name must be "NOT BETWEEN"
	AEXPR_BETWEEN_SYM                        // name must be "BETWEEN SYMMETRIC"
	AEXPR_NOT_BETWEEN_SYM                    // name must be "NOT BETWEEN SYMMETRIC"
	AEXPR_OVERLAPS                           // OVERLAPS
)

type A_Indices

type A_Indices struct {
	IsSlice bool // true if slice (i.e., [ : ])
	Lidx    Node // slice lower bound, if any
	Uidx    Node // subscript, or slice upper bound if any
	Loc     Loc  // token location
}

A_Indices represents array subscript or slice.

func (*A_Indices) Tag

func (n *A_Indices) Tag() NodeTag

type A_Indirection

type A_Indirection struct {
	Arg         Node  // the thing being selected from
	Indirection *List // subscripts and/or field names and/or *
	Loc         Loc   // token location
}

A_Indirection represents field selection or array subscripting.

func (*A_Indirection) Tag

func (n *A_Indirection) Tag() NodeTag

type A_Star

type A_Star struct {
	Loc Loc // token location
}

A_Star represents '*' appearing in expression.

func (*A_Star) Tag

func (n *A_Star) Tag() NodeTag

type AccessPriv

type AccessPriv struct {
	PrivName string // privilege name, NULL for ALL PRIVILEGES
	Cols     *List  // list of String
	Loc      Loc    // token location
}

AccessPriv represents a single privilege in GRANT/REVOKE.

func (*AccessPriv) Tag

func (n *AccessPriv) Tag() NodeTag

type Alias

type Alias struct {
	Aliasname string // aliased rel name
	Colnames  *List  // optional list of column aliases
	Loc       Loc    // token location covering the alias text (including column list if present)
}

Alias represents an alias (AS clause).

func (*Alias) Tag

func (n *Alias) Tag() NodeTag

type AlterCollationStmt

type AlterCollationStmt struct {
	Collname *List // qualified name (list of String)
	Loc      Loc   // token location
}

AlterCollationStmt represents ALTER COLLATION ... REFRESH VERSION.

func (*AlterCollationStmt) Tag

func (n *AlterCollationStmt) Tag() NodeTag

type AlterDatabaseRefreshCollStmt

type AlterDatabaseRefreshCollStmt struct {
	Dbname string
	Loc    Loc // token location
}

AlterDatabaseRefreshCollStmt - ALTER DATABASE name REFRESH COLLATION VERSION

func (*AlterDatabaseRefreshCollStmt) Tag

type AlterDatabaseSetStmt

type AlterDatabaseSetStmt struct {
	Dbname  string
	Setstmt *VariableSetStmt
	Loc     Loc // token location
}

AlterDatabaseSetStmt - ALTER DATABASE SET/RESET

func (*AlterDatabaseSetStmt) Tag

func (n *AlterDatabaseSetStmt) Tag() NodeTag

type AlterDatabaseStmt

type AlterDatabaseStmt struct {
	Dbname  string
	Options *List
	Loc     Loc // token location
}

AlterDatabaseStmt - ALTER DATABASE

func (*AlterDatabaseStmt) Tag

func (n *AlterDatabaseStmt) Tag() NodeTag

type AlterDefaultPrivilegesStmt

type AlterDefaultPrivilegesStmt struct {
	Options *List      // list of DefElem
	Action  *GrantStmt // the GRANT/REVOKE action
	Loc     Loc        // token location
}

AlterDefaultPrivilegesStmt represents ALTER DEFAULT PRIVILEGES statement.

func (*AlterDefaultPrivilegesStmt) Tag

type AlterDomainStmt

type AlterDomainStmt struct {
	Subtype   byte         // 'T' = default, 'N' = NOT NULL, 'O' = drop NOT NULL, 'C' = add constraint, 'X' = drop constraint
	Typname   *List        // qualified name
	Name      string       // constraint name, or NULL
	Def       Node         // definition of default or constraint
	Behavior  DropBehavior // cascade behavior
	MissingOk bool         // skip if domain doesn't exist?
	Loc       Loc          // token location
}

AlterDomainStmt represents an ALTER DOMAIN statement.

func (*AlterDomainStmt) Tag

func (n *AlterDomainStmt) Tag() NodeTag

type AlterEnumStmt

type AlterEnumStmt struct {
	Typname            *List  // qualified name (list of String)
	Oldval             string // old enum value name (for RENAME)
	Newval             string // new enum value name
	NewvalNeighbor     string // neighboring enum value for ADD
	NewvalIsAfter      bool   // place new value after neighbor?
	SkipIfNewvalExists bool   // no error if new val exists?
	Loc                Loc    // token location
}

AlterEnumStmt represents an ALTER TYPE ... ENUM statement.

func (*AlterEnumStmt) Tag

func (n *AlterEnumStmt) Tag() NodeTag

type AlterEventTrigStmt

type AlterEventTrigStmt struct {
	Trigname  string // trigger name
	Tgenabled byte   // 'O'=enable, 'D'=disable, 'R'=replica, 'A'=always
	Loc       Loc    // token location
}

AlterEventTrigStmt represents an ALTER EVENT TRIGGER statement.

func (*AlterEventTrigStmt) Tag

func (n *AlterEventTrigStmt) Tag() NodeTag

type AlterExtensionContentsStmt

type AlterExtensionContentsStmt struct {
	Extname string     // name of the extension
	Action  int        // +1 = ADD, -1 = DROP
	Objtype ObjectType // object type
	Object  Node       // qualified name of the object
	Loc     Loc        // token location
}

AlterExtensionContentsStmt represents ALTER EXTENSION ADD/DROP object.

func (*AlterExtensionContentsStmt) Tag

type AlterExtensionStmt

type AlterExtensionStmt struct {
	Extname string // name of the extension to alter
	Options *List  // list of DefElem nodes
	Loc     Loc    // token location
}

AlterExtensionStmt represents an ALTER EXTENSION UPDATE statement.

func (*AlterExtensionStmt) Tag

func (n *AlterExtensionStmt) Tag() NodeTag

type AlterFdwStmt

type AlterFdwStmt struct {
	Fdwname     string // foreign-data wrapper name
	FuncOptions *List  // HANDLER, VALIDATOR, etc.
	Options     *List  // generic options to FDW
	Loc         Loc    // token location
}

AlterFdwStmt represents an ALTER FOREIGN DATA WRAPPER statement.

func (*AlterFdwStmt) Tag

func (n *AlterFdwStmt) Tag() NodeTag

type AlterForeignServerStmt

type AlterForeignServerStmt struct {
	Servername string // server name
	Version    string // optional server version
	Options    *List  // generic options to server
	HasVersion bool   // version was specified
	Loc        Loc    // token location
}

AlterForeignServerStmt represents an ALTER SERVER statement.

func (*AlterForeignServerStmt) Tag

type AlterFunctionStmt

type AlterFunctionStmt struct {
	Objtype ObjectType      // OBJECT_FUNCTION, OBJECT_PROCEDURE, OBJECT_ROUTINE
	Func    *ObjectWithArgs // function with args
	Actions *List           // list of DefElem
	Loc     Loc             // token location
}

AlterFunctionStmt represents an ALTER FUNCTION/PROCEDURE/ROUTINE statement.

func (*AlterFunctionStmt) Tag

func (n *AlterFunctionStmt) Tag() NodeTag

type AlterObjectDependsStmt

type AlterObjectDependsStmt struct {
	ObjectType ObjectType // OBJECT_FUNCTION, etc
	Relation   *RangeVar  // for relation types
	Object     Node       // qualified name of object
	Extname    Node       // extension name (String node)
	Remove     bool       // true if NO DEPENDS
	Loc        Loc        // token location
}

AlterObjectDependsStmt represents ALTER ... DEPENDS ON EXTENSION statement.

func (*AlterObjectDependsStmt) Tag

type AlterObjectSchemaStmt

type AlterObjectSchemaStmt struct {
	ObjectType ObjectType // OBJECT_TABLE, etc
	Relation   *RangeVar  // table, sequence, view, matview, index
	Object     Node       // qualified name of object
	Newschema  string     // new schema name
	MissingOk  bool       // skip error if missing?
	Loc        Loc        // token location
}

AlterObjectSchemaStmt represents ALTER ... SET SCHEMA statement.

func (*AlterObjectSchemaStmt) Tag

func (n *AlterObjectSchemaStmt) Tag() NodeTag

type AlterOpFamilyStmt

type AlterOpFamilyStmt struct {
	Opfamilyname *List  // qualified name
	Amname       string // access method name
	IsDrop       bool   // true for DROP, false for ADD
	Items        *List  // list of CreateOpClassItem
	Loc          Loc    // token location
}

AlterOpFamilyStmt represents ALTER OPERATOR FAMILY statement.

func (*AlterOpFamilyStmt) Tag

func (n *AlterOpFamilyStmt) Tag() NodeTag

type AlterOperatorStmt

type AlterOperatorStmt struct {
	Opername *ObjectWithArgs // operator name and argument types
	Options  *List           // list of DefElem
	Loc      Loc             // token location
}

AlterOperatorStmt represents ALTER OPERATOR ... SET (...) statement.

func (*AlterOperatorStmt) Tag

func (n *AlterOperatorStmt) Tag() NodeTag

type AlterOwnerStmt

type AlterOwnerStmt struct {
	ObjectType ObjectType // OBJECT_TABLE, etc
	Relation   *RangeVar  // for relation types
	Object     Node       // qualified name of object
	Newowner   *RoleSpec  // new owner
	Loc        Loc        // token location
}

AlterOwnerStmt represents ALTER ... OWNER TO statement.

func (*AlterOwnerStmt) Tag

func (n *AlterOwnerStmt) Tag() NodeTag

type AlterPolicyStmt

type AlterPolicyStmt struct {
	PolicyName string    // policy name
	Table      *RangeVar // the table the policy applies to
	Roles      *List     // list of roles (RoleSpec)
	Qual       Node      // USING qualification
	WithCheck  Node      // WITH CHECK qualification
	Loc        Loc       // token location
}

AlterPolicyStmt represents an ALTER POLICY statement.

func (*AlterPolicyStmt) Tag

func (n *AlterPolicyStmt) Tag() NodeTag

type AlterPublicationAction

type AlterPublicationAction int

AlterPublicationAction represents the action for ALTER PUBLICATION.

const (
	AP_AddObjects AlterPublicationAction = iota
	AP_DropObjects
	AP_SetObjects
)

type AlterPublicationStmt

type AlterPublicationStmt struct {
	Pubname      string        // publication name
	Options      *List         // list of DefElem nodes
	Pubobjects   *List         // list of PublicationObjSpec
	ForAllTables bool          // FOR ALL TABLES
	Action       DefElemAction // SET, ADD, DROP
	Loc          Loc           // token location
}

AlterPublicationStmt represents an ALTER PUBLICATION statement.

func (*AlterPublicationStmt) Tag

func (n *AlterPublicationStmt) Tag() NodeTag

type AlterRoleSetStmt

type AlterRoleSetStmt struct {
	Role     *RoleSpec        // role, or NULL for ALL
	Database string           // database name, or empty
	Setstmt  *VariableSetStmt // SET/RESET statement
	Loc      Loc              // token location
}

AlterRoleSetStmt represents ALTER ROLE SET/RESET statements.

func (*AlterRoleSetStmt) Tag

func (n *AlterRoleSetStmt) Tag() NodeTag

type AlterRoleStmt

type AlterRoleStmt struct {
	Role    *RoleSpec // role specification
	Options *List     // list of DefElem
	Action  int       // +1 = add, -1 = drop
	Loc     Loc       // token location
}

AlterRoleStmt represents ALTER ROLE/USER/GROUP statements.

func (*AlterRoleStmt) Tag

func (n *AlterRoleStmt) Tag() NodeTag

type AlterSeqStmt

type AlterSeqStmt struct {
	Sequence    *RangeVar // sequence to alter
	Options     *List     // list of DefElem
	ForIdentity bool      // for GENERATED ... AS IDENTITY
	MissingOk   bool      // skip if sequence doesn't exist?
	Loc         Loc       // token location
}

AlterSeqStmt represents an ALTER SEQUENCE statement.

func (*AlterSeqStmt) Tag

func (n *AlterSeqStmt) Tag() NodeTag

type AlterStatsStmt

type AlterStatsStmt struct {
	Defnames      *List // qualified name
	MissingOk     bool  // IF EXISTS
	Stxstattarget int   // new statistics target
	Loc           Loc   // token location
}

AlterStatsStmt represents ALTER STATISTICS statement.

func (*AlterStatsStmt) Tag

func (n *AlterStatsStmt) Tag() NodeTag

type AlterSubscriptionStmt

type AlterSubscriptionStmt struct {
	Kind        AlterSubscriptionType // kind of alter
	Subname     string                // subscription name
	Conninfo    string                // connection string
	Publication *List                 // list of publication names
	Options     *List                 // list of DefElem
	Loc         Loc                   // token location
}

AlterSubscriptionStmt represents an ALTER SUBSCRIPTION statement.

func (*AlterSubscriptionStmt) Tag

func (n *AlterSubscriptionStmt) Tag() NodeTag

type AlterSubscriptionType

type AlterSubscriptionType int

AlterSubscriptionType represents the kind of ALTER SUBSCRIPTION.

const (
	ALTER_SUBSCRIPTION_OPTIONS AlterSubscriptionType = iota
	ALTER_SUBSCRIPTION_CONNECTION
	ALTER_SUBSCRIPTION_SET_PUBLICATION
	ALTER_SUBSCRIPTION_ADD_PUBLICATION
	ALTER_SUBSCRIPTION_DROP_PUBLICATION
	ALTER_SUBSCRIPTION_REFRESH
	ALTER_SUBSCRIPTION_ENABLED
	ALTER_SUBSCRIPTION_SKIP
)

type AlterSystemStmt

type AlterSystemStmt struct {
	Setstmt *VariableSetStmt
	Loc     Loc // token location
}

AlterSystemStmt - ALTER SYSTEM SET/RESET

func (*AlterSystemStmt) Tag

func (n *AlterSystemStmt) Tag() NodeTag

type AlterTSConfigType

type AlterTSConfigType int

AlterTSConfigType represents ALTER TEXT SEARCH CONFIGURATION kinds.

const (
	ALTER_TSCONFIG_ADD_MAPPING AlterTSConfigType = iota
	ALTER_TSCONFIG_ALTER_MAPPING_FOR_TOKEN
	ALTER_TSCONFIG_REPLACE_DICT
	ALTER_TSCONFIG_REPLACE_DICT_FOR_TOKEN
	ALTER_TSCONFIG_DROP_MAPPING
)

type AlterTSConfigurationStmt

type AlterTSConfigurationStmt struct {
	Kind      AlterTSConfigType // ADD/ALTER/DROP MAPPING etc
	Cfgname   *List             // qualified config name
	Tokentype *List             // list of token type names
	Dicts     *List             // list of dictionary names
	Override  bool              // if ALTER MAPPING
	Replace   bool              // if replacing dicts
	MissingOk bool              // for IF EXISTS
	Loc       Loc               // token location
}

AlterTSConfigurationStmt represents ALTER TEXT SEARCH CONFIGURATION statement.

func (*AlterTSConfigurationStmt) Tag

type AlterTSDictionaryStmt

type AlterTSDictionaryStmt struct {
	Dictname *List // qualified name
	Options  *List // definition list
	Loc      Loc   // token location
}

AlterTSDictionaryStmt represents ALTER TEXT SEARCH DICTIONARY statement.

func (*AlterTSDictionaryStmt) Tag

func (n *AlterTSDictionaryStmt) Tag() NodeTag

type AlterTableCmd

type AlterTableCmd struct {
	Subtype    int    // Type of table alteration to apply
	Name       string // column, constraint, or trigger to act on
	Num        int16  // attribute number for columns referenced by number
	Newowner   *RoleSpec
	Def        Node // definition of new column, index, constraint, etc.
	Behavior   int  // RESTRICT or CASCADE for DROP cases
	Missing_ok bool
	Loc        Loc // token location
}

AlterTableCmd represents a subcommand of ALTER TABLE.

func (*AlterTableCmd) Tag

func (n *AlterTableCmd) Tag() NodeTag

type AlterTableMoveAllStmt

type AlterTableMoveAllStmt struct {
	OrigTablespacename string // source tablespace
	ObjType            int    // Object type to move
	Roles              *List  // List of roles to move objects of
	NewTablespacename  string // target tablespace
	Nowait             bool
	Loc                Loc // token location
}

AlterTableMoveAllStmt represents ALTER TABLE/INDEX/MATERIALIZED VIEW ALL IN TABLESPACE.

func (*AlterTableMoveAllStmt) Tag

func (n *AlterTableMoveAllStmt) Tag() NodeTag

type AlterTableSpaceOptionsStmt

type AlterTableSpaceOptionsStmt struct {
	Tablespacename string // name of the tablespace
	Options        *List  // list of DefElem
	IsReset        bool   // true for RESET, false for SET
	Loc            Loc    // token location
}

AlterTableSpaceOptionsStmt represents ALTER TABLESPACE SET/RESET statement.

func (*AlterTableSpaceOptionsStmt) Tag

type AlterTableStmt

type AlterTableStmt struct {
	Relation   *RangeVar // table to work on
	Cmds       *List     // list of subcommands (AlterTableCmd)
	ObjType    int       // type of object (ObjectType)
	Missing_ok bool      // skip error if table missing
	Loc        Loc       // token location
}

AlterTableStmt represents an ALTER TABLE statement.

func (*AlterTableStmt) Tag

func (n *AlterTableStmt) Tag() NodeTag

type AlterTableType

type AlterTableType int

AlterTableType represents ALTER TABLE command types.

const (
	AT_AddColumn AlterTableType = iota
	AT_AddColumnToView
	AT_ColumnDefault
	AT_CookedColumnDefault
	AT_DropNotNull
	AT_SetNotNull
	AT_SetExpression
	AT_DropExpression
	AT_CheckNotNull
	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
)

type AlterTypeStmt

type AlterTypeStmt struct {
	TypeName *List // qualified name (list of String)
	Options  *List // list of DefElem
	Loc      Loc   // token location
}

AlterTypeStmt represents ALTER TYPE ... SET (...) statement.

func (*AlterTypeStmt) Tag

func (n *AlterTypeStmt) Tag() NodeTag

type AlterUserMappingStmt

type AlterUserMappingStmt struct {
	User       *RoleSpec // user role
	Servername string    // server name
	Options    *List     // generic options to user mapping
	Loc        Loc       // token location
}

AlterUserMappingStmt represents an ALTER USER MAPPING statement.

func (*AlterUserMappingStmt) Tag

func (n *AlterUserMappingStmt) Tag() NodeTag

type ArrayExpr

type ArrayExpr struct {
	ArrayTypeid   Oid   // type of expression result
	ArrayCollid   Oid   // OID of collation, or InvalidOid if none
	ElementTypeid Oid   // common type of array elements
	Elements      *List // list of Array elements
	Multidims     bool  // true if elements are sub-arrays
	Loc           Loc   // token location, or -1 if unknown
}

ArrayExpr represents an ARRAY[] construct.

func (*ArrayExpr) Tag

func (n *ArrayExpr) Tag() NodeTag

type BitString

type BitString struct {
	Bsval string
}

BitString represents a PostgreSQL bit string value node.

func (*BitString) Tag

func (b *BitString) Tag() NodeTag

type BoolExpr

type BoolExpr struct {
	Boolop BoolExprType // AND/OR/NOT
	Args   *List        // arguments to this expression
	Loc    Loc          // token location, or -1 if unknown
}

BoolExpr represents AND/OR/NOT expression.

func (*BoolExpr) Tag

func (n *BoolExpr) Tag() NodeTag

type BoolExprType

type BoolExprType int

BoolExprType represents types of boolean expressions.

const (
	AND_EXPR BoolExprType = iota
	OR_EXPR
	NOT_EXPR
)

type BoolTestType

type BoolTestType int

BoolTestType represents boolean test types.

const (
	IS_TRUE BoolTestType = iota
	IS_NOT_TRUE
	IS_FALSE
	IS_NOT_FALSE
	IS_UNKNOWN
	IS_NOT_UNKNOWN
)

type Boolean

type Boolean struct {
	Boolval bool
}

Boolean represents a PostgreSQL Boolean value node.

func (*Boolean) Tag

func (b *Boolean) Tag() NodeTag

type BooleanTest

type BooleanTest struct {
	Arg          Node         // input expression
	Booltesttype BoolTestType // test type
	Loc          Loc          // token location, or -1 if unknown
}

BooleanTest represents IS [NOT] TRUE/FALSE/UNKNOWN test.

func (*BooleanTest) Tag

func (n *BooleanTest) Tag() NodeTag

type CTECycleClause

type CTECycleClause struct {
	CycleColList       *List  // list of column names to check for cycles
	CycleMarkColumn    string // name of the cycle mark column
	CycleMarkValue     Node   // value for cycle mark (default TRUE)
	CycleMarkDefault   Node   // default for cycle mark (default FALSE)
	CyclePathColumn    string // name of the cycle path column
	CycleMarkType      Oid    // type of the cycle mark column
	CycleMarkTypmod    int32
	CycleMarkCollation Oid
	CycleMarkNeop      Oid
	Loc                Loc
}

CTECycleClause represents the CYCLE clause in a recursive CTE.

func (*CTECycleClause) Tag

func (n *CTECycleClause) Tag() NodeTag

type CTEMaterialize

type CTEMaterialize int

CTEMaterialize represents CTE materialization options.

const (
	CTEMaterializeDefault CTEMaterialize = iota
	CTEMaterializeAlways
	CTEMaterializeNever
)

type CTESearchClause

type CTESearchClause struct {
	SearchColList      *List  // list of column names to search by
	SearchBreadthFirst bool   // true = BREADTH FIRST, false = DEPTH FIRST
	SearchSeqColumn    string // name of the output ordering column
	Loc                Loc
}

CTESearchClause represents the SEARCH clause in a recursive CTE.

func (*CTESearchClause) Tag

func (n *CTESearchClause) Tag() NodeTag

type CallStmt

type CallStmt struct {
	Funccall *FuncCall // the function call
	Loc      Loc       // token location
}

CallStmt represents a CALL statement.

func (*CallStmt) Tag

func (n *CallStmt) Tag() NodeTag

type CaseExpr

type CaseExpr struct {
	Casetype   Oid   // type of expression result
	Casecollid Oid   // OID of collation, or InvalidOid if none
	Arg        Node  // implicit equality comparison argument
	Args       *List // the arguments (list of CaseWhen)
	Defresult  Node  // the default result (ELSE clause)
	Loc        Loc   // token location, or -1 if unknown
}

CaseExpr represents a CASE expression.

func (*CaseExpr) Tag

func (n *CaseExpr) Tag() NodeTag

type CaseWhen

type CaseWhen struct {
	Expr   Node // condition expression
	Result Node // substitution result
	Loc    Loc  // token location, or -1 if unknown
}

CaseWhen represents a WHEN clause in a CASE expression.

func (*CaseWhen) Tag

func (n *CaseWhen) Tag() NodeTag

type CheckPointStmt

type CheckPointStmt struct {
	Loc Loc // token location
}

CheckPointStmt - CHECKPOINT

func (*CheckPointStmt) Tag

func (n *CheckPointStmt) Tag() NodeTag

type ClosePortalStmt

type ClosePortalStmt struct {
	Portalname string // empty string means CLOSE ALL
	Loc        Loc    // token location
}

ClosePortalStmt - CLOSE cursor

func (*ClosePortalStmt) Tag

func (n *ClosePortalStmt) Tag() NodeTag

type ClusterStmt

type ClusterStmt struct {
	Relation  *RangeVar // table to cluster
	Indexname string    // name of index to use, or NULL
	Params    *List     // list of DefElem nodes (PG17+)
	Loc       Loc       // token location
}

ClusterStmt represents a CLUSTER statement.

func (*ClusterStmt) Tag

func (n *ClusterStmt) Tag() NodeTag

type CmdType

type CmdType int

CmdType represents the type of a query command.

const (
	CMD_UNKNOWN CmdType = iota
	CMD_SELECT          // select stmt
	CMD_UPDATE          // update stmt
	CMD_INSERT          // insert stmt
	CMD_DELETE          // delete stmt
	CMD_MERGE           // merge stmt
	CMD_UTILITY         // cmds like create, destroy, copy, vacuum, etc.
	CMD_NOTHING         // dummy command for instead nothing rules with qual
)

type CoalesceExpr

type CoalesceExpr struct {
	Coalescetype   Oid   // type of expression result
	Coalescecollid Oid   // OID of collation, or InvalidOid if none
	Args           *List // the arguments
	Loc            Loc   // token location, or -1 if unknown
}

CoalesceExpr represents a COALESCE expression.

func (*CoalesceExpr) Tag

func (n *CoalesceExpr) Tag() NodeTag

type CoercionContext

type CoercionContext int

CoercionContext represents cast context.

const (
	COERCION_IMPLICIT   CoercionContext = iota // coercion in context of expression
	COERCION_ASSIGNMENT                        // coercion in context of assignment
	COERCION_PLPGSQL                           // explicit coercion in PL/pgSQL
	COERCION_EXPLICIT                          // explicit cast operation
)

type CoercionForm

type CoercionForm int

CoercionForm represents how to display a node.

const (
	COERCE_EXPLICIT_CALL CoercionForm = iota // display as a function call
	COERCE_EXPLICIT_CAST                     // display as an explicit cast
	COERCE_IMPLICIT_CAST                     // implicit cast, so hide it
	COERCE_SQL_SYNTAX                        // TREAT/XMLROOT/etc SQL syntax
)

type CollateClause

type CollateClause struct {
	Arg      Node  // input expression
	Collname *List // possibly-qualified collation name
	Loc      Loc   // token location, or -1 if unknown
}

CollateClause represents COLLATE clause.

func (*CollateClause) Tag

func (n *CollateClause) Tag() NodeTag

type ColumnDef

type ColumnDef struct {
	Colname          string         // name of column
	TypeName         *TypeName      // type of column
	Compression      string         // compression method for column
	Inhcount         int            // number of times column is inherited
	IsLocal          bool           // column has local (non-inherited) def'n
	IsNotNull        bool           // NOT NULL constraint
	IsFromType       bool           // column definition came from table type
	Storage          byte           // attstorage setting, or 0 for default
	StorageName      string         // storage directive name or NULL
	RawDefault       Node           // default value (untransformed parse tree)
	CookedDefault    Node           // default value (transformed expr tree)
	Identity         byte           // attidentity setting
	IdentitySequence *RangeVar      // to store identity sequence name
	Generated        byte           // attgenerated setting
	CollClause       *CollateClause // column collation clause
	CollOid          Oid            // collation OID
	Constraints      *List          // other constraints on column
	Fdwoptions       *List          // per-column FDW options
	Loc              Loc            // parse location, or -1 if none/unknown
}

ColumnDef represents a column definition in CREATE TABLE.

func (*ColumnDef) Tag

func (n *ColumnDef) Tag() NodeTag

type ColumnRef

type ColumnRef struct {
	Fields *List // field names (String nodes) or A_Star
	Loc    Loc   // token location, or -1 if unknown
}

ColumnRef represents a column reference (foo.bar.baz).

func (*ColumnRef) Tag

func (n *ColumnRef) Tag() NodeTag

type CommentStmt

type CommentStmt struct {
	Objtype ObjectType // object kind
	Object  Node       // qualified name of object
	Comment string     // comment to insert, or NULL to drop
	Loc     Loc        // token location
}

CommentStmt represents a COMMENT statement.

func (*CommentStmt) Tag

func (n *CommentStmt) Tag() NodeTag

type CommonTableExpr

type CommonTableExpr struct {
	Ctename          string // CTE name
	Aliascolnames    *List  // optional column name list
	Ctematerialized  int    // CTEMaterialize enum
	Ctequery         Node   // the CTE's subquery
	SearchClause     Node   // SEARCH clause
	CycleClause      Node   // CYCLE clause
	Loc              Loc    // token location, or -1 if unknown
	Cterecursive     bool   // is this CTE actually recursive?
	Cterefcount      int    // number of RTEs referencing this CTE
	Ctecolnames      *List  // list of output column names
	Ctecoltypes      *List  // OID list of output column type OIDs
	Ctecoltypmods    *List  // integer list of output column typmods
	Ctecolcollations *List  // OID list of column collation OIDs
}

CommonTableExpr represents a single CTE in a WITH clause.

func (*CommonTableExpr) Tag

func (n *CommonTableExpr) Tag() NodeTag

type CompositeTypeStmt

type CompositeTypeStmt struct {
	Typevar    *RangeVar // type name as RangeVar
	Coldeflist *List     // list of ColumnDef
	Loc        Loc       // token location
}

CompositeTypeStmt represents CREATE TYPE name AS (column_list).

func (*CompositeTypeStmt) Tag

func (n *CompositeTypeStmt) Tag() NodeTag

type ConstrType

type ConstrType int

ConstrType represents constraint types.

const (
	CONSTR_NULL ConstrType = iota
	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
)

type Constraint

type Constraint struct {
	Contype            ConstrType // constraint type (see above)
	Conname            string     // constraint name, or NULL if unnamed
	Deferrable         bool       // DEFERRABLE?
	Initdeferred       bool       // INITIALLY DEFERRED?
	Loc                Loc        // token location, or -1 if unknown
	IsNoInherit        bool       // NO INHERIT?
	RawExpr            Node       // CHECK expression (raw parse tree)
	CookedExpr         string     // CHECK expression (cooked)
	GeneratedWhen      byte       // ALWAYS or BY DEFAULT
	NullsNotDistinct   bool       // UNIQUE nulls distinct?
	Keys               *List      // PRIMARY KEY/UNIQUE column names
	Including          *List      // PRIMARY KEY/UNIQUE INCLUDE column names
	Exclusions         *List      // exclusion constraint
	Options            *List      // WITH clause options
	Indexname          string     // existing index to use; else NULL
	Indexspace         string     // index tablespace; NULL for default
	ResetDefaultTblspc bool       // reset default_tablespace prior to creating the index
	AccessMethod       string     // index access method; NULL for default
	WhereClause        Node       // WHERE for partial index
	Pktable            *RangeVar  // the table the constraint references
	FkAttrs            *List      // FOREIGN KEY column names
	PkAttrs            *List      // PRIMARY KEY column names
	FkMatchtype        byte       // FULL, PARTIAL, SIMPLE
	FkUpdaction        byte       // ON UPDATE action
	FkDelaction        byte       // ON DELETE action
	FkDelsetcols       *List      // ON DELETE SET column names
	OldConpfeqop       *List      // pg_constraint.conpfeqop of old constraint
	OldPktableOid      Oid        // pg_constraint.confrelid of old constraint
	SkipValidation     bool       // skip validation of existing rows?
	InitiallyValid     bool       // mark the new constraint as valid?
}

Constraint represents a constraint definition in CREATE TABLE.

func (*Constraint) Tag

func (n *Constraint) Tag() NodeTag

type ConstraintsSetStmt

type ConstraintsSetStmt struct {
	Constraints *List
	Deferred    bool
	Loc         Loc // token location
}

ConstraintsSetStmt - SET CONSTRAINTS

func (*ConstraintsSetStmt) Tag

func (n *ConstraintsSetStmt) Tag() NodeTag

type CopyStmt

type CopyStmt struct {
	Relation    *RangeVar // relation to copy to/from
	Query       Node      // the query (SELECT or DML statement)
	Attlist     *List     // list of column names, or NIL for all
	IsFrom      bool      // TO or FROM
	IsProgram   bool      // is 'filename' a program?
	Filename    string    // filename, or NULL for stdin/stdout
	Options     *List     // list of DefElem
	WhereClause Node      // WHERE condition (COPY FROM only)
	Loc         Loc       // token location
}

CopyStmt represents a COPY statement.

func (*CopyStmt) Tag

func (n *CopyStmt) Tag() NodeTag

type CreateAmStmt

type CreateAmStmt struct {
	Amname      string // access method name
	HandlerName *List  // handler function name
	Amtype      byte   // 'i' for INDEX, 't' for TABLE
	Loc         Loc    // token location
}

CreateAmStmt represents a CREATE ACCESS METHOD statement.

func (*CreateAmStmt) Tag

func (n *CreateAmStmt) Tag() NodeTag

type CreateCastStmt

type CreateCastStmt struct {
	Sourcetype *TypeName       // source type
	Targettype *TypeName       // target type
	Func       *ObjectWithArgs // cast function, or NULL
	Context    CoercionContext // cast context
	Inout      bool            // WITH INOUT
	Loc        Loc             // token location
}

CreateCastStmt represents CREATE CAST statement.

func (*CreateCastStmt) Tag

func (n *CreateCastStmt) Tag() NodeTag

type CreateConversionStmt

type CreateConversionStmt struct {
	ConversionName  *List  // conversion name
	ForEncodingName string // source encoding
	ToEncodingName  string // target encoding
	FuncName        *List  // function name
	Def             bool   // DEFAULT?
	Loc             Loc    // token location
}

CreateConversionStmt represents CREATE CONVERSION statement.

func (*CreateConversionStmt) Tag

func (n *CreateConversionStmt) Tag() NodeTag

type CreateDomainStmt

type CreateDomainStmt struct {
	Domainname  *List          // qualified name
	Typname     *TypeName      // base type
	CollClause  *CollateClause // collation clause
	Constraints *List          // list of Constraint nodes

	Loc Loc // source location range
}

CreateDomainStmt represents a CREATE DOMAIN statement.

func (*CreateDomainStmt) Tag

func (n *CreateDomainStmt) Tag() NodeTag

type CreateEnumStmt

type CreateEnumStmt struct {
	TypeName *List // qualified name (list of String)
	Vals     *List // enum values (list of String)
	Loc      Loc   // token location
}

CreateEnumStmt represents a CREATE TYPE ... AS ENUM statement.

func (*CreateEnumStmt) Tag

func (n *CreateEnumStmt) Tag() NodeTag

type CreateEventTrigStmt

type CreateEventTrigStmt struct {
	Trigname   string // trigger name
	Eventname  string // event name (e.g., ddl_command_start)
	Whenclause *List  // list of DefElem (tag filters)
	Funcname   *List  // qualified function name
	Loc        Loc    // token location
}

CreateEventTrigStmt represents a CREATE EVENT TRIGGER statement.

func (*CreateEventTrigStmt) Tag

func (n *CreateEventTrigStmt) Tag() NodeTag

type CreateExtensionStmt

type CreateExtensionStmt struct {
	Extname     string // name of the extension to create
	IfNotExists bool   // just do nothing if it already exists?
	Options     *List  // list of DefElem nodes
	Loc         Loc    // token location
}

CreateExtensionStmt represents a CREATE EXTENSION statement.

func (*CreateExtensionStmt) Tag

func (n *CreateExtensionStmt) Tag() NodeTag

type CreateFdwStmt

type CreateFdwStmt struct {
	Fdwname     string // foreign-data wrapper name
	FuncOptions *List  // HANDLER, VALIDATOR, etc.
	Options     *List  // generic options to FDW
	Loc         Loc    // token location
}

CreateFdwStmt represents a CREATE FOREIGN DATA WRAPPER statement.

func (*CreateFdwStmt) Tag

func (n *CreateFdwStmt) Tag() NodeTag

type CreateForeignServerStmt

type CreateForeignServerStmt struct {
	Servername  string // server name
	Servertype  string // optional server type
	Version     string // optional server version
	Fdwname     string // FDW name
	IfNotExists bool   // just do nothing if it already exists?
	Options     *List  // generic options to server
	Loc         Loc    // token location
}

CreateForeignServerStmt represents a CREATE SERVER statement.

func (*CreateForeignServerStmt) Tag

type CreateForeignTableStmt

type CreateForeignTableStmt struct {
	Base       CreateStmt // base CREATE TABLE fields
	Servername string     // server name
	Options    *List      // generic options to foreign table
	Loc        Loc        // token location
}

CreateForeignTableStmt represents a CREATE FOREIGN TABLE statement.

func (*CreateForeignTableStmt) Tag

type CreateFunctionStmt

type CreateFunctionStmt struct {
	IsOrReplace bool      // T = replace if already exists
	Funcname    *List     // qualified name of function to create
	Parameters  *List     // list of FunctionParameter
	ReturnType  *TypeName // return type (NULL if void)
	Options     *List     // list of DefElem
	SqlBody     Node      // SQL body, or NULL

	Loc Loc // source location range
}

CreateFunctionStmt represents a CREATE FUNCTION statement.

func (*CreateFunctionStmt) Tag

func (n *CreateFunctionStmt) Tag() NodeTag

type CreateOpClassItem

type CreateOpClassItem struct {
	Itemtype    int             // see OPCLASS_ITEM_* constants
	Name        *ObjectWithArgs // operator or function
	Number      int             // strategy number or support proc number
	OrderFamily *List           // opfamily for ordering
	ClassArgs   *List           // type arguments
	Storedtype  *TypeName       // storage type
	Loc         Loc             // token location
}

CreateOpClassItem represents an item in CREATE OPERATOR CLASS.

func (*CreateOpClassItem) Tag

func (n *CreateOpClassItem) Tag() NodeTag

type CreateOpClassStmt

type CreateOpClassStmt struct {
	Opclassname  *List     // qualified name
	Opfamilyname *List     // qualified opfamily name, or NIL
	Amname       string    // access method name
	Datatype     *TypeName // datatype of indexed column
	Items        *List     // list of CreateOpClassItem
	IsDefault    bool      // DEFAULT
	Loc          Loc       // token location
}

CreateOpClassStmt represents CREATE OPERATOR CLASS statement.

func (*CreateOpClassStmt) Tag

func (n *CreateOpClassStmt) Tag() NodeTag

type CreateOpFamilyStmt

type CreateOpFamilyStmt struct {
	Opfamilyname *List  // qualified name
	Amname       string // access method name
	Loc          Loc    // token location
}

CreateOpFamilyStmt represents CREATE OPERATOR FAMILY statement.

func (*CreateOpFamilyStmt) Tag

func (n *CreateOpFamilyStmt) Tag() NodeTag

type CreatePLangStmt

type CreatePLangStmt struct {
	Replace     bool   // OR REPLACE
	Plname      string // PL name
	Plhandler   *List  // PL call handler function (qual. name)
	Plinline    *List  // optional inline handler function (qual. name)
	Plvalidator *List  // optional validator function (qual. name)
	Pltrusted   bool   // PL is trusted
	Loc         Loc    // token location
}

CreatePLangStmt represents a CREATE LANGUAGE statement.

func (*CreatePLangStmt) Tag

func (n *CreatePLangStmt) Tag() NodeTag

type CreatePolicyStmt

type CreatePolicyStmt struct {
	PolicyName string    // policy name
	Table      *RangeVar // the table the policy applies to
	CmdName    string    // the command name (all, select, insert, update, delete)
	Permissive bool      // restrictive or permissive policy
	Roles      *List     // list of roles (RoleSpec)
	Qual       Node      // USING qualification
	WithCheck  Node      // WITH CHECK qualification
	Loc        Loc       // token location
}

CreatePolicyStmt represents a CREATE POLICY statement.

func (*CreatePolicyStmt) Tag

func (n *CreatePolicyStmt) Tag() NodeTag

type CreatePublicationStmt

type CreatePublicationStmt struct {
	Pubname      string // publication name
	Options      *List  // list of DefElem nodes
	Pubobjects   *List  // list of PublicationObjSpec
	ForAllTables bool   // FOR ALL TABLES
	Loc          Loc    // token location
}

CreatePublicationStmt represents a CREATE PUBLICATION statement.

func (*CreatePublicationStmt) Tag

func (n *CreatePublicationStmt) Tag() NodeTag

type CreateRangeStmt

type CreateRangeStmt struct {
	TypeName *List // qualified name (list of String)
	Params   *List // list of DefElem
	Loc      Loc   // token location
}

CreateRangeStmt represents CREATE TYPE name AS RANGE (params).

func (*CreateRangeStmt) Tag

func (n *CreateRangeStmt) Tag() NodeTag

type CreateRoleStmt

type CreateRoleStmt struct {
	StmtType RoleStmtType // ROLESTMT_ROLE, ROLESTMT_USER, ROLESTMT_GROUP
	Role     string       // role name
	Options  *List        // list of DefElem
	Loc      Loc          // token location
}

CreateRoleStmt represents CREATE ROLE/USER/GROUP statements.

func (*CreateRoleStmt) Tag

func (n *CreateRoleStmt) Tag() NodeTag

type CreateSchemaStmt

type CreateSchemaStmt struct {
	Schemaname  string    // the name of the schema to create
	Authrole    *RoleSpec // the owner of the created schema
	SchemaElts  *List     // schema components (list of parsetrees)
	IfNotExists bool      // just do nothing if schema already exists?
	Loc         Loc       // token location
}

CreateSchemaStmt represents a CREATE SCHEMA statement.

func (*CreateSchemaStmt) Tag

func (n *CreateSchemaStmt) Tag() NodeTag

type CreateSeqStmt

type CreateSeqStmt struct {
	Sequence    *RangeVar // sequence to create
	Options     *List     // list of DefElem
	OwnerId     Oid       // owner's OID (if specified)
	ForIdentity bool      // for GENERATED ... AS IDENTITY
	IfNotExists bool      // just do nothing if it already exists?

	Loc Loc // source location range
}

CreateSeqStmt represents a CREATE SEQUENCE statement.

func (*CreateSeqStmt) Tag

func (n *CreateSeqStmt) Tag() NodeTag

type CreateStatsStmt

type CreateStatsStmt struct {
	Defnames    *List  // qualified name
	StatTypes   *List  // stat types (list of String)
	Exprs       *List  // expressions (list of StatsElem)
	Relations   *List  // FROM clause (list of RangeVar)
	Stxcomment  string // comment
	IfNotExists bool   // IF NOT EXISTS
	Loc         Loc    // token location
}

CreateStatsStmt represents CREATE STATISTICS statement.

func (*CreateStatsStmt) Tag

func (n *CreateStatsStmt) Tag() NodeTag

type CreateStmt

type CreateStmt struct {
	Relation       *RangeVar      // relation to create
	TableElts      *List          // column definitions (ColumnDef)
	InhRelations   *List          // relations to inherit from (RangeVar)
	Partbound      Node           // FOR VALUES clause
	Partspec       *PartitionSpec // PARTITION BY clause
	OfTypename     *TypeName      // OF typename
	Constraints    *List          // constraints (Constraint)
	Options        *List          // options from WITH clause
	OnCommit       OnCommitAction // what to do at commit time
	Tablespacename string         // table space to use, or NULL
	AccessMethod   string         // table access method
	IfNotExists    bool           // just do nothing if it already exists?
	Loc            Loc            // token location
}

CreateStmt represents a CREATE TABLE statement.

func (*CreateStmt) Tag

func (n *CreateStmt) Tag() NodeTag

type CreateSubscriptionStmt

type CreateSubscriptionStmt struct {
	Subname     string // subscription name
	Conninfo    string // connection string
	Publication *List  // list of publication names (String nodes)
	Options     *List  // list of DefElem
	Loc         Loc    // token location
}

CreateSubscriptionStmt represents a CREATE SUBSCRIPTION statement.

func (*CreateSubscriptionStmt) Tag

type CreateTableAsStmt

type CreateTableAsStmt struct {
	Query        Node        // the query
	Into         *IntoClause // destination table
	Objtype      ObjectType  // OBJECT_TABLE or OBJECT_MATVIEW
	IsSelectInto bool        // was SELECT INTO
	IfNotExists  bool        // just do nothing if table exists?
	Loc          Loc         // token location
}

CreateTableAsStmt represents a CREATE TABLE AS statement.

func (*CreateTableAsStmt) Tag

func (n *CreateTableAsStmt) Tag() NodeTag

type CreateTableSpaceStmt

type CreateTableSpaceStmt struct {
	Tablespacename string    // name of the tablespace to create
	Owner          *RoleSpec // owner of the tablespace
	Location       string    // directory path for tablespace
	Options        *List     // WITH clause options
	Loc            Loc       // token location
}

CreateTableSpaceStmt represents a CREATE TABLESPACE statement.

func (*CreateTableSpaceStmt) Tag

func (n *CreateTableSpaceStmt) Tag() NodeTag

type CreateTransformStmt

type CreateTransformStmt struct {
	Replace  bool            // OR REPLACE
	TypeName *TypeName       // target type
	Lang     string          // language name
	Fromsql  *ObjectWithArgs // FROM SQL function
	Tosql    *ObjectWithArgs // TO SQL function
	Loc      Loc             // token location
}

CreateTransformStmt represents CREATE TRANSFORM statement.

func (*CreateTransformStmt) Tag

func (n *CreateTransformStmt) Tag() NodeTag

type CreateTrigStmt

type CreateTrigStmt struct {
	Replace        bool      // replace trigger if already exists?
	IsConstraint   bool      // is this a constraint trigger?
	Trigname       string    // trigger name
	Relation       *RangeVar // relation trigger is on
	Funcname       *List     // function to call
	Args           *List     // arguments to the trigger function
	Row            bool      // ROW or STATEMENT trigger
	Timing         int16     // BEFORE, AFTER, or INSTEAD
	Events         int16     // INSERT, UPDATE, DELETE, TRUNCATE
	Columns        *List     // column names, or NIL for all columns
	WhenClause     Node      // WHEN clause
	TransitionRels *List     // list of TransitionTableSpec
	Deferrable     bool      // constraint trigger is deferrable?
	Initdeferred   bool      // constraint trigger is initially deferred?
	Constrrel      *RangeVar // constraint's referenced rel, for FK
	Loc            Loc       // token location
}

CreateTrigStmt represents a CREATE TRIGGER statement.

func (*CreateTrigStmt) Tag

func (n *CreateTrigStmt) Tag() NodeTag

type CreateUserMappingStmt

type CreateUserMappingStmt struct {
	User        *RoleSpec // user role
	Servername  string    // server name
	IfNotExists bool      // just do nothing if it already exists?
	Options     *List     // generic options to user mapping
	Loc         Loc       // token location
}

CreateUserMappingStmt represents a CREATE USER MAPPING statement.

func (*CreateUserMappingStmt) Tag

func (n *CreateUserMappingStmt) Tag() NodeTag

type CreatedbStmt

type CreatedbStmt struct {
	Dbname  string
	Options *List // list of DefElem
	Loc     Loc   // token location
}

CreatedbStmt - CREATE DATABASE

func (*CreatedbStmt) Tag

func (n *CreatedbStmt) Tag() NodeTag

type CurrentOfExpr

type CurrentOfExpr struct {
	CvarNo      int    // RT index of target relation
	CursorName  string // name of referenced cursor
	CursorParam int    // refcursor parameter number
	Loc         Loc    // token location
}

CurrentOfExpr represents WHERE CURRENT OF cursor_name.

func (*CurrentOfExpr) Tag

func (n *CurrentOfExpr) Tag() NodeTag

type DeallocateStmt

type DeallocateStmt struct {
	Name  string // name of plan to deallocate, or NULL for all
	IsAll bool   // true if DEALLOCATE ALL
	Loc   Loc    // token location
}

DeallocateStmt represents a DEALLOCATE statement.

func (*DeallocateStmt) Tag

func (n *DeallocateStmt) Tag() NodeTag

type DeclareCursorStmt

type DeclareCursorStmt struct {
	Portalname string // name of the portal (cursor)
	Options    int    // bitmask of CURSOR_OPT_*
	Query      Node   // the query (SelectStmt)
	Loc        Loc    // token location
}

DeclareCursorStmt represents a DECLARE cursor statement.

func (*DeclareCursorStmt) Tag

func (n *DeclareCursorStmt) Tag() NodeTag

type DefElem

type DefElem struct {
	Defnamespace string // namespace (NULL if none)
	Defname      string // option name
	Arg          Node   // option value (can be integer, string, TypeName, etc)
	Defaction    int    // unspecified action, or SET/ADD/DROP (DefElemAction)
	Loc          Loc    // token location, or -1 if unknown
}

DefElem represents a generic definition element.

func (*DefElem) Tag

func (n *DefElem) Tag() NodeTag

type DefElemAction

type DefElemAction int

DefElemAction represents the action for ALTER ... OPTIONS.

const (
	DEFELEM_UNSPEC DefElemAction = iota
	DEFELEM_SET
	DEFELEM_ADD
	DEFELEM_DROP
)

type DefineStmt

type DefineStmt struct {
	Kind        ObjectType // OBJECT_AGGREGATE, OBJECT_OPERATOR, etc.
	Oldstyle    bool       // old-style (pre-8.2) aggregate syntax
	Defnames    *List      // qualified name (list of String)
	Args        *List      // arguments (for aggregates)
	Definition  *List      // definition (list of DefElem)
	IfNotExists bool       // IF NOT EXISTS
	Replace     bool       // OR REPLACE
	Loc         Loc        // token location
}

DefineStmt represents CREATE AGGREGATE/OPERATOR/TYPE/TEXT SEARCH/COLLATION.

func (*DefineStmt) Tag

func (n *DefineStmt) Tag() NodeTag

type DeleteStmt

type DeleteStmt struct {
	Relation      *RangeVar   // relation to delete from
	UsingClause   *List       // optional using clause for more tables
	WhereClause   Node        // qualifications
	ReturningList *List       // list of expressions to return
	WithClause    *WithClause // WITH clause

	Loc Loc // source location range
}

DeleteStmt represents a DELETE statement.

func (*DeleteStmt) Tag

func (n *DeleteStmt) Tag() NodeTag

type DiscardMode

type DiscardMode int

DiscardMode represents DISCARD target types.

const (
	DISCARD_ALL DiscardMode = iota
	DISCARD_PLANS
	DISCARD_SEQUENCES
	DISCARD_TEMP
)

type DiscardStmt

type DiscardStmt struct {
	Target DiscardMode
	Loc    Loc // token location
}

DiscardStmt - DISCARD

func (*DiscardStmt) Tag

func (n *DiscardStmt) Tag() NodeTag

type DoStmt

type DoStmt struct {
	Args *List // list of DefElem
	Loc  Loc   // token location
}

DoStmt represents a DO statement (anonymous code block).

func (*DoStmt) Tag

func (n *DoStmt) Tag() NodeTag

type DropBehavior

type DropBehavior int

DropBehavior represents RESTRICT vs CASCADE behavior.

const (
	DROP_RESTRICT DropBehavior = iota // drop fails if any dependent objects
	DROP_CASCADE                      // remove dependent objects too
)

type DropOwnedStmt

type DropOwnedStmt struct {
	Roles    *List        // list of RoleSpec
	Behavior DropBehavior // RESTRICT or CASCADE
	Loc      Loc          // token location
}

DropOwnedStmt represents DROP OWNED BY statement.

func (*DropOwnedStmt) Tag

func (n *DropOwnedStmt) Tag() NodeTag

type DropRoleStmt

type DropRoleStmt struct {
	Roles     *List // list of RoleSpec nodes
	MissingOk bool  // skip error if role is missing?
	Loc       Loc   // token location
}

DropRoleStmt represents DROP ROLE/USER/GROUP statements.

func (*DropRoleStmt) Tag

func (n *DropRoleStmt) Tag() NodeTag

type DropStmt

type DropStmt struct {
	Objects    *List // list of names
	RemoveType int   // object type (ObjectType)
	Behavior   int   // RESTRICT or CASCADE behavior (DropBehavior)
	Missing_ok bool  // skip error if object is missing?
	Concurrent bool  // drop index concurrently?
	Loc        Loc   // token location
}

DropStmt represents a DROP statement.

func (*DropStmt) Tag

func (n *DropStmt) Tag() NodeTag

type DropSubscriptionStmt

type DropSubscriptionStmt struct {
	Subname   string       // subscription name
	MissingOk bool         // skip error if missing?
	Behavior  DropBehavior // RESTRICT or CASCADE
	Loc       Loc          // token location
}

DropSubscriptionStmt represents a DROP SUBSCRIPTION statement.

func (*DropSubscriptionStmt) Tag

func (n *DropSubscriptionStmt) Tag() NodeTag

type DropTableSpaceStmt

type DropTableSpaceStmt struct {
	Tablespacename string // name of the tablespace to drop
	MissingOk      bool   // skip error if missing?
	Loc            Loc    // token location
}

DropTableSpaceStmt represents a DROP TABLESPACE statement.

func (*DropTableSpaceStmt) Tag

func (n *DropTableSpaceStmt) Tag() NodeTag

type DropUserMappingStmt

type DropUserMappingStmt struct {
	User       *RoleSpec // user role
	Servername string    // server name
	MissingOk  bool      // skip error if missing?
	Loc        Loc       // token location
}

DropUserMappingStmt represents a DROP USER MAPPING statement.

func (*DropUserMappingStmt) Tag

func (n *DropUserMappingStmt) Tag() NodeTag

type DropdbStmt

type DropdbStmt struct {
	Dbname    string
	MissingOk bool
	Options   *List
	Loc       Loc // token location
}

DropdbStmt - DROP DATABASE

func (*DropdbStmt) Tag

func (n *DropdbStmt) Tag() NodeTag

type ExecuteStmt

type ExecuteStmt struct {
	Name   string // name of plan
	Params *List  // list of expressions for parameter values
	Loc    Loc    // token location
}

ExecuteStmt represents an EXECUTE statement.

func (*ExecuteStmt) Tag

func (n *ExecuteStmt) Tag() NodeTag

type ExplainStmt

type ExplainStmt struct {
	Query   Node  // the query
	Options *List // list of DefElem
	Loc     Loc   // token location
}

ExplainStmt represents an EXPLAIN statement.

func (*ExplainStmt) Tag

func (n *ExplainStmt) Tag() NodeTag

type FetchDirection

type FetchDirection int

FetchDirection for FETCH/MOVE statements.

const (
	FETCH_FORWARD FetchDirection = iota
	FETCH_BACKWARD
	FETCH_ABSOLUTE
	FETCH_RELATIVE
)

type FetchStmt

type FetchStmt struct {
	Direction  FetchDirection // see above
	HowMany    int64          // number of rows, or FETCH_ALL
	Portalname string         // name of portal (cursor)
	Ismove     bool           // true if MOVE
	Loc        Loc            // token location
}

FetchStmt represents a FETCH or MOVE statement.

func (*FetchStmt) Tag

func (n *FetchStmt) Tag() NodeTag

type Float

type Float struct {
	Fval string
}

Float represents a PostgreSQL Float value node. Note: PostgreSQL stores floats as strings to preserve precision.

func (*Float) Tag

func (f *Float) Tag() NodeTag

type FromExpr

type FromExpr struct {
	Fromlist *List // List of join subtrees
	Quals    Node  // qualifiers on join, if any
}

FromExpr represents a FROM clause.

func (*FromExpr) Tag

func (n *FromExpr) Tag() NodeTag

type FuncCall

type FuncCall struct {
	Funcname       *List // qualified name of function
	Args           *List // the arguments (list of expressions)
	AggOrder       *List // ORDER BY (list of SortBy)
	AggFilter      Node  // FILTER clause, if any
	Over           Node  // OVER clause, if any (WindowDef)
	AggWithinGroup bool  // ORDER BY appeared in WITHIN GROUP
	AggStar        bool  // argument was really '*'
	AggDistinct    bool  // arguments were labeled DISTINCT
	FuncVariadic   bool  // last argument was labeled VARIADIC
	FuncFormat     int   // how to display function call (CoercionForm)
	Loc            Loc   // token location, or -1 if unknown
}

FuncCall represents a function call.

func (*FuncCall) Tag

func (n *FuncCall) Tag() NodeTag

type FunctionParameter

type FunctionParameter struct {
	Name    string                // parameter name, or NULL if not given
	ArgType *TypeName             // type name
	Mode    FunctionParameterMode // IN/OUT/etc
	Defexpr Node                  // default value, or NULL

	Loc Loc // source location range
}

FunctionParameter represents a parameter in CREATE FUNCTION.

func (*FunctionParameter) Tag

func (n *FunctionParameter) Tag() NodeTag

type FunctionParameterMode

type FunctionParameterMode byte

FunctionParameterMode represents the mode of a function parameter.

const (
	FUNC_PARAM_IN       FunctionParameterMode = 'i'
	FUNC_PARAM_OUT      FunctionParameterMode = 'o'
	FUNC_PARAM_INOUT    FunctionParameterMode = 'b'
	FUNC_PARAM_VARIADIC FunctionParameterMode = 'v'
	FUNC_PARAM_TABLE    FunctionParameterMode = 't'
	FUNC_PARAM_DEFAULT  FunctionParameterMode = 'd'
)

type GrantRoleStmt

type GrantRoleStmt struct {
	GrantedRoles *List        // list of roles to grant/revoke (AccessPriv nodes)
	GranteeRoles *List        // list of member roles (RoleSpec nodes)
	IsGrant      bool         // true = GRANT, false = REVOKE
	Opt          *List        // grant options (list of DefElem), PG17+
	Grantor      *RoleSpec    // set grantor to other than current role
	Behavior     DropBehavior // drop behavior for REVOKE
	Loc          Loc          // token location
}

GrantRoleStmt represents GRANT role TO role / REVOKE role FROM role.

func (*GrantRoleStmt) Tag

func (n *GrantRoleStmt) Tag() NodeTag

type GrantStmt

type GrantStmt struct {
	IsGrant     bool            // true = GRANT, false = REVOKE
	Targtype    GrantTargetType // type of the grant target
	Objtype     ObjectType      // kind of object being operated on
	Objects     *List           // list of object names
	Privileges  *List           // list of AccessPriv nodes
	Grantees    *List           // list of RoleSpec nodes
	GrantOption bool            // grant or revoke grant option
	Grantor     *RoleSpec       // set grantor to other than current role
	Behavior    DropBehavior    // drop behavior (RESTRICT/CASCADE)
	Loc         Loc             // token location
}

GrantStmt represents GRANT and REVOKE statements.

func (*GrantStmt) Tag

func (n *GrantStmt) Tag() NodeTag

type GrantTargetType

type GrantTargetType int

GrantTargetType represents grant target type.

const (
	ACL_TARGET_OBJECT        GrantTargetType = iota // grant on specific objects
	ACL_TARGET_ALL_IN_SCHEMA                        // grant on all objects in given schemas
	ACL_TARGET_DEFAULTS                             // ALTER DEFAULT PRIVILEGES
)

type GroupingFunc

type GroupingFunc struct {
	Args        *List  // arguments, not evaluated but kept for benefit of EXPLAIN etc.
	Refs        *List  // ressortgrouprefs of arguments
	Agglevelsup uint32 // same as Aggref.agglevelsup
	Loc         Loc    // token location, or -1 if unknown
}

GroupingFunc represents a GROUPING(...) expression.

func (*GroupingFunc) Tag

func (n *GroupingFunc) Tag() NodeTag

type GroupingSet

type GroupingSet struct {
	Kind    GroupingSetKind // GROUPING SETS, CUBE, ROLLUP
	Content *List           // content of the set
	Loc     Loc             // token location, or -1 if unknown
}

GroupingSet represents a CUBE, ROLLUP, or GROUPING SETS clause.

func (*GroupingSet) Tag

func (n *GroupingSet) Tag() NodeTag

type GroupingSetKind

type GroupingSetKind int

GroupingSetKind represents the kind of grouping set.

const (
	GROUPING_SET_EMPTY GroupingSetKind = iota
	GROUPING_SET_SIMPLE
	GROUPING_SET_ROLLUP
	GROUPING_SET_CUBE
	GROUPING_SET_SETS
)

type ImportForeignSchemaStmt

type ImportForeignSchemaStmt struct {
	ServerName   string                  // FDW server name
	RemoteSchema string                  // remote schema name to import
	LocalSchema  string                  // local schema to import into
	ListType     ImportForeignSchemaType // type of table list filter
	TableList    *List                   // list of tables to import or exclude
	Options      *List                   // generic options
	Loc          Loc                     // token location
}

ImportForeignSchemaStmt represents an IMPORT FOREIGN SCHEMA statement.

func (*ImportForeignSchemaStmt) Tag

type ImportForeignSchemaType

type ImportForeignSchemaType int

ImportForeignSchemaType represents the type of foreign schema import.

const (
	FDW_IMPORT_SCHEMA_ALL ImportForeignSchemaType = iota
	FDW_IMPORT_SCHEMA_LIMIT_TO
	FDW_IMPORT_SCHEMA_EXCEPT
)

type IndexElem

type IndexElem struct {
	Name          string      // name of attribute to index, or NULL
	Expr          Node        // expression to index, or NULL
	Indexcolname  string      // name for index column; NULL = default
	Collation     *List       // collation for index
	Opclass       *List       // operator class, or NIL
	Opclassopts   *List       // operator class parameters
	Ordering      SortByDir   // ASC/DESC/default
	NullsOrdering SortByNulls // FIRST/LAST/default
	Loc           Loc         // token location
}

IndexElem represents a column reference in an index definition.

func (*IndexElem) Tag

func (n *IndexElem) Tag() NodeTag

type IndexStmt

type IndexStmt struct {
	Idxname                     string    // name of new index, or NULL for default
	Relation                    *RangeVar // relation to build index on
	AccessMethod                string    // name of access method (eg. btree)
	TableSpace                  string    // tablespace, or NULL for default
	IndexParams                 *List     // columns to index: a list of IndexElem
	IndexIncludingParams        *List     // additional columns to index: a list of IndexElem
	Options                     *List     // WITH clause options
	WhereClause                 Node      // qualification (partial-index predicate)
	ExcludeOpNames              *List     // exclusion operator names, or NIL if none
	Idxcomment                  string    // comment to apply to index, or NULL
	IndexOid                    Oid       // OID of an existing index, if any
	OldNumber                   uint32    // relfilenumber of existing storage, if any
	OldCreateSubid              uint32    // rd_createSubid of existing index
	OldFirstRelfilelocatorSubid uint32    // rd_firstRelfilelocatorSubid of existing index
	Unique                      bool      // is index unique?
	Nulls_not_distinct          bool      // null treatment for UNIQUE constraints
	Primary                     bool      // is index a primary key?
	Isconstraint                bool      // is it for a pkey/unique constraint?
	Deferrable                  bool      // is the constraint DEFERRABLE?
	Initdeferred                bool      // is the constraint INITIALLY DEFERRED?
	Transformed                 bool      // true when transformIndexStmt is finished
	Concurrent                  bool      // should this be a concurrent index build?
	IfNotExists                 bool      // just do nothing if index already exists?
	ResetDefaultTblspc          bool      // reset default_tablespace prior to executing
	Loc                         Loc       // token location
}

IndexStmt represents a CREATE INDEX statement.

func (*IndexStmt) Tag

func (n *IndexStmt) Tag() NodeTag

type InferClause

type InferClause struct {
	IndexElems  *List  // IndexElems to infer unique index
	WhereClause Node   // qualification (partial-index predicate)
	Conname     string // constraint name
	Loc         Loc    // token location, or -1 if unknown
}

InferClause represents ON CONFLICT index inference clause.

func (*InferClause) Tag

func (n *InferClause) Tag() NodeTag

type InsertStmt

type InsertStmt struct {
	Relation         *RangeVar         // relation to insert into
	Cols             *List             // optional: names of the target columns
	SelectStmt       Node              // the source SELECT/VALUES, or NULL
	OnConflictClause *OnConflictClause // ON CONFLICT clause
	ReturningList    *List             // list of expressions to return
	WithClause       *WithClause       // WITH clause
	Override         OverridingKind    // OVERRIDING clause

	Loc Loc // source location range
}

InsertStmt represents an INSERT statement.

func (*InsertStmt) Tag

func (n *InsertStmt) Tag() NodeTag

type IntList

type IntList struct {
	Items []int
}

IntList represents a list of integers.

func (*IntList) Tag

func (l *IntList) Tag() NodeTag

type Integer

type Integer struct {
	Ival int64
}

Integer represents a PostgreSQL Integer value node.

func (*Integer) Tag

func (i *Integer) Tag() NodeTag

type IntoClause

type IntoClause struct {
	Rel            *RangeVar      // target relation name
	ColNames       *List          // column names to assign, or NIL
	AccessMethod   string         // table access method
	Options        *List          // options from WITH clause
	OnCommit       OnCommitAction // what to do at commit time
	TableSpaceName string         // table space to use, or NULL
	ViewQuery      Node           // materialized view's SELECT query
	SkipData       bool           // true for WITH NO DATA
	Loc            Loc            // token location
}

IntoClause represents SELECT INTO clause.

func (*IntoClause) Tag

func (n *IntoClause) Tag() NodeTag

type JoinExpr

type JoinExpr struct {
	Jointype    JoinType // type of join
	IsNatural   bool     // Natural join? Will need to shape table
	Larg        Node     // left subtree
	Rarg        Node     // right subtree
	UsingClause *List    // USING clause, if any
	JoinUsing   *Alias   // alias for USING join, if any
	Quals       Node     // qualifications on join, if any
	Alias       *Alias   // user-written alias clause, if any
	Rtindex     int      // RT index assigned for join, or 0
	Loc         Loc      // token location
}

JoinExpr represents a JOIN expression.

func (*JoinExpr) Tag

func (n *JoinExpr) Tag() NodeTag

type JoinType

type JoinType int

JoinType represents types of joins.

const (
	JOIN_INNER        JoinType = iota // matching tuple pairs only
	JOIN_LEFT                         // pairs + unmatched LHS tuples
	JOIN_FULL                         // pairs + unmatched LHS + unmatched RHS
	JOIN_RIGHT                        // pairs + unmatched RHS tuples
	JOIN_SEMI                         // LHS tuples that have match(es)
	JOIN_ANTI                         // LHS tuples that don't have a match
	JOIN_RIGHT_SEMI                   // RHS tuples that have match(es)
	JOIN_RIGHT_ANTI                   // RHS tuples that don't have a match
	JOIN_UNIQUE_OUTER                 // LHS path must be made unique
	JOIN_UNIQUE_INNER                 // RHS path must be made unique
)

type JsonAggConstructor

type JsonAggConstructor struct {
	Output     *JsonOutput
	Agg_filter Node
	Agg_order  *List
	Over       *WindowDef
	Loc        Loc
}

JsonAggConstructor represents common aggregate constructor fields.

func (*JsonAggConstructor) Tag

func (n *JsonAggConstructor) Tag() NodeTag

type JsonArgument

type JsonArgument struct {
	Val  *JsonValueExpr
	Name string
	Loc  Loc
}

JsonArgument represents an argument in PASSING clause.

func (*JsonArgument) Tag

func (n *JsonArgument) Tag() NodeTag

type JsonArrayAgg

type JsonArrayAgg struct {
	Constructor  *JsonAggConstructor
	Arg          *JsonValueExpr
	AbsentOnNull bool
	Loc          Loc
}

JsonArrayAgg represents JSON_ARRAYAGG() aggregate.

func (*JsonArrayAgg) Tag

func (n *JsonArrayAgg) Tag() NodeTag

type JsonArrayConstructor

type JsonArrayConstructor struct {
	Exprs        *List // list of JsonValueExpr
	Output       *JsonOutput
	AbsentOnNull bool
	Loc          Loc
}

JsonArrayConstructor represents JSON_ARRAY() with value list.

func (*JsonArrayConstructor) Tag

func (n *JsonArrayConstructor) Tag() NodeTag

type JsonArrayQueryConstructor

type JsonArrayQueryConstructor struct {
	Query        Node
	Output       *JsonOutput
	Format       *JsonFormat
	AbsentOnNull bool
	Loc          Loc
}

JsonArrayQueryConstructor represents JSON_ARRAY() with subquery.

func (*JsonArrayQueryConstructor) Tag

type JsonBehavior

type JsonBehavior struct {
	Btype  JsonBehaviorType
	Expr   Node
	Coerce Node
	Loc    Loc
}

JsonBehavior represents ON ERROR / ON EMPTY behavior.

func (*JsonBehavior) Tag

func (n *JsonBehavior) Tag() NodeTag

type JsonBehaviorType

type JsonBehaviorType int

JsonBehaviorType represents JSON behavior types.

const (
	JSON_BEHAVIOR_NULL JsonBehaviorType = iota
	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
)

type JsonEncoding

type JsonEncoding int

JsonEncoding represents JSON encoding type.

const (
	JS_ENC_DEFAULT JsonEncoding = iota
	JS_ENC_UTF8
	JS_ENC_UTF16
	JS_ENC_UTF32
)

type JsonExprOp

type JsonExprOp int

JsonExprOp represents JSON function operation type.

const (
	JSON_EXISTS_OP JsonExprOp = iota
	JSON_QUERY_OP
	JSON_VALUE_OP
	JSON_TABLE_OP
)

type JsonFormat

type JsonFormat struct {
	FormatType JsonFormatType
	Encoding   JsonEncoding
	Loc        Loc
}

JsonFormat represents a JSON format clause.

func (*JsonFormat) Tag

func (n *JsonFormat) Tag() NodeTag

type JsonFormatType

type JsonFormatType int

JsonFormatType represents JSON format type.

const (
	JS_FORMAT_DEFAULT JsonFormatType = iota
	JS_FORMAT_JSON
	JS_FORMAT_JSONB
)

type JsonFuncExpr

type JsonFuncExpr struct {
	Op          JsonExprOp
	ColumnName  string
	ContextItem *JsonValueExpr
	Pathspec    Node
	Passing     *List
	Output      *JsonOutput
	OnEmpty     *JsonBehavior
	OnError     *JsonBehavior
	Wrapper     JsonWrapper
	Quotes      JsonQuotes
	Loc         Loc
}

JsonFuncExpr represents JSON_VALUE, JSON_QUERY, JSON_EXISTS function calls.

func (*JsonFuncExpr) Tag

func (n *JsonFuncExpr) Tag() NodeTag

type JsonIsPredicate

type JsonIsPredicate struct {
	Expr       Node
	Format     *JsonFormat
	ItemType   JsonValueType
	UniqueKeys bool
	Loc        Loc
}

JsonIsPredicate represents expr IS JSON predicate.

func (*JsonIsPredicate) Tag

func (n *JsonIsPredicate) Tag() NodeTag

type JsonKeyValue

type JsonKeyValue struct {
	Key   Node
	Value *JsonValueExpr
	Loc   Loc
}

JsonKeyValue represents a key-value pair in JSON_OBJECT.

func (*JsonKeyValue) Tag

func (n *JsonKeyValue) Tag() NodeTag

type JsonObjectAgg

type JsonObjectAgg struct {
	Constructor  *JsonAggConstructor
	Arg          *JsonKeyValue
	AbsentOnNull bool
	UniqueKeys   bool
	Loc          Loc
}

JsonObjectAgg represents JSON_OBJECTAGG() aggregate.

func (*JsonObjectAgg) Tag

func (n *JsonObjectAgg) Tag() NodeTag

type JsonObjectConstructor

type JsonObjectConstructor struct {
	Exprs        *List // list of JsonKeyValue
	Output       *JsonOutput
	AbsentOnNull bool
	UniqueKeys   bool
	Loc          Loc
}

JsonObjectConstructor represents JSON_OBJECT() constructor.

func (*JsonObjectConstructor) Tag

func (n *JsonObjectConstructor) Tag() NodeTag

type JsonOutput

type JsonOutput struct {
	TypeName  *TypeName
	Returning *JsonReturning
	Loc       Loc
}

JsonOutput represents the output clause of JSON constructors.

func (*JsonOutput) Tag

func (n *JsonOutput) Tag() NodeTag

type JsonParseExpr

type JsonParseExpr struct {
	Expr       *JsonValueExpr
	Output     *JsonOutput
	UniqueKeys bool
	Loc        Loc
}

JsonParseExpr represents JSON() parse expression.

func (*JsonParseExpr) Tag

func (n *JsonParseExpr) Tag() NodeTag

type JsonQuotes

type JsonQuotes int

JsonQuotes represents KEEP/OMIT QUOTES option.

const (
	JS_QUOTES_UNSPEC JsonQuotes = iota
	JS_QUOTES_KEEP
	JS_QUOTES_OMIT
)

type JsonReturning

type JsonReturning struct {
	Format *JsonFormat
	Typid  Oid
	Typmod int32
}

JsonReturning represents the RETURNING clause of a JSON function.

func (*JsonReturning) Tag

func (n *JsonReturning) Tag() NodeTag

type JsonScalarExpr

type JsonScalarExpr struct {
	Expr   Node
	Output *JsonOutput
	Loc    Loc
}

JsonScalarExpr represents JSON_SCALAR() expression.

func (*JsonScalarExpr) Tag

func (n *JsonScalarExpr) Tag() NodeTag

type JsonSerializeExpr

type JsonSerializeExpr struct {
	Expr   *JsonValueExpr
	Output *JsonOutput
	Loc    Loc
}

JsonSerializeExpr represents JSON_SERIALIZE() expression.

func (*JsonSerializeExpr) Tag

func (n *JsonSerializeExpr) Tag() NodeTag

type JsonTable

type JsonTable struct {
	ContextItem *JsonValueExpr
	Pathspec    *JsonTablePathSpec
	Passing     *List
	Columns     *List
	OnError     *JsonBehavior
	Alias       *Alias
	Lateral     bool
	Loc         Loc
}

JsonTable represents JSON_TABLE function.

func (*JsonTable) Tag

func (n *JsonTable) Tag() NodeTag

type JsonTableColumn

type JsonTableColumn struct {
	Coltype  JsonTableColumnType
	Name     string
	TypeName *TypeName
	Pathspec *JsonTablePathSpec
	Format   *JsonFormat
	Wrapper  JsonWrapper
	Quotes   JsonQuotes
	Columns  *List
	OnEmpty  *JsonBehavior
	OnError  *JsonBehavior
	Loc      Loc
}

JsonTableColumn represents a column definition in JSON_TABLE.

func (*JsonTableColumn) Tag

func (n *JsonTableColumn) Tag() NodeTag

type JsonTableColumnType

type JsonTableColumnType int

JsonTableColumnType represents the type of a JSON_TABLE column.

const (
	JTC_FOR_ORDINALITY JsonTableColumnType = iota
	JTC_REGULAR
	JTC_EXISTS
	JTC_FORMATTED
	JTC_NESTED
)

type JsonTablePathSpec

type JsonTablePathSpec struct {
	String  Node
	Name    string
	NameLoc Loc
	Loc     Loc
}

JsonTablePathSpec represents a path specification in JSON_TABLE.

func (*JsonTablePathSpec) Tag

func (n *JsonTablePathSpec) Tag() NodeTag

type JsonValueExpr

type JsonValueExpr struct {
	RawExpr       Node
	FormattedExpr Node
	Format        *JsonFormat
	Loc           Loc
}

JsonValueExpr represents a JSON value expression.

func (*JsonValueExpr) Tag

func (n *JsonValueExpr) Tag() NodeTag

type JsonValueType

type JsonValueType int

JsonValueType for IS JSON predicate.

const (
	JS_TYPE_ANY JsonValueType = iota
	JS_TYPE_OBJECT
	JS_TYPE_ARRAY
	JS_TYPE_SCALAR
)

type JsonWrapper

type JsonWrapper int

JsonWrapper represents wrapper behavior.

const (
	JSW_UNSPEC JsonWrapper = iota
	JSW_NONE
	JSW_CONDITIONAL
	JSW_UNCONDITIONAL
)

type LimitOption

type LimitOption int

LimitOption represents LIMIT clause options.

const (
	LIMIT_OPTION_COUNT     LimitOption = iota // FETCH FIRST... ONLY
	LIMIT_OPTION_WITH_TIES                    // FETCH FIRST... WITH TIES
)

type List

type List struct {
	// In Go, we use a slice instead of a linked list.
	// The element type depends on context.
	Items []Node
}

List represents a PostgreSQL List. In PostgreSQL, List is a generic linked list that can hold any node type.

func (*List) Len

func (l *List) Len() int

Len returns the number of items in the list.

func (*List) Tag

func (l *List) Tag() NodeTag

type ListenStmt

type ListenStmt struct {
	Conditionname string
	Loc           Loc // token location
}

ListenStmt - LISTEN

func (*ListenStmt) Tag

func (n *ListenStmt) Tag() NodeTag

type LoadStmt

type LoadStmt struct {
	Filename string
	Loc      Loc // token location
}

LoadStmt - LOAD

func (*LoadStmt) Tag

func (n *LoadStmt) Tag() NodeTag

type Loc

type Loc struct {
	Start int // inclusive start byte offset (-1 if unknown)
	End   int // exclusive end byte offset (-1 if unknown)
}

Loc represents a source location range (byte offsets). -1 means "unknown" for either field.

func ListSpan

func ListSpan(list *List) Loc

ListSpan returns the byte range spanning all items in a List. It uses NodeLoc on the first and last items to compute the range. Returns NoLoc() if the list is nil, empty, or items have no Loc.

func NoLoc

func NoLoc() Loc

NoLoc returns a Loc with both Start and End set to -1 (unknown).

func NodeLoc

func NodeLoc(n Node) Loc

NodeLoc extracts the Loc from any AST node that carries one. Returns NoLoc() if the node is nil or its type has no Loc field.

type LockClauseStrength

type LockClauseStrength int

LockClauseStrength represents FOR UPDATE/SHARE strength.

const (
	LCS_NONE LockClauseStrength = iota
	LCS_FORKEYSHARE
	LCS_FORSHARE
	LCS_FORNOKEYUPDATE
	LCS_FORUPDATE
)

type LockStmt

type LockStmt struct {
	Relations *List // list of RangeVar
	Mode      int   // lock mode
	Nowait    bool  // no wait option
	Loc       Loc   // token location
}

LockStmt represents a LOCK TABLE statement.

func (*LockStmt) Tag

func (n *LockStmt) Tag() NodeTag

type LockWaitPolicy

type LockWaitPolicy int

LockWaitPolicy represents NOWAIT/SKIP LOCKED option.

const (
	LockWaitBlock LockWaitPolicy = iota // default behavior: wait for lock
	LockWaitSkip                        // SKIP LOCKED
	LockWaitError                       // NOWAIT
)

type LockingClause

type LockingClause struct {
	LockedRels *List // FOR UPDATE/SHARE relations
	Strength   int   // LockClauseStrength
	WaitPolicy int   // LockWaitPolicy
	Loc        Loc   // token location
}

LockingClause represents FOR UPDATE/SHARE clause.

func (*LockingClause) Tag

func (n *LockingClause) Tag() NodeTag

type MergeMatchKind

type MergeMatchKind int

MergeMatchKind represents the match kind for MERGE.

const (
	MERGE_WHEN_MATCHED MergeMatchKind = iota
	MERGE_WHEN_NOT_MATCHED_BY_SOURCE
	MERGE_WHEN_NOT_MATCHED_BY_TARGET
)

type MergeStmt

type MergeStmt struct {
	Relation         *RangeVar   // target relation to merge into
	SourceRelation   Node        // source relation
	JoinCondition    Node        // join condition between source and target
	MergeWhenClauses *List       // list of MergeWhenClause
	ReturningList    *List       // list of expressions to return
	WithClause       *WithClause // WITH clause

	Loc Loc // source location range
}

MergeStmt represents a MERGE statement.

func (*MergeStmt) Tag

func (n *MergeStmt) Tag() NodeTag

type MergeWhenClause

type MergeWhenClause struct {
	Kind        MergeMatchKind // MATCHED, NOT MATCHED BY SOURCE, NOT MATCHED BY TARGET
	Condition   Node           // condition expression
	TargetList  *List          // target list for INSERT/UPDATE
	Values      *List          // VALUES for INSERT (NULL for UPDATE/DELETE)
	Override    OverridingKind // OVERRIDING clause for INSERT
	CommandType CmdType        // INSERT/UPDATE/DELETE
	Loc         Loc            // token location
}

MergeWhenClause represents a WHEN clause in MERGE statement.

func (*MergeWhenClause) Tag

func (n *MergeWhenClause) Tag() NodeTag

type MinMaxExpr

type MinMaxExpr struct {
	Minmaxtype   Oid      // common type of arguments and result
	Minmaxcollid Oid      // OID of collation of result
	Op           MinMaxOp // GREATEST or LEAST
	Args         *List    // the arguments
	Loc          Loc      // token location, or -1 if unknown
}

MinMaxExpr represents a GREATEST or LEAST expression.

func (*MinMaxExpr) Tag

func (n *MinMaxExpr) Tag() NodeTag

type MinMaxOp

type MinMaxOp int

MinMaxOp represents GREATEST vs LEAST.

const (
	IS_GREATEST MinMaxOp = iota
	IS_LEAST
)

type MultiAssignRef

type MultiAssignRef struct {
	Source   Node // the row-valued expression
	Colno    int  // column number for this target (1..n)
	Ncolumns int  // number of targets in the construct
	Loc      Loc  // token location
}

MultiAssignRef is an element of a row source expression for UPDATE SET (a,b) = expr.

func (*MultiAssignRef) Tag

func (n *MultiAssignRef) Tag() NodeTag

type NamedArgExpr

type NamedArgExpr struct {
	Arg       Node   // the argument expression
	Name      string // the name
	Argnumber int    // argument's number in positional notation
	Loc       Loc    // argument name location, or -1 if unknown
}

NamedArgExpr represents a named argument in a function call.

func (*NamedArgExpr) Tag

func (n *NamedArgExpr) Tag() NodeTag

type Node

type Node interface {
	// Tag returns the NodeTag for this node type.
	Tag() NodeTag
}

Node is the interface implemented by all parse tree nodes.

type NodeTag

type NodeTag int

NodeTag identifies the type of a node. Values must match PostgreSQL's NodeTag enum.

const (
	T_Invalid NodeTag = 0

	// Value nodes (from value.h)
	T_Integer NodeTag = iota + 1
	T_Float
	T_Boolean
	T_String
	T_BitString

	// List nodes
	T_List
	T_IntList
	T_OidList

	// Primitive nodes (from primnodes.h)
	T_Alias
	T_RangeVar
	T_TableFunc
	T_IntoClause
	T_Var
	T_Const
	T_Param
	T_Aggref
	T_GroupingFunc
	T_WindowFunc
	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_CoerceToDomain
	T_CoerceToDomainValue
	T_SetToDefault
	T_CurrentOfExpr
	T_NextValueExpr
	T_InferenceElem
	T_TargetEntry
	T_RangeTblRef
	T_JoinExpr
	T_FromExpr
	T_OnConflictExpr
	T_MergeAction

	// Parse nodes (from parsenodes.h) - Raw parse tree nodes
	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_SinglePartitionSpec
	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_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_ReplicaIdentityStmt
	T_AlterTableCmd
	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
)

NodeTag values for all node types. These must match PostgreSQL's generated nodetags.h. We define them manually for the nodes we need.

type NotifyStmt

type NotifyStmt struct {
	Conditionname string
	Payload       string
	Loc           Loc // token location
}

NotifyStmt - NOTIFY

func (*NotifyStmt) Tag

func (n *NotifyStmt) Tag() NodeTag

type NullIfExpr

type NullIfExpr struct {
	Opno         Oid   // PG_OPERATOR OID of the operator
	Opfuncid     Oid   // PG_PROC OID of underlying function
	Opresulttype Oid   // PG_TYPE OID of result value
	Opretset     bool  // true if operator returns set
	Opcollid     Oid   // OID of collation of result
	Inputcollid  Oid   // OID of collation that operator should use
	Args         *List // arguments to the operator (min 2)
	Loc          Loc   // token location, or -1 if unknown
}

NullIfExpr represents a NULLIF expression. This is represented as an OpExpr in the parse tree.

func (*NullIfExpr) Tag

func (n *NullIfExpr) Tag() NodeTag

type NullTest

type NullTest struct {
	Arg          Node         // input expression
	Nulltesttype NullTestType // IS NULL, IS NOT NULL
	Argisrow     bool         // T to perform field-by-field null checks
	Loc          Loc          // token location, or -1 if unknown
}

NullTest represents IS [NOT] NULL test.

func (*NullTest) Tag

func (n *NullTest) Tag() NodeTag

type NullTestType

type NullTestType int

NullTestType represents NULL test types.

const (
	IS_NULL NullTestType = iota
	IS_NOT_NULL
)

type ObjectType

type ObjectType int

ObjectType represents types of objects.

const (
	OBJECT_ACCESS_METHOD ObjectType = iota
	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_STATISTIC_EXT
	OBJECT_SUBSCRIPTION
	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
)

type ObjectWithArgs

type ObjectWithArgs struct {
	Objname         *List // qualified name (list of String)
	Objargs         *List // argument types (list of TypeName)
	ArgsUnspecified bool  // true if no argument list was given
}

ObjectWithArgs represents a function/operator name with argument types. Used in ALTER FUNCTION, DROP FUNCTION/PROCEDURE/AGGREGATE/OPERATOR etc.

func (*ObjectWithArgs) Tag

func (n *ObjectWithArgs) Tag() NodeTag

type Oid

type Oid uint32

Oid represents a PostgreSQL object identifier.

const (
	InvalidOid Oid = 0
)

Constants for special OID values.

type OidList

type OidList struct {
	Items []Oid
}

OidList represents a list of OIDs.

func (*OidList) Tag

func (l *OidList) Tag() NodeTag

type OnCommitAction

type OnCommitAction int

OnCommitAction represents ON COMMIT actions for temporary tables.

const (
	ONCOMMIT_NOOP          OnCommitAction = iota // No ON COMMIT clause
	ONCOMMIT_PRESERVE_ROWS                       // ON COMMIT PRESERVE ROWS
	ONCOMMIT_DELETE_ROWS                         // ON COMMIT DELETE ROWS
	ONCOMMIT_DROP                                // ON COMMIT DROP
)

type OnConflictClause

type OnConflictClause struct {
	Action      int // DO NOTHING or DO UPDATE
	Infer       *InferClause
	TargetList  *List // SET clause for DO UPDATE
	WhereClause Node  // WHERE clause for DO UPDATE
	Loc         Loc   // token location, or -1 if unknown
}

OnConflictClause represents ON CONFLICT clause.

func (*OnConflictClause) Tag

func (n *OnConflictClause) Tag() NodeTag

type OverridingKind

type OverridingKind int

OverridingKind represents OVERRIDING clause options.

const (
	OVERRIDING_NOT_SET OverridingKind = iota
	OVERRIDING_USER_VALUE
	OVERRIDING_SYSTEM_VALUE
)

type ParamRef

type ParamRef struct {
	Number int // number of the parameter
	Loc    Loc // token location, or -1 if unknown
}

ParamRef represents $n parameter reference.

func (*ParamRef) Tag

func (n *ParamRef) Tag() NodeTag

type ParseLoc

type ParseLoc int

ParseLoc represents a location in the source text (byte offset). -1 means "unknown". Deprecated: Use Loc instead for range-based location tracking.

type PartitionBoundSpec

type PartitionBoundSpec struct {
	Strategy    byte  // PARTITION_STRATEGY_* code
	IsDefault   bool  // is it a default partition bound?
	Modulus     int   // hash partition modulus
	Remainder   int   // hash partition remainder
	Listdatums  *List // list of Consts (or Exprs) for LIST
	Lowerdatums *List // list of Consts (or Exprs) for RANGE lower
	Upperdatums *List // list of Consts (or Exprs) for RANGE upper
	Loc         Loc
}

PartitionBoundSpec represents a partition bound specification.

func (*PartitionBoundSpec) Tag

func (n *PartitionBoundSpec) Tag() NodeTag

type PartitionCmd

type PartitionCmd struct {
	Name       *RangeVar           // partition to attach/detach
	Bound      *PartitionBoundSpec // FOR VALUES, if attaching
	Concurrent bool
	Loc        Loc // token location
}

PartitionCmd represents ALTER TABLE ATTACH/DETACH PARTITION.

func (*PartitionCmd) Tag

func (n *PartitionCmd) Tag() NodeTag

type PartitionElem

type PartitionElem struct {
	Name      string // name of column to partition on, or ""
	Expr      Node   // expression to partition on, or nil
	Collation *List  // name of collation; nil = default
	Opclass   *List  // name of desired opclass; nil = default
	Loc       Loc    // token location, or -1 if unknown
}

PartitionElem represents a single partition key element.

func (*PartitionElem) Tag

func (n *PartitionElem) Tag() NodeTag

type PartitionSpec

type PartitionSpec struct {
	Strategy   string // partitioning strategy (PARTITION_STRATEGY_*)
	PartParams *List  // partition key list
	Loc        Loc    // token location, or -1 if unknown
}

PartitionSpec represents PARTITION BY clause.

func (*PartitionSpec) Tag

func (n *PartitionSpec) Tag() NodeTag

type PrepareStmt

type PrepareStmt struct {
	Name     string // name of plan
	Argtypes *List  // list of TypeName
	Query    Node   // the query itself
	Loc      Loc    // token location
}

PrepareStmt represents a PREPARE statement.

func (*PrepareStmt) Tag

func (n *PrepareStmt) Tag() NodeTag

type PublicationObjSpec

type PublicationObjSpec struct {
	Pubobjtype PublicationObjSpecType // object type
	Name       string                 // schema name for TABLES IN SCHEMA
	Pubtable   *PublicationTable      // table specification
	Loc        Loc                    // token location
}

PublicationObjSpec represents a publication object specification.

func (*PublicationObjSpec) Tag

func (n *PublicationObjSpec) Tag() NodeTag

type PublicationObjSpecType

type PublicationObjSpecType int

PublicationObjSpecType represents the type of publication object.

const (
	PUBLICATIONOBJ_TABLE PublicationObjSpecType = iota
	PUBLICATIONOBJ_TABLES_IN_SCHEMA
	PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA
	PUBLICATIONOBJ_CONTINUATION
)

type PublicationTable

type PublicationTable struct {
	Relation    *RangeVar // relation to publish
	WhereClause Node      // WHERE clause for row filter
	Columns     *List     // column list filter
	Loc         Loc       // token location
}

PublicationTable represents a table in a publication.

func (*PublicationTable) Tag

func (n *PublicationTable) Tag() NodeTag

type QuerySource

type QuerySource int

QuerySource represents possible sources of a Query.

const (
	QSRC_ORIGINAL          QuerySource = iota // original parsetree (explicit query)
	QSRC_PARSER                               // added by parse analysis (now unused)
	QSRC_INSTEAD_RULE                         // added by unconditional INSTEAD rule
	QSRC_QUAL_INSTEAD_RULE                    // added by conditional INSTEAD rule
	QSRC_NON_INSTEAD_RULE                     // added by non-INSTEAD rule
)

type RangeFunction

type RangeFunction struct {
	Lateral    bool   // does it have LATERAL prefix?
	Ordinality bool   // does it have WITH ORDINALITY suffix?
	IsRowsfrom bool   // is this a ROWS FROM() clause?
	Functions  *List  // list of RangeFunction items
	Alias      *Alias // table alias & optional column aliases
	Coldeflist *List  // list of ColumnDef nodes for ROWS FROM()
	Loc        Loc    // token location
}

RangeFunction represents a function appearing in FROM clause.

func (*RangeFunction) Tag

func (n *RangeFunction) Tag() NodeTag

type RangeSubselect

type RangeSubselect struct {
	Lateral  bool   // does it have LATERAL prefix?
	Subquery Node   // the untransformed sub-select clause
	Alias    *Alias // table alias & optional column aliases
	Loc      Loc    // token location
}

RangeSubselect represents a subquery appearing in a FROM clause.

func (*RangeSubselect) Tag

func (n *RangeSubselect) Tag() NodeTag

type RangeTableFunc

type RangeTableFunc struct {
	Lateral    bool   // does it have LATERAL prefix?
	Docexpr    Node   // document expression
	Rowexpr    Node   // row generator expression
	Namespaces *List  // list of namespaces as ResTarget
	Columns    *List  // list of RangeTableFuncCol
	Alias      *Alias // table alias & optional column aliases
	Loc        Loc    // token location, or -1
}

RangeTableFunc represents raw form of table functions such as XMLTABLE.

func (*RangeTableFunc) Tag

func (n *RangeTableFunc) Tag() NodeTag

type RangeTableFuncCol

type RangeTableFuncCol struct {
	Colname       string    // name of generated column
	TypeName      *TypeName // type of generated column
	ForOrdinality bool      // does it have FOR ORDINALITY?
	IsNotNull     bool      // does it have NOT NULL?
	Colexpr       Node      // column filter expression (PATH)
	Coldefexpr    Node      // column default value expression
	Loc           Loc       // token location, or -1
}

RangeTableFuncCol represents one column in a RangeTableFunc.

func (*RangeTableFuncCol) Tag

func (n *RangeTableFuncCol) Tag() NodeTag

type RangeTableSample

type RangeTableSample struct {
	Relation   Node  // relation to sample
	Method     *List // sampling method name (possibly schema qualified)
	Args       *List // argument(s) for sampling method
	Repeatable Node  // REPEATABLE expression, or NULL if none
	Loc        Loc   // method name location, or -1 if unknown
}

RangeTableSample represents TABLESAMPLE appearing in FROM clause.

func (*RangeTableSample) Tag

func (n *RangeTableSample) Tag() NodeTag

type RangeVar

type RangeVar struct {
	Catalogname    string // the catalog (database) name, or NULL
	Schemaname     string // the schema name, or NULL
	Relname        string // the relation/sequence name
	Inh            bool   // expand rel by inheritance? recursively act on children?
	Relpersistence byte   // see RELPERSISTENCE_* in pg_class.h
	Alias          *Alias // table alias & optional column aliases
	Loc            Loc    // token location, or -1 if unknown
}

RangeVar represents a range variable (table/view reference).

func (*RangeVar) Tag

func (n *RangeVar) Tag() NodeTag

type RawStmt

type RawStmt struct {
	Stmt Node // raw statement
	Loc  Loc  // source location range (Start = start offset, End = start + length)
}

RawStmt wraps a raw (unparsed) statement.

func (*RawStmt) Tag

func (n *RawStmt) Tag() NodeTag

type ReassignOwnedStmt

type ReassignOwnedStmt struct {
	Roles   *List     // list of RoleSpec
	Newrole *RoleSpec // new owner
	Loc     Loc       // token location
}

ReassignOwnedStmt represents REASSIGN OWNED BY statement.

func (*ReassignOwnedStmt) Tag

func (n *ReassignOwnedStmt) Tag() NodeTag

type RefreshMatViewStmt

type RefreshMatViewStmt struct {
	Concurrent bool      // allow concurrent access?
	SkipData   bool      // don't run SELECT query
	Relation   *RangeVar // relation to refresh
	Loc        Loc       // token location
}

RefreshMatViewStmt represents a REFRESH MATERIALIZED VIEW statement.

func (*RefreshMatViewStmt) Tag

func (n *RefreshMatViewStmt) Tag() NodeTag

type ReindexObjectType

type ReindexObjectType int

ReindexObjectType represents the type of object to reindex.

const (
	REINDEX_OBJECT_INDEX ReindexObjectType = iota
	REINDEX_OBJECT_TABLE
	REINDEX_OBJECT_SCHEMA
	REINDEX_OBJECT_SYSTEM
	REINDEX_OBJECT_DATABASE
)

type ReindexStmt

type ReindexStmt struct {
	Kind     ReindexObjectType // REINDEX_OBJECT_INDEX, etc
	Relation *RangeVar         // table or index to reindex
	Name     string            // name of database/schema to reindex
	Params   *List             // list of DefElem
	Loc      Loc               // token location
}

ReindexStmt represents a REINDEX statement.

func (*ReindexStmt) Tag

func (n *ReindexStmt) Tag() NodeTag

type RenameStmt

type RenameStmt struct {
	RenameType   ObjectType   // OBJECT_TABLE, OBJECT_COLUMN, etc
	RelationType ObjectType   // if column, what's the relation type?
	Relation     *RangeVar    // in case it's a table
	Object       Node         // qualified name of object
	Subname      string       // name of contained object (column, rule, etc)
	Newname      string       // new name
	Behavior     DropBehavior // RESTRICT or CASCADE
	MissingOk    bool         // skip error if missing?
	Loc          Loc          // token location
}

RenameStmt represents ALTER ... RENAME statement.

func (*RenameStmt) Tag

func (n *RenameStmt) Tag() NodeTag

type ResTarget

type ResTarget struct {
	Name        string // column name or NULL
	Indirection *List  // subscripts, field names, and '*'
	Val         Node   // the value expression to compute or assign
	Loc         Loc    // token location, or -1 if unknown
}

ResTarget represents a result target in SELECT's target list, or a column name in INSERT/UPDATE.

func (*ResTarget) Tag

func (n *ResTarget) Tag() NodeTag

type ReturnStmt

type ReturnStmt struct {
	Returnval Node // return value expression

	Loc Loc // source location range
}

ReturnStmt represents a RETURN statement in SQL-standard function bodies.

func (*ReturnStmt) Tag

func (n *ReturnStmt) Tag() NodeTag

type RoleSpec

type RoleSpec struct {
	Roletype int    // type of role (RoleSpecType)
	Rolename string // filled only for ROLESPEC_CSTRING
	Loc      Loc    // token location, or -1 if unknown
}

RoleSpec represents a role specification.

func (*RoleSpec) Tag

func (n *RoleSpec) Tag() NodeTag

type RoleSpecType

type RoleSpecType int

RoleSpecType represents types of role specification.

const (
	ROLESPEC_CSTRING      RoleSpecType = iota // role name as string
	ROLESPEC_CURRENT_ROLE                     // CURRENT_ROLE
	ROLESPEC_CURRENT_USER                     // CURRENT_USER (synonym)
	ROLESPEC_SESSION_USER                     // SESSION_USER
	ROLESPEC_PUBLIC                           // PUBLIC
)

type RoleStmtType

type RoleStmtType int

RoleStmtType for CREATE ROLE/USER/GROUP

const (
	ROLESTMT_ROLE RoleStmtType = iota
	ROLESTMT_USER
	ROLESTMT_GROUP
)

type RowExpr

type RowExpr struct {
	Args      *List        // the fields
	RowTypeid Oid          // RECORDOID or a composite type's ID
	RowFormat CoercionForm // how to display this node
	Colnames  *List        // list of String, or NIL
	Loc       Loc          // token location, or -1 if unknown
}

RowExpr represents a ROW() or (a, b, c) expression.

func (*RowExpr) Tag

func (n *RowExpr) Tag() NodeTag

type RuleStmt

type RuleStmt struct {
	Relation    *RangeVar // relation the rule is for
	Rulename    string    // name of the rule
	WhereClause Node      // qualifications
	Event       CmdType   // SELECT, INSERT, etc
	Instead     bool      // is a DO INSTEAD rule?
	Actions     *List     // the action statements
	Replace     bool      // OR REPLACE
	Loc         Loc       // token location
}

RuleStmt represents a CREATE RULE statement.

func (*RuleStmt) Tag

func (n *RuleStmt) Tag() NodeTag

type SQLValueFunction

type SQLValueFunction struct {
	Op     SVFOp // which function this is
	Typmod int32 // typmod to apply, or -1
	Loc    Loc   // token location, or -1
}

SQLValueFunction represents SQL-standard functions that don't require a function call syntax, e.g. CURRENT_DATE, CURRENT_USER, etc.

func (*SQLValueFunction) Tag

func (n *SQLValueFunction) Tag() NodeTag

type SVFOp

type SVFOp int

SVFOp represents SQL-standard function types for SQLValueFunction.

const (
	SVFOP_CURRENT_DATE SVFOp = iota
	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
)

type SecLabelStmt

type SecLabelStmt struct {
	Objtype  ObjectType // object kind
	Object   Node       // qualified name of object
	Provider string     // security label provider
	Label    string     // new security label, or empty to drop
	Loc      Loc        // token location
}

SecLabelStmt represents a SECURITY LABEL statement.

func (*SecLabelStmt) Tag

func (n *SecLabelStmt) Tag() NodeTag

type SelectStmt

type SelectStmt struct {
	// Fields for "leaf" SelectStmts (simple SELECT or VALUES)
	DistinctClause *List       // NULL, list of DISTINCT ON exprs, or lcons(NIL,NIL) for all (SELECT DISTINCT)
	IntoClause     *IntoClause // target for SELECT INTO
	TargetList     *List       // the target list (of ResTarget)
	FromClause     *List       // the FROM clause
	WhereClause    Node        // WHERE qualification
	GroupClause    *List       // GROUP BY clauses
	GroupDistinct  bool        // Is this GROUP BY DISTINCT?
	HavingClause   Node        // HAVING conditional-expression
	WindowClause   *List       // WINDOW window_name AS (...), ...

	// For VALUES lists
	ValuesLists *List // untransformed list of expression lists

	// Fields for both "leaf" and upper-level SelectStmts
	SortClause    *List       // sort clause (a list of SortBy's)
	LimitOffset   Node        // # of result tuples to skip
	LimitCount    Node        // # of result tuples to return
	LimitOption   LimitOption // limit type
	LockingClause *List       // FOR UPDATE (list of LockingClause's)
	WithClause    *WithClause // WITH clause

	// Fields for upper-level SelectStmts (set operations)
	Op   SetOperation // type of set op
	All  bool         // ALL specified?
	Larg *SelectStmt  // left child
	Rarg *SelectStmt  // right child

	Loc Loc // source location range
}

SelectStmt represents a SELECT statement. This is output by the parser for SELECT, VALUES, and table references.

func (*SelectStmt) Tag

func (n *SelectStmt) Tag() NodeTag

type SetOperation

type SetOperation int

SetOperation represents types of set operations (UNION, INTERSECT, EXCEPT).

const (
	SETOP_NONE SetOperation = iota
	SETOP_UNION
	SETOP_INTERSECT
	SETOP_EXCEPT
)

type SetOperationStmt

type SetOperationStmt struct {
	Op            SetOperation // type of set op
	All           bool         // ALL specified?
	Larg          Node         // left child
	Rarg          Node         // right child
	ColTypes      *List        // OID list of output column types
	ColTypmods    *List        // integer list of output column typmods
	ColCollations *List        // OID list of output column collations
	GroupClauses  *List        // list of SortGroupClause
}

SetOperationStmt represents a set-operation (UNION/INTERSECT/EXCEPT) tree.

func (*SetOperationStmt) Tag

func (n *SetOperationStmt) Tag() NodeTag

type SetQuantifier

type SetQuantifier int

SetQuantifier represents ALL/DISTINCT option.

const (
	SET_QUANTIFIER_DEFAULT SetQuantifier = iota
	SET_QUANTIFIER_ALL
	SET_QUANTIFIER_DISTINCT
)

type SetToDefault

type SetToDefault struct {
	TypeId    Oid   // type for substituted value
	Typmod    int32 // typemod for substituted value
	Collation Oid   // collation for the datatype
	Loc       Loc   // token location, or -1
}

SetToDefault represents a DEFAULT marker in expressions.

func (*SetToDefault) Tag

func (n *SetToDefault) Tag() NodeTag

type SortBy

type SortBy struct {
	Node        Node        // expression to sort on
	SortbyDir   SortByDir   // ASC/DESC/USING/default
	SortbyNulls SortByNulls // NULLS FIRST/LAST
	UseOp       *List       // name of op to use, if SORTBY_USING
	Loc         Loc         // operator location, or -1 if none/unknown
}

SortBy represents ORDER BY clause item.

func (*SortBy) Tag

func (n *SortBy) Tag() NodeTag

type SortByDir

type SortByDir int

SortByDir represents sort ordering direction.

const (
	SORTBY_DEFAULT SortByDir = iota
	SORTBY_ASC
	SORTBY_DESC
	SORTBY_USING // not allowed in CREATE INDEX
)

type SortByNulls

type SortByNulls int

SortByNulls represents NULLS FIRST/LAST option.

const (
	SORTBY_NULLS_DEFAULT SortByNulls = iota
	SORTBY_NULLS_FIRST
	SORTBY_NULLS_LAST
)

type SortGroupClause

type SortGroupClause struct {
	TleSortGroupRef uint32 // reference into targetlist
	Eqop            Oid    // operator for equality comparison
	Sortop          Oid    // operator for sorting
	Nulls_first     bool   // sort nulls first
	Hashable        bool   // can hash for grouping?
}

SortGroupClause represents a single element of ORDER BY, GROUP BY, etc.

func (*SortGroupClause) Tag

func (n *SortGroupClause) Tag() NodeTag

type StatsElem

type StatsElem struct {
	Name string // column name, or NULL
	Expr Node   // expression, or NULL
	Loc  Loc    // token location
}

StatsElem represents a statistics element.

func (*StatsElem) Tag

func (n *StatsElem) Tag() NodeTag

type String

type String struct {
	Str string
}

String represents a PostgreSQL String value node.

func (*String) Tag

func (s *String) Tag() NodeTag
type SubLink struct {
	SubLinkType int   // see SubLinkType above
	SubLinkId   int   // ID (1..n); 0 if not MULTIEXPR
	Testexpr    Node  // outer-query test for ANY/ALL/ROWCOMPARE
	OperName    *List // originally specified operator name
	Subselect   Node  // subselect as Query* or raw parsetree
	Loc         Loc   // token location, or -1 if unknown
}

SubLink represents a subquery appearing in an expression.

func (*SubLink) Tag

func (n *SubLink) Tag() NodeTag

type SubLinkType

type SubLinkType int

SubLinkType represents types of SubLink.

const (
	EXISTS_SUBLINK SubLinkType = iota
	ALL_SUBLINK
	ANY_SUBLINK
	ROWCOMPARE_SUBLINK
	EXPR_SUBLINK
	MULTIEXPR_SUBLINK
	ARRAY_SUBLINK
	CTE_SUBLINK // for SubPlans only
)

type TableLikeClause

type TableLikeClause struct {
	Relation      *RangeVar // relation to clone
	Options       uint32    // OR of TableLikeOption flags
	RelationOid   Oid       // set during parse analysis to the OID of the relation
	Columns       *List     // list of ColumnDef nodes
	AncillaryData *List     // list of DefElem nodes for INDEX etc
	Loc           Loc       // token location
}

TableLikeClause represents LIKE clause in CREATE TABLE.

func (*TableLikeClause) Tag

func (n *TableLikeClause) Tag() NodeTag

type TransactionStmt

type TransactionStmt struct {
	Kind      TransactionStmtKind // type of transaction statement
	Options   *List               // for BEGIN/START TRANSACTION
	Savepoint string              // for SAVEPOINT, ROLLBACK TO, RELEASE
	Gid       string              // for two-phase commit
	Chain     bool                // AND CHAIN option
	Loc       Loc                 // token location, or -1 if unknown
}

TransactionStmt represents a transaction control statement.

func (*TransactionStmt) Tag

func (n *TransactionStmt) Tag() NodeTag

type TransactionStmtKind

type TransactionStmtKind int

TransactionStmtKind represents the kind of transaction statement.

const (
	TRANS_STMT_BEGIN TransactionStmtKind = iota
	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
)

type TriggerTransition

type TriggerTransition struct {
	Name    string // transition relation name
	IsNew   bool   // is it NEW TABLE or OLD TABLE?
	IsTable bool   // is it TABLE or ROW?
	Loc     Loc    // token location
}

TriggerTransition represents a transition table specification in CREATE TRIGGER.

func (*TriggerTransition) Tag

func (n *TriggerTransition) Tag() NodeTag

type TruncateStmt

type TruncateStmt struct {
	Relations   *List        // list of relation names to truncate
	RestartSeqs bool         // restart owned sequences?
	Behavior    DropBehavior // RESTRICT or CASCADE behavior
	Loc         Loc          // token location
}

TruncateStmt represents a TRUNCATE statement.

func (*TruncateStmt) Tag

func (n *TruncateStmt) Tag() NodeTag

type TypeCast

type TypeCast struct {
	Arg      Node      // the expression being casted
	TypeName *TypeName // the target type
	Loc      Loc       // token location, or -1 if unknown
}

TypeCast represents a CAST expression.

func (*TypeCast) Tag

func (n *TypeCast) Tag() NodeTag

type TypeName

type TypeName struct {
	Names       *List // qualified name (list of String nodes)
	TypeOid     Oid   // type identified by OID (InvalidOid if not known)
	Setof       bool  // is a set?
	PctType     bool  // %TYPE specified?
	Typmods     *List // type modifier expression(s)
	Typemod     int32 // prespecified type modifier
	ArrayBounds *List // array bounds
	Loc         Loc   // token location, or -1 if unknown
}

TypeName represents a data type name.

func (*TypeName) Tag

func (n *TypeName) Tag() NodeTag

type UnlistenStmt

type UnlistenStmt struct {
	Conditionname string // empty string means UNLISTEN *
	Loc           Loc    // token location
}

UnlistenStmt - UNLISTEN

func (*UnlistenStmt) Tag

func (n *UnlistenStmt) Tag() NodeTag

type UpdateStmt

type UpdateStmt struct {
	Relation      *RangeVar   // relation to update
	TargetList    *List       // the target list (of ResTarget)
	WhereClause   Node        // qualifications
	FromClause    *List       // optional from clause for more tables
	ReturningList *List       // list of expressions to return
	WithClause    *WithClause // WITH clause

	Loc Loc // source location range
}

UpdateStmt represents an UPDATE statement.

func (*UpdateStmt) Tag

func (n *UpdateStmt) Tag() NodeTag

type VacuumRelation

type VacuumRelation struct {
	Relation *RangeVar // relation to process, or NULL for current database
	Oid      Oid       // OID of relation to process (filled in later)
	VaCols   *List     // list of column names, or NIL for all
	Loc      Loc       // token location
}

VacuumRelation represents a single relation to vacuum/analyze.

func (*VacuumRelation) Tag

func (n *VacuumRelation) Tag() NodeTag

type VacuumStmt

type VacuumStmt struct {
	Options     *List // list of DefElem
	Rels        *List // list of VacuumRelation, or NIL for all
	IsVacuumCmd bool  // true for VACUUM, false for ANALYZE
	Loc         Loc   // token location
}

VacuumStmt represents a VACUUM or ANALYZE statement.

func (*VacuumStmt) Tag

func (n *VacuumStmt) Tag() NodeTag

type VariableSetKind

type VariableSetKind int

VariableSetKind represents SET variable kinds.

const (
	VAR_SET_VALUE   VariableSetKind = iota // SET var = value
	VAR_SET_DEFAULT                        // SET var TO DEFAULT
	VAR_SET_CURRENT                        // SET var FROM CURRENT
	VAR_SET_MULTI                          // special case for SET TRANSACTION
	VAR_RESET                              // RESET var
	VAR_RESET_ALL                          // RESET ALL
)

type VariableSetStmt

type VariableSetStmt struct {
	Kind    VariableSetKind
	Name    string
	Args    *List
	IsLocal bool
	Loc     Loc // token location
}

VariableSetStmt - SET variable

func (*VariableSetStmt) Tag

func (n *VariableSetStmt) Tag() NodeTag

type VariableShowStmt

type VariableShowStmt struct {
	Name string
	Loc  Loc // token location
}

VariableShowStmt - SHOW variable

func (*VariableShowStmt) Tag

func (n *VariableShowStmt) Tag() NodeTag

type ViewStmt

type ViewStmt struct {
	View            *RangeVar // the view to be created
	Aliases         *List     // target column names
	Query           Node      // the SELECT query (as a raw parse tree)
	Replace         bool      // replace an existing view?
	Options         *List     // options from WITH clause
	WithCheckOption int       // WITH CHECK OPTION
	Loc             Loc       // token location
}

ViewStmt represents a CREATE VIEW statement.

func (*ViewStmt) Tag

func (n *ViewStmt) Tag() NodeTag

type Visitor

type Visitor interface {
	Visit(node Node) Visitor
}

Visitor defines the interface for AST traversal. Visit is called for each node during a depth-first walk. If Visit returns a non-nil Visitor, Walk recurses into the node's children with the returned Visitor, then calls Visit(nil) to signal post-order. If Visit returns nil, children are not visited.

type WindowClause

type WindowClause struct {
	Name              string // window name (NULL if none)
	Refname           string // referenced window name (NULL if none)
	PartitionClause   *List  // PARTITION BY list
	OrderClause       *List  // ORDER BY list
	FrameOptions      int    // frame_clause options, see WindowDef
	StartOffset       Node   // expression for starting bound, if any
	EndOffset         Node   // expression for ending bound, if any
	RunCondition      *List  // qual to help short-circuit execution
	StartInRangeFunc  Oid    // in_range function for start bound
	EndInRangeFunc    Oid    // in_range function for end bound
	InRangeColl       Oid    // collation for in_range comparisons
	InRangeAsc        bool   // use ASC sort order for in_range?
	InRangeNullsFirst bool   // nulls sort first for in_range?
	Winref            uint32 // ID referenced by window functions
	Copiedorder       bool   // did we copy orderClause from refname?
}

WindowClause represents a WINDOW clause entry.

func (*WindowClause) Tag

func (n *WindowClause) Tag() NodeTag

type WindowDef

type WindowDef struct {
	Name            string // window name (NULL in OVER clause)
	Refname         string // referenced window name, if any
	PartitionClause *List  // PARTITION BY expressions
	OrderClause     *List  // ORDER BY (SortBy)
	FrameOptions    int    // frame_clause options, see WindowDef comments
	StartOffset     Node   // expression for starting bound, if any
	EndOffset       Node   // expression for ending bound, if any
	Loc             Loc    // parse location, or -1 if none/unknown
}

WindowDef represents WINDOW clause definition.

func (*WindowDef) Tag

func (n *WindowDef) Tag() NodeTag

type WithClause

type WithClause struct {
	Ctes      *List // list of CommonTableExprs
	Recursive bool  // true = WITH RECURSIVE
	Loc       Loc
}

WithClause represents WITH clause (common table expressions).

func (*WithClause) Tag

func (n *WithClause) Tag() NodeTag

type XmlExpr

type XmlExpr struct {
	Op        XmlExprOp     // xml function ID
	Name      string        // name in xml(NAME foo ...) syntaxes
	NamedArgs *List         // non-XML expressions for xml_attributes
	ArgNames  *List         // parallel list of String values
	Args      *List         // list of expressions
	Xmloption XmlOptionType // DOCUMENT or CONTENT
	Indent    bool          // INDENT option for XMLSERIALIZE
	Type      Oid           // target type for XMLSERIALIZE
	Typmod    int32         // target typmod for XMLSERIALIZE
	Loc       Loc           // token location, or -1
}

XmlExpr represents various SQL/XML functions requiring special grammar.

func (*XmlExpr) Tag

func (n *XmlExpr) Tag() NodeTag

type XmlExprOp

type XmlExprOp int

XmlExprOp represents the type of XML expression.

const (
	IS_XMLCONCAT    XmlExprOp = iota // XMLCONCAT(args)
	IS_XMLELEMENT                    // XMLELEMENT(name, xml_attributes, args)
	IS_XMLFOREST                     // XMLFOREST(xml_attributes)
	IS_XMLPARSE                      // XMLPARSE(text, is_doc, preserve_ws)
	IS_XMLPI                         // XMLPI(name [, args])
	IS_XMLROOT                       // XMLROOT(xml, version, standalone)
	IS_XMLSERIALIZE                  // XMLSERIALIZE(is_document, xmlval, indent)
	IS_DOCUMENT                      // xmlval IS DOCUMENT
)

type XmlOptionType

type XmlOptionType int

XmlOptionType for DOCUMENT or CONTENT

const (
	XMLOPTION_DOCUMENT XmlOptionType = iota
	XMLOPTION_CONTENT
)

type XmlSerialize

type XmlSerialize struct {
	Xmloption XmlOptionType // DOCUMENT or CONTENT
	Expr      Node          // the XML expression
	TypeName  *TypeName     // target type name
	Indent    bool          // INDENT option
	Loc       Loc           // token location, or -1
}

XmlSerialize represents XMLSERIALIZE(DOCUMENT|CONTENT expr AS typename).

func (*XmlSerialize) Tag

func (n *XmlSerialize) Tag() NodeTag

Directories

Path Synopsis
cmd
genwalker command
Command genwalker generates walk_generated.go from parsenodes.go.
Command genwalker generates walk_generated.go from parsenodes.go.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL