tree

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 67 Imported by: 27

Documentation

Overview

Code generated by eval_gen.go. DO NOT EDIT. Regenerate this file with either of the following commands:

./dev generate go
go generate ./pkg/sql/sem/tree

If you use the dev command and you have added a new tree expression, like tree.XYZ in a new file, you may get the confusing error: undefined: XYZ. Run './dev generate bazel' to fix this.

Code generated by eval_gen.go. DO NOT EDIT. Regenerate this file with either of the following commands:

./dev generate go
go generate ./pkg/sql/sem/tree

If you use the dev command and you have added a new tree expression, like tree.XYZ in a new file, you may get the confusing error: undefined: XYZ. Run './dev generate bazel' to fix this.

Index

Constants

View Source
const (
	SeqOptAs        = "AS"
	SeqOptCycle     = "CYCLE"
	SeqOptNoCycle   = "NO CYCLE"
	SeqOptOwnedBy   = "OWNED BY"
	SeqOptCache     = "CACHE"
	SeqOptIncrement = "INCREMENT"
	SeqOptMinValue  = "MINVALUE"
	SeqOptMaxValue  = "MAXVALUE"
	SeqOptStart     = "START"
	SeqOptRestart   = "RESTART"
	SeqOptVirtual   = "VIRTUAL"
)

Names of options on CREATE SEQUENCE.

View Source
const (
	DistinctFuncType funcType
	AllFuncType
)

FuncExpr.Type

View Source
const (
	CastExplicit castSyntaxMode = iota
	CastShort
	CastPrepend
)

These constants separate the syntax X::Y from CAST(X AS Y).

View Source
const (
	AnnotateExplicit annotateSyntaxMode = iota
	AnnotateShort
)

These constants separate the syntax X:::Y from ANNOTATE_TYPE(X, Y)

View Source
const (
	// FmtSimple instructs the pretty-printer to produce
	// a straightforward representation.
	FmtSimple FmtFlags = 0

	// FmtBareStrings instructs the pretty-printer to print strings and
	// other values without wrapping quotes. If the value is a SQL
	// string, the quotes will only be omitted if the string contains no
	// special characters. If it does contain special characters, the
	// string will be escaped and enclosed in e'...' regardless of
	// whether FmtBareStrings is specified. See FmtRawStrings below for
	// an alternative.
	FmtBareStrings = FmtFlags(lexbase.EncBareStrings)

	// FmtBareIdentifiers instructs the pretty-printer to print
	// identifiers without wrapping quotes in any case.
	FmtBareIdentifiers = FmtFlags(lexbase.EncBareIdentifiers)

	// FmtShowPasswords instructs the pretty-printer to not suppress passwords.
	// If not set, passwords are replaced by *****.
	FmtShowPasswords = FmtFlags(lexbase.EncFirstFreeFlagBit) << iota

	// FmtShowTypes instructs the pretty-printer to
	// annotate expressions with their resolved types.
	FmtShowTypes

	// FmtHideConstants instructs the pretty-printer to produce a
	// representation that does not disclose query-specific data. It
	// also shorten long lists in tuples, VALUES and array expressions.
	FmtHideConstants

	// FmtAnonymize instructs the pretty-printer to remove any name.
	FmtAnonymize

	// FmtAlwaysQualifyTableNames instructs the pretty-printer to
	// qualify table names, even if originally omitted.
	// Requires Annotations in the formatting context.
	FmtAlwaysQualifyTableNames

	// FmtAlwaysGroupExprs instructs the pretty-printer to enclose
	// sub-expressions between parentheses.
	// Used for testing.
	FmtAlwaysGroupExprs

	// FmtShowTableAliases reveals the table aliases.
	FmtShowTableAliases

	// FmtSymbolicSubqueries indicates that subqueries must be pretty-printed
	// using numeric notation (@S123).
	FmtSymbolicSubqueries

	// FmtParsableNumerics produces decimal and float representations
	// that are always parsable, even if they require a string
	// representation like -Inf. Negative values are preserved "inside"
	// the numeric by enclosing them within parentheses.
	FmtParsableNumerics

	// FmtPGCatalog is used to produce expressions formatted in a way that's as
	// close as possible to what clients expect to live in pg_catalog (e.g.
	// pg_attrdef.adbin, pg_constraint.condef and pg_indexes.indexdef columns).
	// Specifically, this strips type annotations (Postgres doesn't know what
	// those are), adds cast expressions for non-numeric constants, and formats
	// indexes in Postgres-specific syntax.
	FmtPGCatalog

	// FmtMarkRedactionNode instructs the pretty printer to redact datums,
	// constants, and simple names (i.e. Name, UnrestrictedName) from statements.
	FmtMarkRedactionNode

	// FmtSummary instructs the pretty printer to produced a summarized version
	// of the query, to pass to the frontend.
	//
	// Here are the following formats we support:
	// SELECT: SELECT {columns} FROM {tables}
	// - Show columns up to 15 characters.
	// - Show tables up to 30 characters.
	// - Hide column names in nested select queries.
	// INSERT/UPSERT: INSERT/UPSERT INTO {table} {columns}
	// - Show table up to 30 characters.
	// - Show columns up to 15 characters.
	// INSERT SELECT: INSERT INTO {table} SELECT {columns} FROM {table}
	// - Show table up to 30 characters.
	// - Show columns up to 15 characters.
	// UPDATE: UPDATE {table} SET {columns} WHERE {condition}
	// - Show table up to 30 characters.
	// - Show columns up to 15 characters.
	// - Show condition up to 15 characters.
	FmtSummary

	// FmtOmitNameRedaction instructs the pretty printer to omit redaction
	// for simple names (i.e. Name, UnrestrictedName) from statements.
	// This flag *overrides* `FmtMarkRedactionNode` above.
	FmtOmitNameRedaction

	// FmtTagDollarQuotes instructs tags to be kept intact in tagged dollar
	// quotes. It also applies tags when formatting UDFs.
	FmtTagDollarQuotes
)

Basic bit definitions for the FmtFlags bitmask.

View Source
const (
	// FmtPgwireText instructs the pretty-printer to use
	// a pg-compatible conversion to strings. See comments
	// in pgwire_encode.go.
	FmtPgwireText = fmtPgwireFormat | FmtFlags(lexbase.EncBareStrings)

	// FmtParsable instructs the pretty-printer to produce a representation that
	// can be parsed into an equivalent expression. If there is a chance that the
	// formatted data will be stored durably on disk or sent to other nodes,
	// then this formatting directive is not appropriate, and FmtSerializable
	// should be used instead.
	FmtParsable = fmtDisambiguateDatumTypes | FmtParsableNumerics

	// FmtSerializable instructs the pretty-printer to produce a representation
	// for expressions that can be serialized to disk. It serializes user defined
	// types using representations that are stable across changes of the type
	// itself. This should be used when serializing expressions that will be
	// stored on disk, like DEFAULT expressions of columns.
	FmtSerializable = FmtParsable | fmtStaticallyFormatUserDefinedTypes

	// FmtCheckEquivalence instructs the pretty-printer to produce a representation
	// that can be used to check equivalence of expressions. Specifically:
	//  - IndexedVars are formatted using symbolic notation (to disambiguate
	//    columns).
	//  - datum types are disambiguated with explicit type
	//    annotations. This is necessary because datums of different types
	//    can otherwise be formatted to the same string: (for example the
	//    DDecimal 1 and the DInt 1).
	//  - user defined types and datums of user defined types are formatted
	//    using static representations to avoid name resolution and invalidation
	//    due to changes in the underlying type.
	FmtCheckEquivalence = fmtSymbolicVars |
		fmtDisambiguateDatumTypes |
		FmtParsableNumerics |
		fmtStaticallyFormatUserDefinedTypes

	// FmtArrayToString is a special composite flag suitable
	// for the output of array_to_string(). This de-quotes
	// the strings enclosed in the array and skips the normal escaping
	// of strings. Special characters are hex-escaped.
	FmtArrayToString = FmtBareStrings | fmtRawStrings

	// FmtExport, if set, formats datums in a raw form suitable for
	// EXPORT, e.g. suitable for output into a CSV file. The intended
	// goal for this flag is to ensure values can be read back using the
	// ParseDatumStringAs() / ParseStringas() functions (IMPORT).
	//
	// We do not use FmtParsable for this purpose because FmtParsable
	// intends to preserve all the information useful to CockroachDB
	// internally, at the expense of readability by 3rd party tools.
	//
	// We also separate this set of flag from fmtArrayToString
	// because the behavior of array_to_string() is fixed for compatibility
	// with PostgreSQL, whereas EXPORT may evolve over time to support
	// other things (eg. fixing #33429).
	FmtExport = FmtBareStrings | fmtRawStrings
)

Composite/derived flag definitions follow.

View Source
const (
	PGTimeFormat              = "15:04:05.999999"
	PGDateFormat              = "2006-01-02"
	PGTimeStampFormatNoOffset = PGDateFormat + " " + PGTimeFormat
	PGTimeStampFormat         = PGTimeStampFormatNoOffset + "-07"
	PGTime2400Format          = "24:00:00"
	PGTimeTZFormat            = PGTimeFormat + "-07"
)

This block contains all available PG time formats.

View Source
const (
	// PrettyNoAlign disables alignment.
	PrettyNoAlign PrettyAlignMode = 0
	// PrettyAlignOnly aligns sub-clauses only and preserves the
	// hierarchy of logical operators.
	PrettyAlignOnly = 1
	// PrettyAlignAndDeindent does the work of PrettyAlignOnly and also
	// de-indents AND and OR operators.
	PrettyAlignAndDeindent = 2
	// PrettyAlignAndExtraIndent does the work of PrettyAlignOnly and
	// also extra indents the operands of AND and OR operators so
	// that they appear aligned but also indented.
	PrettyAlignAndExtraIndent = 3
)
View Source
const (
	// DefaultLineWidth is the line width used with the default pretty-printing configuration.
	DefaultLineWidth = 60
	// ConsoleLineWidth is the line width used on the frontend console.
	ConsoleLineWidth = 108
)
View Source
const (
	// RegionEnum is the name of the per-database region enum required for
	// multi-region.
	RegionEnum string = "crdb_internal_region"
	// RegionalByRowRegionDefaultCol is the default name of the REGIONAL BY ROW
	// column name if the AS field is not populated.
	RegionalByRowRegionDefaultCol string = "crdb_region"
	// RegionalByRowRegionDefaultColName is the same, typed as Name.
	RegionalByRowRegionDefaultColName Name = Name(RegionalByRowRegionDefaultCol)
	// RegionalByRowRegionNotSpecifiedName is the string denoting the REGIONAL BY ROW
	// has no AS <col> specified.
	// TODO(#59455): clean this up to use something nicer.
	RegionalByRowRegionNotSpecifiedName = ""
	// PrimaryRegionNotSpecifiedName is the string denoting the lack of primary region in the
	// locality config.
	// TODO(#59455): clean this up to use something nicer.
	PrimaryRegionNotSpecifiedName Name = ""
	// SecondaryRegionNotSpecifiedName is the string denoting the lack of secondary region
	//in the locality config.
	// TODO(#59455): clean this up to use something nicer.
	SecondaryRegionNotSpecifiedName Name = ""
)
View Source
const (
	// ScrubTable describes the SCRUB operation SCRUB TABLE.
	ScrubTable = iota
	// ScrubDatabase describes the SCRUB operation SCRUB DATABASE.
	ScrubDatabase = iota
)
View Source
const (
	AstFull  = "FULL"
	AstLeft  = "LEFT"
	AstRight = "RIGHT"
	AstCross = "CROSS"
	AstInner = "INNER"
)

JoinTableExpr.Join

View Source
const (
	AstHash     = "HASH"
	AstLookup   = "LOOKUP"
	AstMerge    = "MERGE"
	AstInverted = "INVERTED"
)

JoinTableExpr.Hint

View Source
const (
	AstWhere  = "WHERE"
	AstHaving = "HAVING"
)

Where.Type

View Source
const (
	AlterTableTag          = "ALTER TABLE"
	BackupTag              = "BACKUP"
	CreateIndexTag         = "CREATE INDEX"
	CreateFunctionTag      = "CREATE FUNCTION"
	CreateProcedureTag     = "CREATE PROCEDURE"
	CreateSchemaTag        = "CREATE SCHEMA"
	CreateSequenceTag      = "CREATE SEQUENCE"
	CommentOnColumnTag     = "COMMENT ON COLUMN"
	CommentOnConstraintTag = "COMMENT ON CONSTRAINT"
	CommentOnDatabaseTag   = "COMMENT ON DATABASE"
	CommentOnIndexTag      = "COMMENT ON INDEX"
	CommentOnSchemaTag     = "COMMENT ON SCHEMA"
	CommentOnTableTag      = "COMMENT ON TABLE"
	DropDatabaseTag        = "DROP DATABASE"
	DropFunctionTag        = "DROP FUNCTION"
	DropProcedureTag       = "DROP PROCEDURE"
	DropIndexTag           = "DROP INDEX"
	DropOwnedByTag         = "DROP OWNED BY"
	DropSchemaTag          = "DROP SCHEMA"
	DropSequenceTag        = "DROP SEQUENCE"
	DropTableTag           = "DROP TABLE"
	DropTypeTag            = "DROP TYPE"
	DropViewTag            = "DROP VIEW"
	ImportTag              = "IMPORT"
	RestoreTag             = "RESTORE"
)
View Source
const ColumnLimit = 15

ColumnLimit is the max character limit for columns in summarized queries

View Source
const LikeTableOptAll = ^likeTableOptInvalid

LikeTableOptAll is the full LikeTableOpt bitmap.

View Source
const MaxPlaceholderIdx = math.MaxUint16

MaxPlaceholderIdx is the maximum allowed value of a PlaceholderIdx. The pgwire protocol is limited to 2^16 placeholders, so we limit the IDs to this range as well.

View Source
const NoColumnIdx = -1

NoColumnIdx is a special value that can be used as a "column index" to indicate that the column is not present.

View Source
const PasswordSubstitution = "'*****'"

PasswordSubstitution is the string that replaces passwords unless FmtShowPasswords is specified.

View Source
const TableLimit = 30

TableLimit is the max character limit for tables in summarized queries

View Source
const ZeroOidValue = "-"

ZeroOidValue represents the 0 oid value as '-', which matches the Postgres representation.

Variables

View Source
var (

	// NumValAvailInteger is the set of available integer types.
	NumValAvailInteger = append(intLikeTypes, decimalLikeTypes...)
	// NumValAvailIntegerNoOid is the set of available integer types except for OID.
	NumValAvailIntegerNoOid = append([]*types.T{types.Int}, decimalLikeTypes...)
	// NumValAvailDecimalNoFraction is the set of available integral numeric types.
	NumValAvailDecimalNoFraction = append(decimalLikeTypes, intLikeTypes...)
	// NumValAvailDecimalNoFractionNoOid is the set of available integral numeric types except for OID.
	NumValAvailDecimalNoFractionNoOid = append(decimalLikeTypes, types.Int)
	// NumValAvailDecimalWithFraction is the set of available fractional numeric types.
	NumValAvailDecimalWithFraction = decimalLikeTypes
)
View Source
var (

	// DBoolTrue is a pointer to the DBool(true) value and can be used in
	// comparisons against Datum types.
	DBoolTrue = &constDBoolTrue
	// DBoolFalse is a pointer to the DBool(false) value and can be used in
	// comparisons against Datum types.
	DBoolFalse = &constDBoolFalse

	// DNull is the NULL Datum.
	DNull Datum = dNull{}

	// DZero is the zero-valued integer Datum.
	DZero = NewDInt(0)

	// DTimeMaxTimeRegex is a compiled regex for parsing the 24:00 time value.
	DTimeMaxTimeRegex = regexp.MustCompile(`^([0-9-]*(\s|T))?\s*24:00(:00(.0+)?)?\s*$`)

	// MaxSupportedTime is the maximum time we support parsing.
	MaxSupportedTime = timeutil.Unix(9224318016000-1, 999999000) // 294276-12-31 23:59:59.999999
	// MinSupportedTime is the minimum time we support parsing.
	MinSupportedTime = timeutil.Unix(-210866803200, 0) // 4714-11-24 00:00:00+00 BC
)
View Source
var (
	// DZeroFloat is the DFloat for zero.
	DZeroFloat = NewDFloat(0)
	// DPosInfFloat is the DFloat for positive infinity.
	DPosInfFloat = NewDFloat(DFloat(math.Inf(+1)))
	// DNegInfFloat is the DFloat for negative infinity.
	DNegInfFloat = NewDFloat(DFloat(math.Inf(-1)))
	// DNaNFloat is the DFloat for NaN.
	DNaNFloat = NewDFloat(DFloat(math.NaN()))
)
View Source
var (

	// DMinTimeTZ is the min TimeTZ.
	DMinTimeTZ = NewDTimeTZFromOffset(timeofday.Min, timetz.MinTimeTZOffsetSecs)
	// DMaxTimeTZ is the max TimeTZ.
	DMaxTimeTZ = NewDTimeTZFromOffset(timeofday.Max, timetz.MaxTimeTZOffsetSecs)
)
View Source
var (
	// DecimalCtx is the default context for decimal operations. Any change
	// in the exponent limits must still guarantee a safe conversion to the
	// postgres binary decimal format in the wire protocol, which uses an
	// int16. See pgwire/types.go.
	DecimalCtx = &apd.Context{
		Precision:   20,
		Rounding:    apd.RoundHalfUp,
		MaxExponent: 2000,
		MinExponent: -2000,

		Traps: apd.DefaultTraps &^ apd.InvalidOperation,
	}
	// ExactCtx is a decimal context with exact precision.
	ExactCtx = DecimalCtx.WithPrecision(0)
	// HighPrecisionCtx is a decimal context with high precision.
	HighPrecisionCtx = DecimalCtx.WithPrecision(2000)
	// IntermediateCtx is a decimal context with additional precision for
	// intermediate calculations to protect against order changes that can
	// happen in dist SQL. The additional 5 allows the stress test to pass.
	// See #13689 for more analysis and other algorithms.
	IntermediateCtx = DecimalCtx.WithPrecision(DecimalCtx.Precision + 5)
	// RoundCtx is a decimal context with high precision and RoundHalfEven
	// rounding.
	RoundCtx = func() *apd.Context {
		ctx := *HighPrecisionCtx
		ctx.Rounding = apd.RoundHalfEven
		return &ctx
	}()
)
View Source
var (
	// ErrIntOutOfRange is reported when integer arithmetic overflows.
	ErrIntOutOfRange = pgerror.New(pgcode.NumericValueOutOfRange, "integer out of range")
	// ErrInt4OutOfRange is reported when casting to INT4 overflows.
	ErrInt4OutOfRange = pgerror.New(pgcode.NumericValueOutOfRange, "integer out of range for type int4")
	// ErrInt2OutOfRange is reported when casting to INT2 overflows.
	ErrInt2OutOfRange = pgerror.New(pgcode.NumericValueOutOfRange, "integer out of range for type int2")
	// ErrFloatOutOfRange is reported when float arithmetic overflows.
	ErrFloatOutOfRange = pgerror.New(pgcode.NumericValueOutOfRange, "float out of range")
	// ErrDecOutOfRange is reported when decimal arithmetic overflows.
	ErrDecOutOfRange = pgerror.New(pgcode.NumericValueOutOfRange, "decimal out of range")
	// ErrCharOutOfRange is reported when int cast to ASCII byte overflows.
	ErrCharOutOfRange = pgerror.New(pgcode.NumericValueOutOfRange, "\"char\" out of range")

	// ErrDivByZero is reported on a division by zero.
	ErrDivByZero = pgerror.New(pgcode.DivisionByZero, "division by zero")
	// ErrSqrtOfNegNumber is reported when taking the sqrt of a negative number.
	ErrSqrtOfNegNumber = pgerror.New(pgcode.InvalidArgumentForPowerFunction, "cannot take square root of a negative number")

	// ErrShiftArgOutOfRange is reported when a shift argument is out of range.
	ErrShiftArgOutOfRange = pgerror.New(pgcode.InvalidParameterValue, "shift argument out of range")
)
View Source
var (
	OnTypeCheckArraySubscript   func()
	OnTypeCheckJSONBSubscript   func()
	OnTypeCheckIfErr            func()
	OnTypeCheckArrayConstructor func()
	OnTypeCheckArrayFlatten     func()
)

OnTypeCheck* functions are hooks which get called if not nil and the type checking of the relevant function is made.

View Source
var AbsentReturningClause = &NoReturningClause{}

AbsentReturningClause is a ReturningClause variant representing the absence of a RETURNING clause.

View Source
var BinOps = map[treebin.BinaryOperatorSymbol]*BinOpOverloads{
	treebin.Bitand: {
		// contains filtered or unexported fields
	},

	treebin.Bitor: {
		// contains filtered or unexported fields
	},

	treebin.Bitxor: {
		// contains filtered or unexported fields
	},

	treebin.Plus: {
		// contains filtered or unexported fields
	},

	treebin.Minus: {
		// contains filtered or unexported fields
	},

	treebin.Mult: {
		// contains filtered or unexported fields
	},

	treebin.Div: {
		// contains filtered or unexported fields
	},

	treebin.FloorDiv: {
		// contains filtered or unexported fields
	},

	treebin.Mod: {
		// contains filtered or unexported fields
	},

	treebin.Concat: {
		// contains filtered or unexported fields
	},

	treebin.LShift: {
		// contains filtered or unexported fields
	},

	treebin.RShift: {
		// contains filtered or unexported fields
	},

	treebin.Pow: {
		// contains filtered or unexported fields
	},

	treebin.JSONFetchVal: {
		// contains filtered or unexported fields
	},

	treebin.JSONFetchValPath: {
		// contains filtered or unexported fields
	},

	treebin.JSONFetchText: {
		// contains filtered or unexported fields
	},

	treebin.JSONFetchTextPath: {
		// contains filtered or unexported fields
	},
}

BinOps contains the binary operations indexed by operation type.

View Source
var CmpOps = cmpOpFixups(map[treecmp.ComparisonOperatorSymbol]*CmpOpOverloads{
	treecmp.EQ: {overloads: []*CmpOp{

		makeEqFn(types.AnyEnum, types.AnyEnum, volatility.Immutable),
		makeEqFn(types.Bool, types.Bool, volatility.Leakproof),
		makeEqFn(types.Bytes, types.Bytes, volatility.Leakproof),
		makeEqFn(types.Date, types.Date, volatility.Leakproof),
		makeEqFn(types.Decimal, types.Decimal, volatility.Immutable),

		makeEqFn(types.AnyCollatedString, types.AnyCollatedString, volatility.Leakproof),
		makeEqFn(types.Float, types.Float, volatility.Leakproof),
		makeEqFn(types.Box2D, types.Box2D, volatility.Leakproof),
		makeEqFn(types.Geography, types.Geography, volatility.Leakproof),
		makeEqFn(types.Geometry, types.Geometry, volatility.Leakproof),
		makeEqFn(types.INet, types.INet, volatility.Leakproof),
		makeEqFn(types.Int, types.Int, volatility.Leakproof),
		makeEqFn(types.Interval, types.Interval, volatility.Leakproof),
		makeEqFn(types.Jsonb, types.Jsonb, volatility.Immutable),
		makeEqFn(types.Oid, types.Oid, volatility.Leakproof),
		makeEqFn(types.PGLSN, types.PGLSN, volatility.Leakproof),
		makeEqFn(types.RefCursor, types.RefCursor, volatility.Leakproof),
		makeEqFn(types.String, types.String, volatility.Leakproof),
		makeEqFn(types.Time, types.Time, volatility.Leakproof),
		makeEqFn(types.TimeTZ, types.TimeTZ, volatility.Leakproof),
		makeEqFn(types.Timestamp, types.Timestamp, volatility.Leakproof),
		makeEqFn(types.TimestampTZ, types.TimestampTZ, volatility.Leakproof),
		makeEqFn(types.TSQuery, types.TSQuery, volatility.Immutable),
		makeEqFn(types.TSVector, types.TSVector, volatility.Immutable),
		makeEqFn(types.Uuid, types.Uuid, volatility.Leakproof),
		makeEqFn(types.VarBit, types.VarBit, volatility.Leakproof),

		makeEqFn(types.Date, types.Timestamp, volatility.Immutable),
		makeEqFn(types.Date, types.TimestampTZ, volatility.Stable),
		makeEqFn(types.Decimal, types.Float, volatility.Leakproof),
		makeEqFn(types.Decimal, types.Int, volatility.Leakproof),
		makeEqFn(types.Float, types.Decimal, volatility.Leakproof),
		makeEqFn(types.Float, types.Int, volatility.Leakproof),
		makeEqFn(types.Int, types.Decimal, volatility.Leakproof),
		makeEqFn(types.Int, types.Float, volatility.Leakproof),
		makeEqFn(types.Int, types.Oid, volatility.Leakproof),
		makeEqFn(types.Oid, types.Int, volatility.Leakproof),
		makeEqFn(types.Timestamp, types.Date, volatility.Immutable),
		makeEqFn(types.Timestamp, types.TimestampTZ, volatility.Stable),
		makeEqFn(types.TimestampTZ, types.Date, volatility.Stable),
		makeEqFn(types.TimestampTZ, types.Timestamp, volatility.Stable),
		makeEqFn(types.Time, types.TimeTZ, volatility.Stable),
		makeEqFn(types.TimeTZ, types.Time, volatility.Stable),

		{
			LeftType:  types.AnyTuple,
			RightType: types.AnyTuple,
			EvalOp: &CompareTupleOp{
				ComparisonOperator: treecmp.MakeComparisonOperator(treecmp.EQ),
			},
			Volatility: volatility.Immutable,
		},
	}},

	treecmp.LT: {overloads: []*CmpOp{

		makeLtFn(types.AnyEnum, types.AnyEnum, volatility.Immutable),
		makeLtFn(types.Bool, types.Bool, volatility.Leakproof),
		makeLtFn(types.Bytes, types.Bytes, volatility.Leakproof),
		makeLtFn(types.Date, types.Date, volatility.Leakproof),
		makeLtFn(types.Decimal, types.Decimal, volatility.Immutable),

		makeLtFn(types.AnyCollatedString, types.AnyCollatedString, volatility.Leakproof),
		makeLtFn(types.Float, types.Float, volatility.Leakproof),
		makeLtFn(types.Box2D, types.Box2D, volatility.Leakproof),
		makeLtFn(types.Geography, types.Geography, volatility.Leakproof),
		makeLtFn(types.Geometry, types.Geometry, volatility.Leakproof),
		makeLtFn(types.INet, types.INet, volatility.Leakproof),
		makeLtFn(types.Int, types.Int, volatility.Leakproof),
		makeLtFn(types.Interval, types.Interval, volatility.Leakproof),
		makeLtFn(types.Oid, types.Oid, volatility.Leakproof),
		makeLtFn(types.PGLSN, types.PGLSN, volatility.Leakproof),
		makeLtFn(types.RefCursor, types.RefCursor, volatility.Leakproof),
		makeLtFn(types.String, types.String, volatility.Leakproof),
		makeLtFn(types.Time, types.Time, volatility.Leakproof),
		makeLtFn(types.TimeTZ, types.TimeTZ, volatility.Leakproof),
		makeLtFn(types.Timestamp, types.Timestamp, volatility.Leakproof),
		makeLtFn(types.TimestampTZ, types.TimestampTZ, volatility.Leakproof),
		makeLtFn(types.Uuid, types.Uuid, volatility.Leakproof),
		makeLtFn(types.VarBit, types.VarBit, volatility.Leakproof),
		makeLtFn(types.Jsonb, types.Jsonb, volatility.Immutable),

		makeLtFn(types.Date, types.Timestamp, volatility.Immutable),
		makeLtFn(types.Date, types.TimestampTZ, volatility.Stable),
		makeLtFn(types.Decimal, types.Float, volatility.Leakproof),
		makeLtFn(types.Decimal, types.Int, volatility.Leakproof),
		makeLtFn(types.Float, types.Decimal, volatility.Leakproof),
		makeLtFn(types.Float, types.Int, volatility.Leakproof),
		makeLtFn(types.Int, types.Decimal, volatility.Leakproof),
		makeLtFn(types.Int, types.Float, volatility.Leakproof),
		makeLtFn(types.Int, types.Oid, volatility.Leakproof),
		makeLtFn(types.Oid, types.Int, volatility.Leakproof),
		makeLtFn(types.Timestamp, types.Date, volatility.Immutable),
		makeLtFn(types.Timestamp, types.TimestampTZ, volatility.Stable),
		makeLtFn(types.TimestampTZ, types.Date, volatility.Stable),
		makeLtFn(types.TimestampTZ, types.Timestamp, volatility.Stable),
		makeLtFn(types.Time, types.TimeTZ, volatility.Stable),
		makeLtFn(types.TimeTZ, types.Time, volatility.Stable),

		{
			LeftType:  types.AnyTuple,
			RightType: types.AnyTuple,
			EvalOp: &CompareTupleOp{
				ComparisonOperator: treecmp.MakeComparisonOperator(treecmp.LT),
			},
			Volatility: volatility.Immutable,
		},
	}},

	treecmp.LE: {overloads: []*CmpOp{

		makeLeFn(types.AnyEnum, types.AnyEnum, volatility.Immutable),
		makeLeFn(types.Bool, types.Bool, volatility.Leakproof),
		makeLeFn(types.Bytes, types.Bytes, volatility.Leakproof),
		makeLeFn(types.Date, types.Date, volatility.Leakproof),
		makeLeFn(types.Decimal, types.Decimal, volatility.Immutable),

		makeLeFn(types.AnyCollatedString, types.AnyCollatedString, volatility.Leakproof),
		makeLeFn(types.Float, types.Float, volatility.Leakproof),
		makeLeFn(types.Box2D, types.Box2D, volatility.Leakproof),
		makeLeFn(types.Geography, types.Geography, volatility.Leakproof),
		makeLeFn(types.Geometry, types.Geometry, volatility.Leakproof),
		makeLeFn(types.INet, types.INet, volatility.Leakproof),
		makeLeFn(types.Int, types.Int, volatility.Leakproof),
		makeLeFn(types.Interval, types.Interval, volatility.Leakproof),
		makeLeFn(types.Oid, types.Oid, volatility.Leakproof),
		makeLeFn(types.PGLSN, types.PGLSN, volatility.Leakproof),
		makeLeFn(types.RefCursor, types.RefCursor, volatility.Leakproof),
		makeLeFn(types.String, types.String, volatility.Leakproof),
		makeLeFn(types.Time, types.Time, volatility.Leakproof),
		makeLeFn(types.TimeTZ, types.TimeTZ, volatility.Leakproof),
		makeLeFn(types.Timestamp, types.Timestamp, volatility.Leakproof),
		makeLeFn(types.TimestampTZ, types.TimestampTZ, volatility.Leakproof),
		makeLeFn(types.Uuid, types.Uuid, volatility.Leakproof),
		makeLeFn(types.VarBit, types.VarBit, volatility.Leakproof),
		makeLeFn(types.Jsonb, types.Jsonb, volatility.Immutable),

		makeLeFn(types.Date, types.Timestamp, volatility.Immutable),
		makeLeFn(types.Date, types.TimestampTZ, volatility.Stable),
		makeLeFn(types.Decimal, types.Float, volatility.Leakproof),
		makeLeFn(types.Decimal, types.Int, volatility.Leakproof),
		makeLeFn(types.Float, types.Decimal, volatility.Leakproof),
		makeLeFn(types.Float, types.Int, volatility.Leakproof),
		makeLeFn(types.Int, types.Decimal, volatility.Leakproof),
		makeLeFn(types.Int, types.Float, volatility.Leakproof),
		makeLeFn(types.Int, types.Oid, volatility.Leakproof),
		makeLeFn(types.Oid, types.Int, volatility.Leakproof),
		makeLeFn(types.Timestamp, types.Date, volatility.Immutable),
		makeLeFn(types.Timestamp, types.TimestampTZ, volatility.Stable),
		makeLeFn(types.TimestampTZ, types.Date, volatility.Stable),
		makeLeFn(types.TimestampTZ, types.Timestamp, volatility.Stable),
		makeLeFn(types.Time, types.TimeTZ, volatility.Stable),
		makeLeFn(types.TimeTZ, types.Time, volatility.Stable),

		{
			LeftType:  types.AnyTuple,
			RightType: types.AnyTuple,
			EvalOp: &CompareTupleOp{
				ComparisonOperator: treecmp.MakeComparisonOperator(treecmp.LE),
			},
			Volatility: volatility.Immutable,
		},
	}},

	treecmp.IsNotDistinctFrom: {overloads: []*CmpOp{
		{
			LeftType:  types.Unknown,
			RightType: types.Unknown,
			EvalOp: &CompareScalarOp{
				ComparisonOperator: treecmp.MakeComparisonOperator(treecmp.IsNotDistinctFrom),
			},
			CalledOnNullInput: true,

			PreferredOverload: true,
			Volatility:        volatility.Leakproof,
		},
		{
			LeftType:  types.AnyArray,
			RightType: types.Unknown,
			EvalOp: &CompareScalarOp{
				ComparisonOperator: treecmp.MakeComparisonOperator(treecmp.IsNotDistinctFrom),
			},
			CalledOnNullInput: true,
			Volatility:        volatility.Leakproof,
		},

		makeIsFn(types.AnyEnum, types.AnyEnum, volatility.Immutable),
		makeIsFn(types.Bool, types.Bool, volatility.Leakproof),
		makeIsFn(types.Bytes, types.Bytes, volatility.Leakproof),
		makeIsFn(types.Date, types.Date, volatility.Leakproof),
		makeIsFn(types.Decimal, types.Decimal, volatility.Immutable),

		makeIsFn(types.AnyCollatedString, types.AnyCollatedString, volatility.Leakproof),
		makeIsFn(types.Float, types.Float, volatility.Leakproof),
		makeIsFn(types.Box2D, types.Box2D, volatility.Leakproof),
		makeIsFn(types.Geography, types.Geography, volatility.Leakproof),
		makeIsFn(types.Geometry, types.Geometry, volatility.Leakproof),
		makeIsFn(types.INet, types.INet, volatility.Leakproof),
		makeIsFn(types.Int, types.Int, volatility.Leakproof),
		makeIsFn(types.Interval, types.Interval, volatility.Leakproof),
		makeIsFn(types.Jsonb, types.Jsonb, volatility.Immutable),
		makeIsFn(types.Oid, types.Oid, volatility.Leakproof),
		makeIsFn(types.PGLSN, types.PGLSN, volatility.Leakproof),
		makeIsFn(types.RefCursor, types.RefCursor, volatility.Leakproof),
		makeIsFn(types.String, types.String, volatility.Leakproof),
		makeIsFn(types.Time, types.Time, volatility.Leakproof),
		makeIsFn(types.TimeTZ, types.TimeTZ, volatility.Leakproof),
		makeIsFn(types.Timestamp, types.Timestamp, volatility.Leakproof),
		makeIsFn(types.TimestampTZ, types.TimestampTZ, volatility.Leakproof),
		makeIsFn(types.TSQuery, types.TSQuery, volatility.Immutable),
		makeIsFn(types.TSVector, types.TSVector, volatility.Immutable),
		makeIsFn(types.Uuid, types.Uuid, volatility.Leakproof),
		makeIsFn(types.VarBit, types.VarBit, volatility.Leakproof),

		makeIsFn(types.Date, types.Timestamp, volatility.Immutable),
		makeIsFn(types.Date, types.TimestampTZ, volatility.Stable),
		makeIsFn(types.Decimal, types.Float, volatility.Leakproof),
		makeIsFn(types.Decimal, types.Int, volatility.Leakproof),
		makeIsFn(types.Float, types.Decimal, volatility.Leakproof),
		makeIsFn(types.Float, types.Int, volatility.Leakproof),
		makeIsFn(types.Int, types.Decimal, volatility.Leakproof),
		makeIsFn(types.Int, types.Float, volatility.Leakproof),
		makeIsFn(types.Int, types.Oid, volatility.Leakproof),
		makeIsFn(types.Oid, types.Int, volatility.Leakproof),
		makeIsFn(types.Timestamp, types.Date, volatility.Immutable),
		makeIsFn(types.Timestamp, types.TimestampTZ, volatility.Stable),
		makeIsFn(types.TimestampTZ, types.Date, volatility.Stable),
		makeIsFn(types.TimestampTZ, types.Timestamp, volatility.Stable),
		makeIsFn(types.Time, types.TimeTZ, volatility.Stable),
		makeIsFn(types.TimeTZ, types.Time, volatility.Stable),

		makeIsFn(types.Void, types.Unknown, volatility.Leakproof),
		makeIsFn(types.Unknown, types.Void, volatility.Leakproof),

		{
			LeftType:          types.AnyTuple,
			RightType:         types.AnyTuple,
			CalledOnNullInput: true,
			EvalOp: &CompareAnyTupleOp{
				ComparisonOperator: treecmp.MakeComparisonOperator(treecmp.IsNotDistinctFrom),
			},
			Volatility: volatility.Immutable,
		},
	}},

	treecmp.In: {overloads: []*CmpOp{
		makeEvalTupleIn(types.AnyEnum, volatility.Leakproof),
		makeEvalTupleIn(types.Bool, volatility.Leakproof),
		makeEvalTupleIn(types.Bytes, volatility.Leakproof),
		makeEvalTupleIn(types.Date, volatility.Leakproof),
		makeEvalTupleIn(types.Decimal, volatility.Leakproof),
		makeEvalTupleIn(types.AnyCollatedString, volatility.Leakproof),
		makeEvalTupleIn(types.AnyTuple, volatility.Leakproof),
		makeEvalTupleIn(types.Float, volatility.Leakproof),
		makeEvalTupleIn(types.Box2D, volatility.Leakproof),
		makeEvalTupleIn(types.Geography, volatility.Leakproof),
		makeEvalTupleIn(types.Geometry, volatility.Leakproof),
		makeEvalTupleIn(types.INet, volatility.Leakproof),
		makeEvalTupleIn(types.Int, volatility.Leakproof),
		makeEvalTupleIn(types.Interval, volatility.Leakproof),
		makeEvalTupleIn(types.Jsonb, volatility.Leakproof),
		makeEvalTupleIn(types.Oid, volatility.Leakproof),
		makeEvalTupleIn(types.PGLSN, volatility.Leakproof),
		makeEvalTupleIn(types.RefCursor, volatility.Leakproof),
		makeEvalTupleIn(types.String, volatility.Leakproof),
		makeEvalTupleIn(types.Time, volatility.Leakproof),
		makeEvalTupleIn(types.TimeTZ, volatility.Leakproof),
		makeEvalTupleIn(types.Timestamp, volatility.Leakproof),
		makeEvalTupleIn(types.TimestampTZ, volatility.Leakproof),
		makeEvalTupleIn(types.Uuid, volatility.Leakproof),
		makeEvalTupleIn(types.VarBit, volatility.Leakproof),
	}},

	treecmp.Like: {overloads: []*CmpOp{
		{
			LeftType:   types.String,
			RightType:  types.String,
			EvalOp:     &MatchLikeOp{CaseInsensitive: false},
			Volatility: volatility.Leakproof,
		},
	}},

	treecmp.ILike: {overloads: []*CmpOp{
		{
			LeftType:   types.String,
			RightType:  types.String,
			EvalOp:     &MatchLikeOp{CaseInsensitive: true},
			Volatility: volatility.Leakproof,
		},
	}},

	treecmp.SimilarTo: {overloads: []*CmpOp{
		{
			LeftType:   types.String,
			RightType:  types.String,
			EvalOp:     &SimilarToOp{Escape: '\\'},
			Volatility: volatility.Leakproof,
		},
	}},

	treecmp.RegMatch: {overloads: append([]*CmpOp{
		{
			LeftType:   types.String,
			RightType:  types.String,
			EvalOp:     &MatchRegexpOp{},
			Volatility: volatility.Immutable,
		},
	},
		makeBox2DComparisonOperators(
			func(lhs, rhs *geo.CartesianBoundingBox) bool {
				return lhs.Covers(rhs)
			},
		)...,
	)},

	treecmp.RegIMatch: {overloads: []*CmpOp{
		{
			LeftType:   types.String,
			RightType:  types.String,
			EvalOp:     &MatchRegexpOp{CaseInsensitive: true},
			Volatility: volatility.Immutable,
		},
	}},

	treecmp.JSONExists: {overloads: []*CmpOp{
		{
			LeftType:   types.Jsonb,
			RightType:  types.String,
			EvalOp:     &JSONExistsOp{},
			Volatility: volatility.Immutable,
		},
	}},

	treecmp.JSONSomeExists: {overloads: []*CmpOp{
		{
			LeftType:   types.Jsonb,
			RightType:  types.StringArray,
			EvalOp:     &JSONSomeExistsOp{},
			Volatility: volatility.Immutable,
		},
	}},

	treecmp.JSONAllExists: {overloads: []*CmpOp{
		{
			LeftType:   types.Jsonb,
			RightType:  types.StringArray,
			EvalOp:     &JSONAllExistsOp{},
			Volatility: volatility.Immutable,
		},
	}},

	treecmp.Contains: {overloads: []*CmpOp{
		{
			LeftType:   types.AnyArray,
			RightType:  types.AnyArray,
			EvalOp:     &ContainsArrayOp{},
			Volatility: volatility.Immutable,
		},
		{
			LeftType:   types.Jsonb,
			RightType:  types.Jsonb,
			EvalOp:     &ContainsJsonbOp{},
			Volatility: volatility.Immutable,
		},
	}},

	treecmp.ContainedBy: {overloads: []*CmpOp{
		{
			LeftType:   types.AnyArray,
			RightType:  types.AnyArray,
			EvalOp:     &ContainedByArrayOp{},
			Volatility: volatility.Immutable,
		},
		{
			LeftType:   types.Jsonb,
			RightType:  types.Jsonb,
			EvalOp:     &ContainedByJsonbOp{},
			Volatility: volatility.Immutable,
		},
	}},
	treecmp.Overlaps: {overloads: append([]*CmpOp{
		{
			LeftType:   types.AnyArray,
			RightType:  types.AnyArray,
			EvalOp:     &OverlapsArrayOp{},
			Volatility: volatility.Immutable,
		},
		{
			LeftType:   types.INet,
			RightType:  types.INet,
			EvalOp:     &OverlapsINetOp{},
			Volatility: volatility.Immutable,
		},
	}, makeBox2DComparisonOperators(
		func(lhs, rhs *geo.CartesianBoundingBox) bool {
			return lhs.Intersects(rhs)
		},
	)...),
	},
	treecmp.TSMatches: {overloads: []*CmpOp{
		{
			LeftType:   types.TSQuery,
			RightType:  types.TSVector,
			EvalOp:     &TSMatchesQueryVectorOp{},
			Volatility: volatility.Immutable,
		},
		{
			LeftType:   types.TSVector,
			RightType:  types.TSQuery,
			EvalOp:     &TSMatchesVectorQueryOp{},
			Volatility: volatility.Immutable,
		},
	}},
})

CmpOps contains the comparison operations indexed by operation type.

CompositeKeyMatchMethodType allows the conversion from a ForeignKeyReference_Match to a tree.ReferenceCompositeKeyMatchMethod. This should match CompositeKeyMatchMethodValue.

CompositeKeyMatchMethodValue allows the conversion from a tree.ReferenceCompositeKeyMatchMethod to a ForeignKeyReference_Match.

View Source
var DMaxIPAddr = NewDIPAddr(DIPAddr{ipaddr.IPAddr{Family: ipaddr.IPv6family, Addr: dIPv6max, Mask: 128}})

DMaxIPAddr is the max DIPaddr.

View Source
var DMaxUUID = NewDUuid(DUuid{uuid.UUID{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}})

DMaxUUID is the max UUID.

View Source
var DMinIPAddr = NewDIPAddr(DIPAddr{ipaddr.IPAddr{Family: ipaddr.IPv4family, Addr: dIPv4min, Mask: 0}})

DMinIPAddr is the min DIPAddr.

View Source
var DMinUUID = NewDUuid(DUuid{uuid.UUID{}})

DMinUUID is the min UUID.

View Source
var DVoidDatum = &DVoid{}

DVoidDatum is an instance of the DVoid datum.

View Source
var (
	// DZeroDecimal is the decimal constant '0'.
	DZeroDecimal = &DDecimal{Decimal: apd.Decimal{}}
)
View Source
var DZeroTimestamp = &DTimestamp{}

DZeroTimestamp is the zero-valued DTimestamp.

View Source
var DZeroTimestampTZ = &DTimestampTZ{}

DZeroTimestampTZ is the zero-valued DTimestampTZ.

View Source
var (

	// ErrAsOfSpecifiedWithReadWrite is returned when a statement attempts to set
	// a historical query to READ WRITE which conflicts with its implied READ ONLY
	// mode.
	ErrAsOfSpecifiedWithReadWrite = pgerror.New(pgcode.Syntax, "AS OF SYSTEM TIME specified with READ WRITE mode")
)
View Source
var ErrConflictingRoutineOption = pgerror.New(pgcode.Syntax, "conflicting or redundant options")

ErrConflictingRoutineOption indicates that there are conflicting or redundant function options from user input to either create or alter a function.

View Source
var ErrRoutineUndefined = pgerror.Newf(pgcode.UndefinedFunction, "routine undefined")

ErrRoutineUndefined indicates that the required function is not found. It is used as the cause of the errors thrown when function resolution cannot find a required function.

ForeignKeyReferenceActionType allows the conversion between a tree.ReferenceAction and a ForeignKeyReference_Action.

ForeignKeyReferenceActionValue allows the conversion between a semenumpb.ForeignKeyAction_Action and a tree.ReferenceAction.

FunDefs holds pre-allocated FunctionDefinition instances for every builtin function. Initialized by builtins.init().

Note that this is extremely similar to the set stored in builtinsregistry. The hope is to remove this map at some point in the future as we delegate function definition resolution to interfaces defined in the SemaContext.

View Source
var IsolationLevelMap = map[string]IsolationLevel{
	"read uncommitted": ReadUncommittedIsolation,
	"read committed":   ReadCommittedIsolation,
	"repeatable read":  RepeatableReadIsolation,
	"snapshot":         SnapshotIsolation,
	"serializable":     SerializableIsolation,
}

IsolationLevelMap is a map from string isolation level name to isolation level, in the lowercase format that set isolation_level supports.

View Source
var JobCommandToStatement = map[JobCommand]string{
	PauseJob:  "PAUSE",
	CancelJob: "CANCEL",
	ResumeJob: "RESUME",
}

JobCommandToStatement translates a job command integer to a statement prefix.

View Source
var OidToBuiltinName map[oid.Oid]string

OidToBuiltinName contains a map from the hashed OID of all builtin functions to their name.

View Source
var OidToQualifiedBuiltinOverload map[oid.Oid]QualifiedOverload

OidToQualifiedBuiltinOverload is a map from builtin function OID to an qualified overload.

View Source
var OnCastTypeCheck map[CastCounterType]func()

OnCastTypeCheck is a map of CastCounterTypes to their hook.

View Source
var ResolvedBuiltinFuncDefs map[string]*ResolvedFunctionDefinition

ResolvedBuiltinFuncDefs holds pre-allocated ResolvedFunctionDefinition instances. Keys of the map is schema qualified function names.

View Source
var ReturningNothingClause = &ReturningNothing{}

ReturningNothingClause is a shared instance to avoid unnecessary allocations.

View Source
var ShowLastQueryStatisticsDefaultColumns = NameList([]Name{
	"parse_latency",
	"plan_latency",
	"exec_latency",
	"service_latency",
	"post_commit_jobs_latency",
})

ShowLastQueryStatisticsDefaultColumns is the default list of columns when the USING clause is not specified. Note: the form that does not specify the USING clause is deprecated. Remove it when there are no more clients using it (22.1 or later).

View Source
var UnaryOpName = [...]string{
	UnaryMinus:      "-",
	UnaryPlus:       "+",
	UnaryComplement: "~",
	UnarySqrt:       "|/",
	UnaryCbrt:       "||/",
}

UnaryOpName is the mapping of unary operators to names.

View Source
var UnaryOps = unaryOpFixups(map[UnaryOperatorSymbol]*UnaryOpOverloads{
	UnaryPlus: {overloads: []*UnaryOp{
		{
			Typ:        types.Int,
			ReturnType: types.Int,
			EvalOp:     &UnaryNoop{},
			Volatility: volatility.Immutable,
		},
		{
			Typ:        types.Float,
			ReturnType: types.Float,
			EvalOp:     &UnaryNoop{},
			Volatility: volatility.Immutable,
		},
		{
			Typ:        types.Decimal,
			ReturnType: types.Decimal,
			EvalOp:     &UnaryNoop{},
			Volatility: volatility.Immutable,
		},
		{
			Typ:        types.Interval,
			ReturnType: types.Interval,
			EvalOp:     &UnaryNoop{},
			Volatility: volatility.Immutable,
		},
	}},

	UnaryMinus: {overloads: []*UnaryOp{
		{
			Typ:        types.Int,
			ReturnType: types.Int,
			EvalOp:     &UnaryMinusIntOp{},
			Volatility: volatility.Immutable,
		},
		{
			Typ:        types.Float,
			ReturnType: types.Float,
			EvalOp:     &UnaryMinusFloatOp{},
			Volatility: volatility.Immutable,
		},
		{
			Typ:        types.Decimal,
			ReturnType: types.Decimal,
			EvalOp:     &UnaryMinusDecimalOp{},
			Volatility: volatility.Immutable,
		},
		{
			Typ:        types.Interval,
			ReturnType: types.Interval,
			EvalOp:     &UnaryMinusIntervalOp{},
			Volatility: volatility.Immutable,
		},
	}},

	UnaryComplement: {overloads: []*UnaryOp{
		{
			Typ:        types.Int,
			ReturnType: types.Int,
			EvalOp:     &ComplementIntOp{},
			Volatility: volatility.Immutable,
		},
		{
			Typ:        types.VarBit,
			ReturnType: types.VarBit,
			EvalOp:     &ComplementVarBitOp{},
			Volatility: volatility.Immutable,
		},
		{
			Typ:        types.INet,
			ReturnType: types.INet,
			EvalOp:     &ComplementINetOp{},
			Volatility: volatility.Immutable,
		},
	}},

	UnarySqrt: {overloads: []*UnaryOp{
		{
			Typ:        types.Float,
			ReturnType: types.Float,
			EvalOp:     &SqrtFloatOp{},
			Volatility: volatility.Immutable,
		},
		{
			Typ:        types.Decimal,
			ReturnType: types.Decimal,
			EvalOp:     &SqrtDecimalOp{},
			Volatility: volatility.Immutable,
		},
	}},

	UnaryCbrt: {overloads: []*UnaryOp{
		{
			Typ:        types.Float,
			ReturnType: types.Float,
			EvalOp:     &CbrtFloatOp{},
			Volatility: volatility.Immutable,
		},
		{
			Typ:        types.Decimal,
			ReturnType: types.Decimal,
			EvalOp:     &CbrtDecimalOp{},
			Volatility: volatility.Immutable,
		},
	}},
})

UnaryOps contains the unary operations indexed by operation type.

View Source
var UnknownReturnType *types.T

UnknownReturnType is returned from ReturnTypers when the arguments provided are not sufficient to determine a return type. This is necessary for cases like overload resolution, where the argument types are not resolved yet so the type-level function will be called without argument types. If a ReturnTyper returns unknownReturnType, then the candidate function set cannot be refined. This means that only ReturnTypers that never return unknownReturnType, like those created with FixedReturnType, can help reduce overload ambiguity.

Functions

func AsJSON

AsJSON converts a datum into our standard json representation.

func AsString

func AsString(n NodeFormatter) string

AsString pretty prints a node to a string.

func AsStringWithFQNames

func AsStringWithFQNames(n NodeFormatter, ann *Annotations) string

AsStringWithFQNames pretty prints a node to a string with the FmtAlwaysQualifyTableNames flag (which requires annotations).

func AsStringWithFlags

func AsStringWithFlags(n NodeFormatter, fl FmtFlags, opts ...FmtCtxOption) string

AsStringWithFlags pretty prints a node to a string given specific flags; only flags that don't require Annotations can be used.

func CanModifySchema

func CanModifySchema(stmt Statement) bool

CanModifySchema returns true if the statement can modify the database schema.

func CanWriteData

func CanWriteData(stmt Statement) bool

CanWriteData returns true if the statement can modify data.

func CheckIsWindowOrAgg

func CheckIsWindowOrAgg(def *ResolvedFunctionDefinition) error

CheckIsWindowOrAgg returns an error if the function definition is not a window function or an aggregate.

func CheckUnsupportedType

func CheckUnsupportedType(ctx context.Context, semaCtx *SemaContext, typ *types.T) error

CheckUnsupportedType returns an error if the given type is not supported by the current cluster version. If the given SemaContext is nil or uninitialized, CheckUnsupportedType returns nil.

func CmpOpInverse

CmpOpInverse returns the inverse of the comparison operator if it exists. The second return value is true if it exists, and false otherwise.

func CompareBools

func CompareBools(d, v bool) int

CompareBools compares the input bools according to the SQL comparison rules.

func CompareDecimals

func CompareDecimals(d *apd.Decimal, v *apd.Decimal) int

CompareDecimals compares 2 apd.Decimals according to the SQL comparison rules, making sure that NaNs sort first.

func ComputeColNameInternal

func ComputeColNameInternal(
	ctx context.Context, sp SearchPath, target Expr, funcResolver FunctionReferenceResolver,
) (int, string, error)

ComputeColNameInternal is the workhorse for GetRenderColName. The return value indicates the strength of the confidence in the result: 0 - no information 1 - second-best name choice 2 - good name choice

The algorithm is borrowed from FigureColnameInternal in PostgreSQL 10, to be found in src/backend/parser/parse_target.c.

func ContainsVars

func ContainsVars(expr Expr) bool

ContainsVars returns true if the expression contains any variables. (variables = sub-expressions, placeholders, indexed vars, etc.)

func DatumTypeSize

func DatumTypeSize(t *types.T) (size uintptr, isVarlen bool)

DatumTypeSize returns a lower bound on the total size of a Datum of the given type in bytes, including memory that is pointed at (even if shared between Datum instances) but excluding allocation overhead.

The second return value indicates whether data of this type have different sizes.

It holds for every Datum d that d.Size() >= DatumSize(d.ResolvedType())

func EqualComparisonFunctionExists

func EqualComparisonFunctionExists(leftType, rightType *types.T) bool

EqualComparisonFunctionExists looks up an overload of the "=" operator for a given pair of input operand types.

func ErrNameString

func ErrNameString(s string) string

ErrNameString escapes an identifier stored a string to a SQL identifier suitable for printing in error messages.

func ErrNameStringP

func ErrNameStringP(s *string) string

ErrNameStringP escapes an identifier stored a string to a SQL identifier suitable for printing in error messages, avoiding a heap allocation.

func ErrString

func ErrString(n NodeFormatter) string

ErrString pretty prints a node to a string. Identifiers are not quoted.

func ExplainFlags

func ExplainFlags() map[string]ExplainFlag

ExplainFlags returns a map from EXPLAIN flag strings to ExplainFlag.

func ExplainModes

func ExplainModes() map[string]ExplainMode

ExplainModes returns a map from EXPLAIN mode strings to ExplainMode.

func ExprDebugString

func ExprDebugString(expr Expr) string

ExprDebugString generates a multi-line debug string with one node per line in Go format.

func FoldComparisonExpr

func FoldComparisonExpr(
	op treecmp.ComparisonOperator, left, right Expr,
) (newOp treecmp.ComparisonOperator, newLeft Expr, newRight Expr, flipped bool, not bool)

FoldComparisonExpr folds a given comparison operation and its expressions into an equivalent operation that will hit in the CmpOps map, returning this new operation, along with potentially flipped operands and "flipped" and "not" flags.

func FoldComparisonExprWithDatums

func FoldComparisonExprWithDatums(
	op treecmp.ComparisonOperator, left, right Datum,
) (newOp treecmp.ComparisonOperator, newLeft Datum, newRight Datum, flipped bool, not bool)

FoldComparisonExprWithDatums is the same as FoldComparisonExpr, but receives and returns Datums instead of Exprs. This allows callers passing Datums and expecting Datums to be returned to avoid the expensive interface conversions.

func FormatDate

func FormatDate(d pgdate.Date, ctx *FmtCtx)

FormatDate writes d into ctx according to the format flags.

func FormatDuration

func FormatDuration(d duration.Duration, ctx *FmtCtx)

FormatDuration writes d into ctx according to the format flags.

func GetEnumComponentsFromLogicalRep

func GetEnumComponentsFromLogicalRep(typ *types.T, rep string) ([]byte, string, error)

GetEnumComponentsFromLogicalRep returns the physical and logical components for an enum of the requested type. It returns an error if it cannot find a matching logical representation.

func GetEnumComponentsFromPhysicalRep

func GetEnumComponentsFromPhysicalRep(typ *types.T, rep []byte) ([]byte, string, error)

GetEnumComponentsFromPhysicalRep returns the physical and logical components for an enum of the requested type. It returns an error if it cannot find a matching physical representation.

func GetJSONPath

func GetJSONPath(j json.JSON, ary DArray) (json.JSON, error)

GetJSONPath is used for the #> and #>> operators.

func GetParamsAndReturnType

func GetParamsAndReturnType(impl overloadImpl) (TypeList, ReturnTyper)

GetParamsAndReturnType gets the parameters and return type of an overloadImpl.

func GetRenderColName

func GetRenderColName(
	ctx context.Context,
	searchPath SearchPath,
	target SelectExpr,
	funcResolver FunctionReferenceResolver,
) (string, error)

GetRenderColName computes a name for a result column. A name specified with AS takes priority, otherwise a name is derived from the expression.

This function is meant to be used on untransformed syntax trees.

The algorithm is borrowed from FigureColName() in PostgreSQL 10, to be found in src/backend/parser/parse_target.c. We reuse this algorithm to provide names more compatible with PostgreSQL.

func GetStaticallyKnownType

func GetStaticallyKnownType(ref ResolvableTypeReference) (typ *types.T, ok bool)

GetStaticallyKnownType possibly promotes a ResolvableTypeReference into a *types.T if the reference is a statically known type. It is only safe to access the returned type if ok is true.

func GetTableType

func GetTableType(isSequence bool, isView bool, isMaterialized bool) string

GetTableType returns a string representing the type of table the command is operating on. It is assumed if the table is not a sequence or a view, then it is a regular table.

func HasReturningClause

func HasReturningClause(clause ReturningClause) bool

HasReturningClause determines if a ReturningClause is present, given a variant of the ReturningClause interface.

func InferBinaryType

func InferBinaryType(bin treebin.BinaryOperatorSymbol, leftType, rightType *types.T) *types.T

InferBinaryType infers the return type of a binary expression, given the type of its inputs.

func InferTypes

func InferTypes(vals []string) []types.Family

InferTypes takes a list of strings produced by ParsePath and returns a slice of datum types inferred from the strings. Type DInt will be used if possible, otherwise DString. For example, a vals slice ["1", "foo"] will give a types slice [Dint, DString].

func IsReferenceSerialType

func IsReferenceSerialType(ref ResolvableTypeReference) bool

IsReferenceSerialType returns whether the input reference is a known serial type. It should only be used during parsing.

func IsUnaryComplement

func IsUnaryComplement(op Operator) bool

IsUnaryComplement returns whether op is a unary complement operator.

func LimitDecimalWidth

func LimitDecimalWidth(d *apd.Decimal, precision, scale int) error

LimitDecimalWidth limits d's precision (total number of digits) and scale (number of digits after the decimal point). Note that this any limiting will modify the decimal in-place.

func MakeParseError

func MakeParseError(s string, typ *types.T, err error) error

MakeParseError returns a parse error using the provided string and type. An optional error can be provided, which will be appended to the end of the error string.

func MaxDistinctCount

func MaxDistinctCount(evalCtx CompareContext, first, last Datum) (_ int64, ok bool)

MaxDistinctCount returns the maximum number of distinct values between the given datums (inclusive). This is possible if:

a. the types of the datums are equivalent and countable, or
b. the datums have the same value (in which case the distinct count is 1).

If neither of these conditions hold, MaxDistinctCount returns ok=false. Additionally, it must be the case that first <= last, otherwise MaxDistinctCount returns ok=false.

func MemoizeComparisonExprOp

func MemoizeComparisonExprOp(node *ComparisonExpr)

MemoizeComparisonExprOp populates the Op field of the ComparisonExpr.

TODO(ajwerner): It feels dangerous to leave this to the caller to set. Should we rework the construction and access to the underlying Op to enforce safety?

func MockNameTypes

func MockNameTypes(types map[string]*types.T) func()

MockNameTypes populates presetTypesForTesting for a test.

func MustBeStaticallyKnownType

func MustBeStaticallyKnownType(ref ResolvableTypeReference) *types.T

MustBeStaticallyKnownType does the same thing as GetStaticallyKnownType but panics in the case that the reference is not statically known. This function is intended to be used in tests or in cases where it is not possible to have any unresolved type references.

func NameString

func NameString(s string) string

NameString escapes an identifier stored in a string to a SQL identifier.

func NameStringP

func NameStringP(s *string) string

NameStringP escapes an identifier stored in a heap string to a SQL identifier, avoiding a heap allocation.

func NewAggInAggError

func NewAggInAggError() error

NewAggInAggError creates an error for the case when an aggregate function is contained within another aggregate function.

func NewCannotMixBitArraySizesError

func NewCannotMixBitArraySizesError(op string) error

NewCannotMixBitArraySizesError creates an error for the case when a bitwise aggregate function is called on bit arrays with different sizes.

func NewContextDependentOpsNotAllowedError

func NewContextDependentOpsNotAllowedError(context string) error

NewContextDependentOpsNotAllowedError creates an error for the case when context-dependent operators are not allowed in the given context.

func NewInvalidFunctionUsageError

func NewInvalidFunctionUsageError(class FunctionClass, context string) error

NewInvalidFunctionUsageError creates a rejection for a special function.

func NewInvalidNestedSRFError

func NewInvalidNestedSRFError(context string) error

NewInvalidNestedSRFError creates a rejection for a nested SRF.

func NewNoValueProvidedForPlaceholderErr

func NewNoValueProvidedForPlaceholderErr(pIdx PlaceholderIdx) error

NewNoValueProvidedForPlaceholderErr constructs an error indicating a missing placeholder value.

func NewTimestampExceedsBoundsError

func NewTimestampExceedsBoundsError(t time.Time) error

NewTimestampExceedsBoundsError returns a new "exceeds supported timestamp bounds" error for the given timestamp, with the correct pgcode.

func NewTypeIsNotCompositeError

func NewTypeIsNotCompositeError(resolvedType *types.T) error

NewTypeIsNotCompositeError generates an error suitable to report when a ColumnAccessExpr or TupleStar is applied to a non-composite type.

func OperatorIsImmutable

func OperatorIsImmutable(expr Expr) bool

OperatorIsImmutable returns true if the given expression corresponds to a constant operator. Note importantly that this will return true for all expr types other than FuncExpr, CastExpr, UnaryExpr, BinaryExpr, and ComparisonExpr. It does not do any recursive searching.

func PGWireFormatTime

func PGWireFormatTime(t timeofday.TimeOfDay, tmp []byte) []byte

PGWireFormatTime formats t into a format lib/pq understands, appending to the provided tmp buffer and reallocating if needed. The function will then return the resulting buffer.

func PGWireFormatTimeTZ

func PGWireFormatTimeTZ(t timetz.TimeTZ, tmp []byte) []byte

PGWireFormatTimeTZ formats t into a format lib/pq understands, appending to the provided tmp buffer and reallocating if needed. The function will then return the resulting buffer.

func PGWireFormatTimestamp

func PGWireFormatTimestamp(t time.Time, offset *time.Location, tmp []byte) (b []byte)

PGWireFormatTimestamp formats t into a format lib/pq understands. If offset is not nil, it will not display the timezone offset.

func PGWireTypeSize

func PGWireTypeSize(t *types.T) int

PGWireTypeSize is the size of the type as reported in pg_catalog and over the wire protocol.

func ParseAndRequireStringHandler

func ParseAndRequireStringHandler(
	t *types.T, s string, ctx ParseContext, vh ValueHandler, ph *pgdate.ParseHelper,
) (err error)

ParseAndRequireStringHandler parses a string and passes values supported by the vector engine directly to a ValueHandler. Other types are handled by ParseAndRequireString.

func ParseBool

func ParseBool(s string) (bool, error)

ParseBool parses and returns the boolean value represented by the provided string, or an error if parsing is unsuccessful. See https://github.com/postgres/postgres/blob/90627cf98a8e7d0531789391fd798c9bfcc3bc1a/src/backend/utils/adt/bool.c#L36

func ParseIntervalWithTypeMetadata

func ParseIntervalWithTypeMetadata(
	style duration.IntervalStyle, s string, itm types.IntervalTypeMetadata,
) (duration.Duration, error)

ParseIntervalWithTypeMetadata is the same as ParseDIntervalWithTypeMetadata but returns a duration.Duration.

func ParsePath

func ParsePath(str string) []string

ParsePath splits a string of the form "/foo/bar" into strings ["foo", "bar"]. An empty string is allowed, otherwise the string must start with /.

func PgwireFormatBool

func PgwireFormatBool(d bool) byte

PgwireFormatBool returns a single byte representing a boolean according to pgwire encoding.

func PgwireFormatFloat

func PgwireFormatFloat(
	buf []byte, fl float64, conv sessiondatapb.DataConversionConfig, floatTyp *types.T,
) []byte

PgwireFormatFloat returns a []byte representing a float according to pgwire encoding. The result is appended to the given buffer.

func Pretty

func Pretty(stmt NodeFormatter) (string, error)

Pretty pretty prints stmt with default options.

func ProcessPlaceholderAnnotations

func ProcessPlaceholderAnnotations(
	semaCtx *SemaContext, stmt Statement, typeHints PlaceholderTypes,
) error

ProcessPlaceholderAnnotations performs an order-independent global traversal of the provided Statement, annotating all placeholders with a type in either of the following situations:

  • the placeholder is the subject of an explicit type annotation in at least one of its occurrences. If it is subject to multiple explicit type annotations where the types are not all in agreement, or if the placeholder already has a type hint in the placeholder map which conflicts with the explicit type annotation type, an error will be thrown.

  • the placeholder is the subject to a cast of the same type in all occurrences of the placeholder. If the placeholder is subject to casts of multiple types, or if it has occurrences without a cast, no error will be thrown but the type will not be inferred. If the placeholder already has a type hint, that type will be kept regardless of any casts.

See docs/RFCS/20160203_typing.md for more details on placeholder typing (in particular section "First pass: placeholder annotations").

The typeHints slice contains the client-provided hints and is populated with any newly assigned types. It is assumed to be pre-sized to the number of placeholders in the statement and is populated accordingly.

TODO(nvanbenschoten): Can this visitor and map be preallocated (like normalizeVisitor)?

func ResolveBlankPaddedChar

func ResolveBlankPaddedChar(s string, t *types.T) string

ResolveBlankPaddedChar pads the given string with spaces if blank padding is required or returns the string unmodified otherwise.

func ResolveType

func ResolveType(
	ctx context.Context, ref ResolvableTypeReference, resolver TypeReferenceResolver,
) (*types.T, error)

ResolveType converts a ResolvableTypeReference into a *types.T.

func ReturnsAtMostOneRow

func ReturnsAtMostOneRow(stmt Statement) bool

ReturnsAtMostOneRow returns true if the statement returns either no rows or a single row. TODO(harding): Expand this list.

func Serialize

func Serialize(n NodeFormatter) string

Serialize pretty prints a node to a string using FmtSerializable; it is appropriate when we store expressions into strings that are stored on disk and may be later parsed back into expressions.

func SerializeForDisplay

func SerializeForDisplay(n NodeFormatter) string

SerializeForDisplay pretty prints a node to a string using FmtParsable. It is appropriate when printing expressions that are visible to end users.

func StmtDebugString

func StmtDebugString(stmt Statement) string

StmtDebugString generates multi-line debug strings in Go format for the expressions that are part of the given statement.

func TestingEnableFamilyIndexHint

func TestingEnableFamilyIndexHint() func()

TestingEnableFamilyIndexHint enables the use of Family index hint for tests.

func TimeFamilyPrecisionToRoundDuration

func TimeFamilyPrecisionToRoundDuration(precision int32) time.Duration

TimeFamilyPrecisionToRoundDuration takes in a type's precision, and returns the duration to use to pass into time.Truncate to truncate to that duration. Panics if the precision is not supported.

func TimeFromDatumForComparison

func TimeFromDatumForComparison(ctx CompareContext, d Datum) (time.Time, error)

TimeFromDatumForComparison gets the time from a datum object to use strictly for comparison usage.

func ValidateRoutineOptions

func ValidateRoutineOptions(options RoutineOptions) error

ValidateRoutineOptions checks whether there are conflicting or redundant routine options in the given slice.

func WalkExprConst

func WalkExprConst(v Visitor, expr Expr)

WalkExprConst is a variant of WalkExpr for visitors that do not modify the expression.

Types

type AbbreviatedGrant

type AbbreviatedGrant struct {
	Privileges      privilege.List
	Target          privilege.TargetObjectType
	Grantees        RoleSpecList
	WithGrantOption bool
}

AbbreviatedGrant represents the GRANT part of an ALTER DEFAULT PRIVILEGES statement.

func (*AbbreviatedGrant) Format

func (n *AbbreviatedGrant) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AbbreviatedRevoke

type AbbreviatedRevoke struct {
	Privileges     privilege.List
	Target         privilege.TargetObjectType
	Grantees       RoleSpecList
	GrantOptionFor bool
}

AbbreviatedRevoke represents the REVOKE part of an ALTER DEFAULT PRIVILEGES statement.

func (*AbbreviatedRevoke) Format

func (n *AbbreviatedRevoke) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AggType

type AggType int

AggType specifies the type of aggregation.

const (

	// GeneralAgg is used for general-purpose aggregate functions.
	// array_agg(col1 ORDER BY col2)
	GeneralAgg AggType
	// OrderedSetAgg is used for ordered-set aggregate functions.
	// percentile_disc(fraction) WITHIN GROUP (ORDER BY col1)
	OrderedSetAgg
)

FuncExpr.AggType

type AggregateOverload

type AggregateOverload interface {
	// Aggregate is just a marker method so folks don't think you can just shove
	// anything here. It ought to be an eval.AggregateOverload.
	Aggregate() // marker interface
}

AggregateOverload is an opaque type which is used to box an eval.AggregateOverload.

type AliasClause

type AliasClause struct {
	Alias Name
	Cols  ColumnDefList
}

AliasClause represents an alias, optionally with a column def list: "AS name", "AS name(col1, col2)", or "AS name(col1 INT, col2 STRING)". Note that the last form is only valid in the context of record-returning functions, which also require the last form to define their output types.

func (*AliasClause) Format

func (f *AliasClause) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AliasedTableExpr

type AliasedTableExpr struct {
	Expr       TableExpr
	IndexFlags *IndexFlags
	Ordinality bool
	Lateral    bool
	As         AliasClause
}

AliasedTableExpr represents a table expression coupled with an optional alias.

func (*AliasedTableExpr) Format

func (node *AliasedTableExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AliasedTableExpr) String

func (node *AliasedTableExpr) String() string

func (*AliasedTableExpr) WalkTableExpr

func (expr *AliasedTableExpr) WalkTableExpr(v Visitor) TableExpr

WalkTableExpr implements the TableExpr interface.

type AllColumnsSelector

type AllColumnsSelector struct {
	// TableName corresponds to the table prefix, before the star.
	TableName *UnresolvedObjectName
}

AllColumnsSelector corresponds to a selection of all columns in a table when used in a SELECT clause. (e.g. `table.*`).

func (*AllColumnsSelector) Eval

Eval is part of the TypedExpr interface.

func (*AllColumnsSelector) Format

func (a *AllColumnsSelector) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AllColumnsSelector) NormalizeVarName

func (a *AllColumnsSelector) NormalizeVarName() (VarName, error)

NormalizeVarName implements the VarName interface.

func (*AllColumnsSelector) ResolvedType

func (*AllColumnsSelector) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*AllColumnsSelector) String

func (a *AllColumnsSelector) String() string

func (*AllColumnsSelector) TypeCheck

func (expr *AllColumnsSelector) TypeCheck(
	_ context.Context, _ *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*AllColumnsSelector) Variable

func (a *AllColumnsSelector) Variable()

Variable implements the VariableExpr interface. Although, the AllColumnsSelector ought to be replaced to an IndexedVar before the points the VariableExpr interface is used.

func (*AllColumnsSelector) Walk

func (expr *AllColumnsSelector) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type AllTablesSelector

type AllTablesSelector struct {
	ObjectNamePrefix
}

AllTablesSelector corresponds to a selection of all tables in a database, e.g. when used with GRANT.

func (*AllTablesSelector) Format

func (at *AllTablesSelector) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AllTablesSelector) NormalizeTablePattern

func (at *AllTablesSelector) NormalizeTablePattern() (TablePattern, error)

NormalizeTablePattern implements the TablePattern interface.

func (*AllTablesSelector) String

func (at *AllTablesSelector) String() string

type AlterBackup

type AlterBackup struct {
	// Backup contains the locations for the backup we seek to add new keys to.
	Backup Expr
	Subdir Expr
	Cmds   AlterBackupCmds
}

AlterBackup represents an ALTER BACKUP statement.

func (*AlterBackup) Format

func (node *AlterBackup) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterBackup) StatementReturnType

func (*AlterBackup) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterBackup) StatementTag

func (*AlterBackup) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterBackup) StatementType

func (*AlterBackup) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterBackup) String

func (n *AlterBackup) String() string

type AlterBackupCmd

type AlterBackupCmd interface {
	NodeFormatter
	// contains filtered or unexported methods
}

AlterBackupCmd represents a backup modification operation.

type AlterBackupCmds

type AlterBackupCmds []AlterBackupCmd

AlterBackupCmds is an array of type AlterBackupCmd

func (*AlterBackupCmds) Format

func (node *AlterBackupCmds) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterBackupKMS

type AlterBackupKMS struct {
	KMSInfo BackupKMS
}

AlterBackupKMS represents a possible alter_backup_cmd option.

func (*AlterBackupKMS) Format

func (node *AlterBackupKMS) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterBackupSchedule

type AlterBackupSchedule struct {
	ScheduleID uint64
	Cmds       AlterBackupScheduleCmds
}

AlterBackupSchedule represents an ALTER BACKUP SCHEDULE statement.

func (*AlterBackupSchedule) Format

func (node *AlterBackupSchedule) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterBackupSchedule) StatementReturnType

func (*AlterBackupSchedule) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterBackupSchedule) StatementTag

func (*AlterBackupSchedule) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterBackupSchedule) StatementType

func (*AlterBackupSchedule) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterBackupSchedule) String

func (n *AlterBackupSchedule) String() string

type AlterBackupScheduleCmd

type AlterBackupScheduleCmd interface {
	NodeFormatter
	// contains filtered or unexported methods
}

AlterBackupScheduleCmd represents a changefeed modification operation.

type AlterBackupScheduleCmds

type AlterBackupScheduleCmds []AlterBackupScheduleCmd

AlterBackupScheduleCmds represents a list of changefeed alterations

func (*AlterBackupScheduleCmds) Format

func (node *AlterBackupScheduleCmds) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterBackupScheduleCmds) String

func (n *AlterBackupScheduleCmds) String() string

type AlterBackupScheduleSetFullBackup

type AlterBackupScheduleSetFullBackup struct {
	FullBackup FullBackupClause
}

AlterBackupScheduleSetFullBackup represents an SET FULL BACKUP <recurrence> command

func (*AlterBackupScheduleSetFullBackup) Format

func (node *AlterBackupScheduleSetFullBackup) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterBackupScheduleSetInto

type AlterBackupScheduleSetInto struct {
	Into StringOrPlaceholderOptList
}

AlterBackupScheduleSetInto represents a SET <destinations> command

func (*AlterBackupScheduleSetInto) Format

func (node *AlterBackupScheduleSetInto) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterBackupScheduleSetLabel

type AlterBackupScheduleSetLabel struct {
	Label Expr
}

AlterBackupScheduleSetLabel represents an ADD <label> command

func (*AlterBackupScheduleSetLabel) Format

func (node *AlterBackupScheduleSetLabel) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterBackupScheduleSetRecurring

type AlterBackupScheduleSetRecurring struct {
	Recurrence Expr
}

AlterBackupScheduleSetRecurring represents an SET RECURRING <recurrence> command

func (*AlterBackupScheduleSetRecurring) Format

func (node *AlterBackupScheduleSetRecurring) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterBackupScheduleSetScheduleOption

type AlterBackupScheduleSetScheduleOption struct {
	Option KVOption
}

AlterBackupScheduleSetScheduleOption represents an SET SCHEDULE OPTION <kv_options> command

func (*AlterBackupScheduleSetScheduleOption) Format

func (node *AlterBackupScheduleSetScheduleOption) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterBackupScheduleSetWith

type AlterBackupScheduleSetWith struct {
	With *BackupOptions
}

AlterBackupScheduleSetWith represents an SET <options> command

func (*AlterBackupScheduleSetWith) Format

func (node *AlterBackupScheduleSetWith) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterChangefeed

type AlterChangefeed struct {
	Jobs Expr
	Cmds AlterChangefeedCmds
}

AlterChangefeed represents an ALTER CHANGEFEED statement.

func (*AlterChangefeed) Format

func (node *AlterChangefeed) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterChangefeed) StatementReturnType

func (*AlterChangefeed) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterChangefeed) StatementTag

func (*AlterChangefeed) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterChangefeed) StatementType

func (*AlterChangefeed) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterChangefeed) String

func (n *AlterChangefeed) String() string

type AlterChangefeedAddTarget

type AlterChangefeedAddTarget struct {
	Targets ChangefeedTargets
	Options KVOptions
}

AlterChangefeedAddTarget represents an ADD <targets> command

func (*AlterChangefeedAddTarget) Format

func (node *AlterChangefeedAddTarget) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterChangefeedCmd

type AlterChangefeedCmd interface {
	NodeFormatter
	// contains filtered or unexported methods
}

AlterChangefeedCmd represents a changefeed modification operation.

type AlterChangefeedCmds

type AlterChangefeedCmds []AlterChangefeedCmd

AlterChangefeedCmds represents a list of changefeed alterations

func (*AlterChangefeedCmds) Format

func (node *AlterChangefeedCmds) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterChangefeedCmds) String

func (n *AlterChangefeedCmds) String() string

type AlterChangefeedDropTarget

type AlterChangefeedDropTarget struct {
	Targets ChangefeedTargets
}

AlterChangefeedDropTarget represents an DROP <targets> command

func (*AlterChangefeedDropTarget) Format

func (node *AlterChangefeedDropTarget) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterChangefeedSetOptions

type AlterChangefeedSetOptions struct {
	Options KVOptions
}

AlterChangefeedSetOptions represents an SET <options> command

func (*AlterChangefeedSetOptions) Format

func (node *AlterChangefeedSetOptions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterChangefeedUnsetOptions

type AlterChangefeedUnsetOptions struct {
	Options NameList
}

AlterChangefeedUnsetOptions represents an UNSET <options> command

func (*AlterChangefeedUnsetOptions) Format

func (node *AlterChangefeedUnsetOptions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterDatabaseAddRegion

type AlterDatabaseAddRegion struct {
	Name        Name
	Region      Name
	IfNotExists bool
}

AlterDatabaseAddRegion represents a ALTER DATABASE ADD REGION statement.

func (*AlterDatabaseAddRegion) Format

func (node *AlterDatabaseAddRegion) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterDatabaseAddRegion) StatementReturnType

func (*AlterDatabaseAddRegion) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterDatabaseAddRegion) StatementTag

func (*AlterDatabaseAddRegion) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterDatabaseAddRegion) StatementType

func (*AlterDatabaseAddRegion) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterDatabaseAddRegion) String

func (n *AlterDatabaseAddRegion) String() string

type AlterDatabaseAddSuperRegion

type AlterDatabaseAddSuperRegion struct {
	DatabaseName    Name
	SuperRegionName Name
	Regions         []Name
}

AlterDatabaseAddSuperRegion represents a ALTER DATABASE ADD SUPER REGION ... statement.

func (*AlterDatabaseAddSuperRegion) Format

func (node *AlterDatabaseAddSuperRegion) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterDatabaseAddSuperRegion) StatementReturnType

func (*AlterDatabaseAddSuperRegion) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterDatabaseAddSuperRegion) StatementTag

func (*AlterDatabaseAddSuperRegion) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterDatabaseAddSuperRegion) StatementType

func (*AlterDatabaseAddSuperRegion) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterDatabaseAddSuperRegion) String

func (n *AlterDatabaseAddSuperRegion) String() string

type AlterDatabaseAlterSuperRegion

type AlterDatabaseAlterSuperRegion struct {
	DatabaseName    Name
	SuperRegionName Name
	Regions         []Name
}

AlterDatabaseAlterSuperRegion represents a ALTER DATABASE ADD SUPER REGION ... statement.

func (*AlterDatabaseAlterSuperRegion) Format

func (node *AlterDatabaseAlterSuperRegion) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterDatabaseAlterSuperRegion) StatementReturnType

func (*AlterDatabaseAlterSuperRegion) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterDatabaseAlterSuperRegion) StatementTag

func (*AlterDatabaseAlterSuperRegion) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterDatabaseAlterSuperRegion) StatementType

StatementType implements the Statement interface.

func (*AlterDatabaseAlterSuperRegion) String

type AlterDatabaseDropRegion

type AlterDatabaseDropRegion struct {
	Name     Name
	Region   Name
	IfExists bool
}

AlterDatabaseDropRegion represents a ALTER DATABASE DROP REGION statement.

func (*AlterDatabaseDropRegion) Format

func (node *AlterDatabaseDropRegion) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterDatabaseDropRegion) StatementReturnType

func (*AlterDatabaseDropRegion) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterDatabaseDropRegion) StatementTag

func (*AlterDatabaseDropRegion) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterDatabaseDropRegion) StatementType

func (*AlterDatabaseDropRegion) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterDatabaseDropRegion) String

func (n *AlterDatabaseDropRegion) String() string

type AlterDatabaseDropSecondaryRegion

type AlterDatabaseDropSecondaryRegion struct {
	DatabaseName Name
	IfExists     bool
}

AlterDatabaseDropSecondaryRegion represents a ALTER DATABASE DROP SECONDARY REGION statement.

func (*AlterDatabaseDropSecondaryRegion) Format

func (node *AlterDatabaseDropSecondaryRegion) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterDatabaseDropSecondaryRegion) StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterDatabaseDropSecondaryRegion) StatementTag

func (*AlterDatabaseDropSecondaryRegion) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterDatabaseDropSecondaryRegion) StatementType

StatementType implements the Statement interface.

func (*AlterDatabaseDropSecondaryRegion) String

type AlterDatabaseDropSuperRegion

type AlterDatabaseDropSuperRegion struct {
	DatabaseName    Name
	SuperRegionName Name
}

AlterDatabaseDropSuperRegion represents a ALTER DATABASE DROP SUPER REGION ... statement.

func (*AlterDatabaseDropSuperRegion) Format

func (node *AlterDatabaseDropSuperRegion) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterDatabaseDropSuperRegion) StatementReturnType

func (*AlterDatabaseDropSuperRegion) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterDatabaseDropSuperRegion) StatementTag

func (*AlterDatabaseDropSuperRegion) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterDatabaseDropSuperRegion) StatementType

StatementType implements the Statement interface.

func (*AlterDatabaseDropSuperRegion) String

type AlterDatabaseOwner

type AlterDatabaseOwner struct {
	Name  Name
	Owner RoleSpec
}

AlterDatabaseOwner represents a ALTER DATABASE OWNER TO statement.

func (*AlterDatabaseOwner) Format

func (node *AlterDatabaseOwner) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterDatabaseOwner) StatementReturnType

func (*AlterDatabaseOwner) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterDatabaseOwner) StatementTag

func (*AlterDatabaseOwner) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterDatabaseOwner) StatementType

func (*AlterDatabaseOwner) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterDatabaseOwner) String

func (n *AlterDatabaseOwner) String() string

type AlterDatabasePlacement

type AlterDatabasePlacement struct {
	Name      Name
	Placement DataPlacement
}

AlterDatabasePlacement represents a ALTER DATABASE PLACEMENT statement.

func (*AlterDatabasePlacement) Format

func (node *AlterDatabasePlacement) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterDatabasePlacement) StatementReturnType

func (*AlterDatabasePlacement) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterDatabasePlacement) StatementTag

func (*AlterDatabasePlacement) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterDatabasePlacement) StatementType

func (*AlterDatabasePlacement) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterDatabasePlacement) String

func (n *AlterDatabasePlacement) String() string

type AlterDatabasePrimaryRegion

type AlterDatabasePrimaryRegion struct {
	Name          Name
	PrimaryRegion Name
}

AlterDatabasePrimaryRegion represents a ALTER DATABASE PRIMARY REGION ... statement.

func (*AlterDatabasePrimaryRegion) Format

func (node *AlterDatabasePrimaryRegion) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterDatabasePrimaryRegion) StatementReturnType

func (*AlterDatabasePrimaryRegion) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterDatabasePrimaryRegion) StatementTag

func (*AlterDatabasePrimaryRegion) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterDatabasePrimaryRegion) StatementType

func (*AlterDatabasePrimaryRegion) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterDatabasePrimaryRegion) String

func (n *AlterDatabasePrimaryRegion) String() string

type AlterDatabaseSecondaryRegion

type AlterDatabaseSecondaryRegion struct {
	DatabaseName    Name
	SecondaryRegion Name
}

AlterDatabaseSecondaryRegion represents a ALTER DATABASE SET SECONDARY REGION ... statement.

func (*AlterDatabaseSecondaryRegion) Format

func (node *AlterDatabaseSecondaryRegion) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterDatabaseSecondaryRegion) StatementReturnType

func (*AlterDatabaseSecondaryRegion) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterDatabaseSecondaryRegion) StatementTag

func (*AlterDatabaseSecondaryRegion) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterDatabaseSecondaryRegion) StatementType

StatementType implements the Statement interface.

func (*AlterDatabaseSecondaryRegion) String

type AlterDatabaseSetZoneConfigExtension

type AlterDatabaseSetZoneConfigExtension struct {
	// ALTER DATABASE ...
	DatabaseName Name
	// ALTER LOCALITY ...
	LocalityLevel LocalityLevel
	RegionName    Name
	// CONFIGURE ZONE ...
	ZoneConfigSettings
}

AlterDatabaseSetZoneConfigExtension represents a ALTER DATABASE ... ALTER LOCALITY ... CONFIGURE ZONE ... statement.

func (*AlterDatabaseSetZoneConfigExtension) Format

func (node *AlterDatabaseSetZoneConfigExtension) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterDatabaseSetZoneConfigExtension) StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterDatabaseSetZoneConfigExtension) StatementTag

StatementTag returns a short string identifying the type of statement.

func (*AlterDatabaseSetZoneConfigExtension) StatementType

StatementType implements the Statement interface.

func (*AlterDatabaseSetZoneConfigExtension) String

type AlterDatabaseSurvivalGoal

type AlterDatabaseSurvivalGoal struct {
	Name         Name
	SurvivalGoal SurvivalGoal
}

AlterDatabaseSurvivalGoal represents a ALTER DATABASE SURVIVE ... statement.

func (*AlterDatabaseSurvivalGoal) Format

func (node *AlterDatabaseSurvivalGoal) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterDatabaseSurvivalGoal) StatementReturnType

func (*AlterDatabaseSurvivalGoal) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterDatabaseSurvivalGoal) StatementTag

func (*AlterDatabaseSurvivalGoal) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterDatabaseSurvivalGoal) StatementType

func (*AlterDatabaseSurvivalGoal) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterDatabaseSurvivalGoal) String

func (n *AlterDatabaseSurvivalGoal) String() string

type AlterDefaultPrivileges

type AlterDefaultPrivileges struct {
	Roles RoleSpecList
	// True if `ALTER DEFAULT PRIVILEGES FOR ALL ROLES` is executed.
	ForAllRoles bool
	// If Schema is not specified, ALTER DEFAULT PRIVILEGES is being
	// run on the current database.
	Schemas ObjectNamePrefixList

	// Database is only used when converting a granting / revoking incompatible
	// database privileges to an alter default privileges statement.
	// If it is not set, the current database is used.
	Database *Name

	// Only one of Grant or Revoke should be set. IsGrant is used to determine
	// which one is set.
	IsGrant bool
	Grant   AbbreviatedGrant
	Revoke  AbbreviatedRevoke
}

AlterDefaultPrivileges represents an ALTER DEFAULT PRIVILEGES statement.

func (*AlterDefaultPrivileges) Format

func (n *AlterDefaultPrivileges) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterDefaultPrivileges) StatementReturnType

func (*AlterDefaultPrivileges) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterDefaultPrivileges) StatementTag

func (*AlterDefaultPrivileges) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterDefaultPrivileges) StatementType

func (*AlterDefaultPrivileges) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterDefaultPrivileges) String

func (n *AlterDefaultPrivileges) String() string

type AlterFunctionDepExtension

type AlterFunctionDepExtension struct {
	Function  RoutineObj
	Remove    bool
	Extension Name
}

AlterFunctionDepExtension represents the ALTER FUNCTION...DEPENDS ON statement.

func (*AlterFunctionDepExtension) Format

func (node *AlterFunctionDepExtension) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterFunctionDepExtension) StatementReturnType

func (*AlterFunctionDepExtension) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterFunctionDepExtension) StatementTag

func (*AlterFunctionDepExtension) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterFunctionDepExtension) StatementType

func (*AlterFunctionDepExtension) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterFunctionDepExtension) String

func (n *AlterFunctionDepExtension) String() string

type AlterFunctionOptions

type AlterFunctionOptions struct {
	Function RoutineObj
	Options  RoutineOptions
}

AlterFunctionOptions represents a ALTER FUNCTION...action statement.

func (*AlterFunctionOptions) Format

func (node *AlterFunctionOptions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterFunctionOptions) StatementReturnType

func (*AlterFunctionOptions) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterFunctionOptions) StatementTag

func (*AlterFunctionOptions) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterFunctionOptions) StatementType

func (*AlterFunctionOptions) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterFunctionOptions) String

func (n *AlterFunctionOptions) String() string

type AlterIndex

type AlterIndex struct {
	IfExists bool
	Index    TableIndexName
	Cmds     AlterIndexCmds
}

AlterIndex represents an ALTER INDEX statement.

func (*AlterIndex) Format

func (node *AlterIndex) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterIndex) StatementReturnType

func (*AlterIndex) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterIndex) StatementTag

func (*AlterIndex) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterIndex) StatementType

func (*AlterIndex) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterIndex) String

func (n *AlterIndex) String() string

type AlterIndexCmd

type AlterIndexCmd interface {
	NodeFormatter
	// contains filtered or unexported methods
}

AlterIndexCmd represents an index modification operation.

type AlterIndexCmds

type AlterIndexCmds []AlterIndexCmd

AlterIndexCmds represents a list of index alterations.

func (*AlterIndexCmds) Format

func (node *AlterIndexCmds) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterIndexPartitionBy

type AlterIndexPartitionBy struct {
	*PartitionByIndex
}

AlterIndexPartitionBy represents an ALTER INDEX PARTITION BY command.

func (*AlterIndexPartitionBy) Format

func (node *AlterIndexPartitionBy) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterIndexVisible

type AlterIndexVisible struct {
	Index        TableIndexName
	Invisibility IndexInvisibility
	IfExists     bool
}

AlterIndexVisible represents a ALTER INDEX ... [VISIBLE | NOT VISIBLE] statement.

func (*AlterIndexVisible) Format

func (node *AlterIndexVisible) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterIndexVisible) StatementReturnType

func (*AlterIndexVisible) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterIndexVisible) StatementTag

func (*AlterIndexVisible) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterIndexVisible) StatementType

func (*AlterIndexVisible) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterIndexVisible) String

func (n *AlterIndexVisible) String() string

type AlterRole

type AlterRole struct {
	Name      RoleSpec
	IfExists  bool
	IsRole    bool
	KVOptions KVOptions
}

AlterRole represents an `ALTER ROLE ... WITH options` statement.

func (*AlterRole) Format

func (node *AlterRole) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterRole) StatementReturnType

func (*AlterRole) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterRole) StatementTag

func (*AlterRole) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterRole) StatementType

func (*AlterRole) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterRole) String

func (n *AlterRole) String() string

type AlterRoleSet

type AlterRoleSet struct {
	RoleName     RoleSpec
	IfExists     bool
	IsRole       bool
	AllRoles     bool
	DatabaseName Name
	SetOrReset   *SetVar
}

AlterRoleSet represents an `ALTER ROLE ... SET` statement.

func (*AlterRoleSet) Format

func (node *AlterRoleSet) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterRoleSet) StatementReturnType

func (*AlterRoleSet) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterRoleSet) StatementTag

func (*AlterRoleSet) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterRoleSet) StatementType

func (*AlterRoleSet) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterRoleSet) String

func (n *AlterRoleSet) String() string

type AlterRoutineRename

type AlterRoutineRename struct {
	Function  RoutineObj
	NewName   Name
	Procedure bool
}

AlterRoutineRename represents a ALTER FUNCTION...RENAME or ALTER PROCEDURE...RENAME statement.

func (*AlterRoutineRename) Format

func (node *AlterRoutineRename) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterRoutineRename) StatementReturnType

func (*AlterRoutineRename) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterRoutineRename) StatementTag

func (n *AlterRoutineRename) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterRoutineRename) StatementType

func (*AlterRoutineRename) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterRoutineRename) String

func (n *AlterRoutineRename) String() string

type AlterRoutineSetOwner

type AlterRoutineSetOwner struct {
	Function  RoutineObj
	NewOwner  RoleSpec
	Procedure bool
}

AlterRoutineSetOwner represents the ALTER FUNCTION...OWNER TO or ALTER PROCEDURE...OWNER TO statement.

func (*AlterRoutineSetOwner) Format

func (node *AlterRoutineSetOwner) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterRoutineSetOwner) StatementReturnType

func (*AlterRoutineSetOwner) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterRoutineSetOwner) StatementTag

func (n *AlterRoutineSetOwner) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterRoutineSetOwner) StatementType

func (*AlterRoutineSetOwner) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterRoutineSetOwner) String

func (n *AlterRoutineSetOwner) String() string

type AlterRoutineSetSchema

type AlterRoutineSetSchema struct {
	Function      RoutineObj
	NewSchemaName Name
	Procedure     bool
}

AlterRoutineSetSchema represents a ALTER FUNCTION...SET SCHEMA or ALTER PROCEDURE...SET SCHEMA statement.

func (*AlterRoutineSetSchema) Format

func (node *AlterRoutineSetSchema) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterRoutineSetSchema) StatementReturnType

func (*AlterRoutineSetSchema) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterRoutineSetSchema) StatementTag

func (n *AlterRoutineSetSchema) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterRoutineSetSchema) StatementType

func (*AlterRoutineSetSchema) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterRoutineSetSchema) String

func (n *AlterRoutineSetSchema) String() string

type AlterSchema

type AlterSchema struct {
	Schema ObjectNamePrefix
	Cmd    AlterSchemaCmd
}

AlterSchema represents an ALTER SCHEMA statement.

func (*AlterSchema) Format

func (node *AlterSchema) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterSchema) StatementReturnType

func (*AlterSchema) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterSchema) StatementTag

func (*AlterSchema) StatementTag() string

StatementTag implements the Statement interface.

func (*AlterSchema) StatementType

func (*AlterSchema) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterSchema) String

func (n *AlterSchema) String() string

type AlterSchemaCmd

type AlterSchemaCmd interface {
	NodeFormatter
	// contains filtered or unexported methods
}

AlterSchemaCmd represents a schema modification operation.

type AlterSchemaOwner

type AlterSchemaOwner struct {
	Owner RoleSpec
}

AlterSchemaOwner represents an ALTER SCHEMA OWNER TO command.

func (*AlterSchemaOwner) Format

func (node *AlterSchemaOwner) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterSchemaRename

type AlterSchemaRename struct {
	NewName Name
}

AlterSchemaRename represents an ALTER SCHEMA RENAME command.

func (*AlterSchemaRename) Format

func (node *AlterSchemaRename) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AlterSequence

type AlterSequence struct {
	IfExists bool
	Name     *UnresolvedObjectName
	Options  SequenceOptions
}

AlterSequence represents an ALTER SEQUENCE statement, except in the case of ALTER SEQUENCE <seqName> RENAME TO <newSeqName>, which is represented by a RenameTable node.

func (*AlterSequence) Format

func (node *AlterSequence) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterSequence) StatementReturnType

func (*AlterSequence) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterSequence) StatementTag

func (*AlterSequence) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterSequence) StatementType

func (*AlterSequence) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterSequence) String

func (n *AlterSequence) String() string

type AlterTable

type AlterTable struct {
	IfExists bool
	Table    *UnresolvedObjectName
	Cmds     AlterTableCmds
}

AlterTable represents an ALTER TABLE statement.

func (*AlterTable) Format

func (node *AlterTable) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTable) HoistAddColumnConstraints

func (node *AlterTable) HoistAddColumnConstraints(onHoistedFKConstraint func())

HoistAddColumnConstraints converts column constraints in ADD COLUMN commands, stored in node.Cmds, into top-level commands to add those constraints. Currently, this only applies to checks. For example, the ADD COLUMN in

ALTER TABLE t ADD COLUMN a INT CHECK (a < 1)

is transformed into two commands, as in

ALTER TABLE t ADD COLUMN a INT, ADD CONSTRAINT check_a CHECK (a < 1)

(with an auto-generated name).

Note that some SQL databases require that a constraint attached to a column to refer only to the column it is attached to. We follow Postgres' behavior, however, in omitting this restriction by blindly hoisting all column constraints. For example, the following statement is accepted in CockroachDB and Postgres, but not necessarily other SQL databases:

ALTER TABLE t ADD COLUMN a INT CHECK (a < b)

func (*AlterTable) StatementReturnType

func (*AlterTable) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterTable) StatementTag

func (*AlterTable) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterTable) StatementType

func (*AlterTable) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterTable) String

func (n *AlterTable) String() string

type AlterTableAddColumn

type AlterTableAddColumn struct {
	IfNotExists bool
	ColumnDef   *ColumnTableDef
}

AlterTableAddColumn represents an ADD COLUMN command.

func (*AlterTableAddColumn) Format

func (node *AlterTableAddColumn) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableAddColumn) String

func (n *AlterTableAddColumn) String() string

func (*AlterTableAddColumn) TelemetryName

func (node *AlterTableAddColumn) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableAddConstraint

type AlterTableAddConstraint struct {
	ConstraintDef      ConstraintTableDef
	ValidationBehavior ValidationBehavior
}

AlterTableAddConstraint represents an ADD CONSTRAINT command.

func (*AlterTableAddConstraint) Format

func (node *AlterTableAddConstraint) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableAddConstraint) String

func (n *AlterTableAddConstraint) String() string

func (*AlterTableAddConstraint) TelemetryName

func (node *AlterTableAddConstraint) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableAlterColumnType

type AlterTableAlterColumnType struct {
	Collation string
	Column    Name
	ToType    ResolvableTypeReference
	Using     Expr
}

AlterTableAlterColumnType represents an ALTER TABLE ALTER COLUMN TYPE command.

func (*AlterTableAlterColumnType) Format

func (node *AlterTableAlterColumnType) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableAlterColumnType) GetColumn

func (node *AlterTableAlterColumnType) GetColumn() Name

GetColumn implements the ColumnMutationCmd interface.

func (*AlterTableAlterColumnType) String

func (n *AlterTableAlterColumnType) String() string

func (*AlterTableAlterColumnType) TelemetryName

func (node *AlterTableAlterColumnType) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableAlterPrimaryKey

type AlterTableAlterPrimaryKey struct {
	Columns       IndexElemList
	Sharded       *ShardedIndexDef
	Name          Name
	StorageParams StorageParams
}

AlterTableAlterPrimaryKey represents an ALTER TABLE ALTER PRIMARY KEY command.

func (*AlterTableAlterPrimaryKey) Format

func (node *AlterTableAlterPrimaryKey) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableAlterPrimaryKey) TelemetryName

func (node *AlterTableAlterPrimaryKey) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableCmd

type AlterTableCmd interface {
	NodeFormatter
	// TelemetryName returns the counter name to use for telemetry purposes.
	TelemetryName() string
	// contains filtered or unexported methods
}

AlterTableCmd represents a table modification operation.

type AlterTableCmds

type AlterTableCmds []AlterTableCmd

AlterTableCmds represents a list of table alterations.

func (*AlterTableCmds) Format

func (node *AlterTableCmds) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableCmds) String

func (n *AlterTableCmds) String() string

type AlterTableDropColumn

type AlterTableDropColumn struct {
	IfExists     bool
	Column       Name
	DropBehavior DropBehavior
}

AlterTableDropColumn represents a DROP COLUMN command.

func (*AlterTableDropColumn) Format

func (node *AlterTableDropColumn) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableDropColumn) String

func (n *AlterTableDropColumn) String() string

func (*AlterTableDropColumn) TelemetryName

func (node *AlterTableDropColumn) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableDropConstraint

type AlterTableDropConstraint struct {
	IfExists     bool
	Constraint   Name
	DropBehavior DropBehavior
}

AlterTableDropConstraint represents a DROP CONSTRAINT command.

func (*AlterTableDropConstraint) Format

func (node *AlterTableDropConstraint) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableDropConstraint) String

func (n *AlterTableDropConstraint) String() string

func (*AlterTableDropConstraint) TelemetryName

func (node *AlterTableDropConstraint) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableDropNotNull

type AlterTableDropNotNull struct {
	Column Name
}

AlterTableDropNotNull represents an ALTER COLUMN DROP NOT NULL command.

func (*AlterTableDropNotNull) Format

func (node *AlterTableDropNotNull) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableDropNotNull) GetColumn

func (node *AlterTableDropNotNull) GetColumn() Name

GetColumn implements the ColumnMutationCmd interface.

func (*AlterTableDropNotNull) String

func (n *AlterTableDropNotNull) String() string

func (*AlterTableDropNotNull) TelemetryName

func (node *AlterTableDropNotNull) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableDropStored

type AlterTableDropStored struct {
	Column Name
}

AlterTableDropStored represents an ALTER COLUMN DROP STORED command to remove the computed-ness from a column.

func (*AlterTableDropStored) Format

func (node *AlterTableDropStored) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableDropStored) GetColumn

func (node *AlterTableDropStored) GetColumn() Name

GetColumn implemnets the ColumnMutationCmd interface.

func (*AlterTableDropStored) String

func (n *AlterTableDropStored) String() string

func (*AlterTableDropStored) TelemetryName

func (node *AlterTableDropStored) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableInjectStats

type AlterTableInjectStats struct {
	Stats Expr
}

AlterTableInjectStats represents an ALTER TABLE INJECT STATISTICS statement.

func (*AlterTableInjectStats) Format

func (node *AlterTableInjectStats) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableInjectStats) TelemetryName

func (node *AlterTableInjectStats) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableLocality

type AlterTableLocality struct {
	Name     *UnresolvedObjectName
	IfExists bool
	Locality *Locality
}

AlterTableLocality represents an ALTER TABLE LOCALITY command.

func (*AlterTableLocality) Format

func (node *AlterTableLocality) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableLocality) StatementReturnType

func (*AlterTableLocality) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterTableLocality) StatementTag

func (*AlterTableLocality) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterTableLocality) StatementType

func (*AlterTableLocality) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterTableLocality) String

func (n *AlterTableLocality) String() string

type AlterTableOwner

type AlterTableOwner struct {
	Name           *UnresolvedObjectName
	Owner          RoleSpec
	IfExists       bool
	IsView         bool
	IsMaterialized bool
	IsSequence     bool
}

AlterTableOwner represents an ALTER TABLE OWNER TO command.

func (*AlterTableOwner) Format

func (node *AlterTableOwner) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableOwner) StatementReturnType

func (*AlterTableOwner) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterTableOwner) StatementTag

func (*AlterTableOwner) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterTableOwner) StatementType

func (*AlterTableOwner) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterTableOwner) String

func (n *AlterTableOwner) String() string

func (*AlterTableOwner) TelemetryName

func (node *AlterTableOwner) TelemetryName() string

TelemetryName returns the telemetry counter to increment when this command is used.

type AlterTablePartitionByTable

type AlterTablePartitionByTable struct {
	*PartitionByTable
}

AlterTablePartitionByTable represents an ALTER TABLE PARTITION [ALL] BY command.

func (*AlterTablePartitionByTable) Format

func (node *AlterTablePartitionByTable) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTablePartitionByTable) TelemetryName

func (node *AlterTablePartitionByTable) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableRenameColumn

type AlterTableRenameColumn struct {
	Column  Name
	NewName Name
}

AlterTableRenameColumn represents an ALTER TABLE RENAME [COLUMN] command.

func (*AlterTableRenameColumn) Format

func (node *AlterTableRenameColumn) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableRenameColumn) TelemetryName

func (node *AlterTableRenameColumn) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableRenameConstraint

type AlterTableRenameConstraint struct {
	Constraint Name
	NewName    Name
}

AlterTableRenameConstraint represents an ALTER TABLE RENAME CONSTRAINT command.

func (*AlterTableRenameConstraint) Format

func (node *AlterTableRenameConstraint) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableRenameConstraint) TelemetryName

func (node *AlterTableRenameConstraint) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableResetStorageParams

type AlterTableResetStorageParams struct {
	Params NameList
}

AlterTableResetStorageParams represents a ALTER TABLE RESET command.

func (*AlterTableResetStorageParams) Format

func (node *AlterTableResetStorageParams) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableResetStorageParams) TelemetryName

func (node *AlterTableResetStorageParams) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableSetAudit

type AlterTableSetAudit struct {
	Mode AuditMode
}

AlterTableSetAudit represents an ALTER TABLE AUDIT SET statement.

func (*AlterTableSetAudit) Format

func (node *AlterTableSetAudit) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableSetAudit) TelemetryName

func (node *AlterTableSetAudit) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableSetDefault

type AlterTableSetDefault struct {
	Column  Name
	Default Expr
}

AlterTableSetDefault represents an ALTER COLUMN SET DEFAULT or DROP DEFAULT command.

func (*AlterTableSetDefault) Format

func (node *AlterTableSetDefault) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableSetDefault) GetColumn

func (node *AlterTableSetDefault) GetColumn() Name

GetColumn implements the ColumnMutationCmd interface.

func (*AlterTableSetDefault) String

func (n *AlterTableSetDefault) String() string

func (*AlterTableSetDefault) TelemetryName

func (node *AlterTableSetDefault) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableSetNotNull

type AlterTableSetNotNull struct {
	Column Name
}

AlterTableSetNotNull represents an ALTER COLUMN SET NOT NULL command.

func (*AlterTableSetNotNull) Format

func (node *AlterTableSetNotNull) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableSetNotNull) GetColumn

func (node *AlterTableSetNotNull) GetColumn() Name

GetColumn implements the ColumnMutationCmd interface.

func (*AlterTableSetNotNull) String

func (n *AlterTableSetNotNull) String() string

func (*AlterTableSetNotNull) TelemetryName

func (node *AlterTableSetNotNull) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableSetOnUpdate

type AlterTableSetOnUpdate struct {
	Column Name
	Expr   Expr
}

AlterTableSetOnUpdate represents an ALTER COLUMN ON UPDATE SET or DROP ON UPDATE command.

func (*AlterTableSetOnUpdate) Format

func (node *AlterTableSetOnUpdate) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableSetOnUpdate) GetColumn

func (node *AlterTableSetOnUpdate) GetColumn() Name

GetColumn implements the ColumnMutationCmd interface.

func (*AlterTableSetOnUpdate) TelemetryName

func (node *AlterTableSetOnUpdate) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableSetSchema

type AlterTableSetSchema struct {
	Name           *UnresolvedObjectName
	Schema         Name
	IfExists       bool
	IsView         bool
	IsMaterialized bool
	IsSequence     bool
}

AlterTableSetSchema represents an ALTER TABLE SET SCHEMA command.

func (*AlterTableSetSchema) Format

func (node *AlterTableSetSchema) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableSetSchema) StatementReturnType

func (*AlterTableSetSchema) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterTableSetSchema) StatementTag

func (n *AlterTableSetSchema) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterTableSetSchema) StatementType

func (*AlterTableSetSchema) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterTableSetSchema) String

func (n *AlterTableSetSchema) String() string

func (*AlterTableSetSchema) TelemetryName

func (node *AlterTableSetSchema) TelemetryName() string

TelemetryName returns the telemetry counter to increment when this command is used.

type AlterTableSetStorageParams

type AlterTableSetStorageParams struct {
	StorageParams StorageParams
}

AlterTableSetStorageParams represents a ALTER TABLE SET command.

func (*AlterTableSetStorageParams) Format

func (node *AlterTableSetStorageParams) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableSetStorageParams) TelemetryName

func (node *AlterTableSetStorageParams) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableSetVisible

type AlterTableSetVisible struct {
	Column  Name
	Visible bool
}

AlterTableSetVisible represents an ALTER COLUMN SET VISIBLE or NOT VISIBLE command.

func (*AlterTableSetVisible) Format

func (node *AlterTableSetVisible) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableSetVisible) GetColumn

func (node *AlterTableSetVisible) GetColumn() Name

GetColumn implements the ColumnMutationCmd interface.

func (*AlterTableSetVisible) String

func (n *AlterTableSetVisible) String() string

func (*AlterTableSetVisible) TelemetryName

func (node *AlterTableSetVisible) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTableValidateConstraint

type AlterTableValidateConstraint struct {
	Constraint Name
}

AlterTableValidateConstraint represents a VALIDATE CONSTRAINT command.

func (*AlterTableValidateConstraint) Format

func (node *AlterTableValidateConstraint) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTableValidateConstraint) TelemetryName

func (node *AlterTableValidateConstraint) TelemetryName() string

TelemetryName implements the AlterTableCmd interface.

type AlterTenantCapability

type AlterTenantCapability struct {
	TenantSpec   *TenantSpec
	Capabilities []TenantCapability
	IsRevoke     bool

	AllCapabilities bool
}

AlterTenantCapability represents an ALTER VIRTUAL CLUSTER CAPABILITY statement.

func (*AlterTenantCapability) Format

func (n *AlterTenantCapability) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTenantCapability) StatementReturnType

func (*AlterTenantCapability) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterTenantCapability) StatementTag

func (*AlterTenantCapability) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterTenantCapability) StatementType

func (*AlterTenantCapability) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterTenantCapability) String

func (n *AlterTenantCapability) String() string

type AlterTenantRename

type AlterTenantRename struct {
	TenantSpec *TenantSpec

	// For NewName we only support the name syntax, not the numeric
	// syntax. So we could make-do with just an Expr here. However, we
	// like to use TenantSpec as a container for that name because it
	// takes care of pretty-printing with all the special rules. See the
	// doc of (*TenantSpec).Format() for details.
	NewName *TenantSpec
}

AlterTenantRename represents an ALTER VIRTUAL CLUSTER RENAME statement.

func (*AlterTenantRename) Format

func (n *AlterTenantRename) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTenantRename) StatementReturnType

func (*AlterTenantRename) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterTenantRename) StatementTag

func (*AlterTenantRename) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterTenantRename) StatementType

func (*AlterTenantRename) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterTenantRename) String

func (n *AlterTenantRename) String() string

type AlterTenantReplication

type AlterTenantReplication struct {
	TenantSpec *TenantSpec
	Command    JobCommand
	Cutover    *ReplicationCutoverTime
	Options    TenantReplicationOptions
}

AlterTenantReplication represents an ALTER VIRTUAL CLUSTER REPLICATION statement.

func (*AlterTenantReplication) Format

func (n *AlterTenantReplication) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTenantReplication) StatementReturnType

func (*AlterTenantReplication) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterTenantReplication) StatementTag

func (*AlterTenantReplication) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterTenantReplication) StatementType

func (*AlterTenantReplication) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterTenantReplication) String

func (n *AlterTenantReplication) String() string

type AlterTenantService

type AlterTenantService struct {
	TenantSpec *TenantSpec
	Command    TenantServiceCmd
}

AlterTenantService represents an ALTER VIRTUAL CLUSTER START/STOP SERVICE statement.

func (*AlterTenantService) Format

func (n *AlterTenantService) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTenantService) StatementReturnType

func (*AlterTenantService) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterTenantService) StatementTag

func (*AlterTenantService) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterTenantService) StatementType

func (*AlterTenantService) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterTenantService) String

func (n *AlterTenantService) String() string

type AlterTenantSetClusterSetting

type AlterTenantSetClusterSetting struct {
	SetClusterSetting
	TenantSpec *TenantSpec
}

AlterTenantSetClusterSetting represents an ALTER VIRTUAL CLUSTER SET CLUSTER SETTING statement.

func (*AlterTenantSetClusterSetting) Format

func (n *AlterTenantSetClusterSetting) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTenantSetClusterSetting) StatementReturnType

func (*AlterTenantSetClusterSetting) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterTenantSetClusterSetting) StatementTag

func (*AlterTenantSetClusterSetting) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterTenantSetClusterSetting) StatementType

StatementType implements the Statement interface.

func (*AlterTenantSetClusterSetting) String

type AlterType

type AlterType struct {
	Type *UnresolvedObjectName
	Cmd  AlterTypeCmd
}

AlterType represents an ALTER TYPE statement.

func (*AlterType) Format

func (node *AlterType) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterType) StatementReturnType

func (*AlterType) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*AlterType) StatementTag

func (*AlterType) StatementTag() string

StatementTag implements the Statement interface.

func (*AlterType) StatementType

func (*AlterType) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterType) String

func (n *AlterType) String() string

type AlterTypeAddValue

type AlterTypeAddValue struct {
	NewVal      EnumValue
	IfNotExists bool
	Placement   *AlterTypeAddValuePlacement
}

AlterTypeAddValue represents an ALTER TYPE ADD VALUE command.

func (*AlterTypeAddValue) Format

func (node *AlterTypeAddValue) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTypeAddValue) TelemetryName

func (node *AlterTypeAddValue) TelemetryName() string

TelemetryName implements the AlterTypeCmd interface.

type AlterTypeAddValuePlacement

type AlterTypeAddValuePlacement struct {
	Before      bool
	ExistingVal EnumValue
}

AlterTypeAddValuePlacement represents the placement clause for an ALTER TYPE ADD VALUE command ([BEFORE | AFTER] value).

type AlterTypeCmd

type AlterTypeCmd interface {
	NodeFormatter

	// TelemetryName returns the counter name to use for telemetry purposes.
	TelemetryName() string
	// contains filtered or unexported methods
}

AlterTypeCmd represents a type modification operation.

type AlterTypeDropValue

type AlterTypeDropValue struct {
	Val EnumValue
}

AlterTypeDropValue represents an ALTER TYPE DROP VALUE command.

func (*AlterTypeDropValue) Format

func (node *AlterTypeDropValue) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTypeDropValue) TelemetryName

func (node *AlterTypeDropValue) TelemetryName() string

TelemetryName implements the AlterTypeCmd interface.

type AlterTypeOwner

type AlterTypeOwner struct {
	Owner RoleSpec
}

AlterTypeOwner represents an ALTER TYPE OWNER TO command.

func (*AlterTypeOwner) Format

func (node *AlterTypeOwner) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTypeOwner) TelemetryName

func (node *AlterTypeOwner) TelemetryName() string

TelemetryName implements the AlterTypeCmd interface.

type AlterTypeRename

type AlterTypeRename struct {
	NewName Name
}

AlterTypeRename represents an ALTER TYPE RENAME command.

func (*AlterTypeRename) Format

func (node *AlterTypeRename) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTypeRename) TelemetryName

func (node *AlterTypeRename) TelemetryName() string

TelemetryName implements the AlterTypeCmd interface.

type AlterTypeRenameValue

type AlterTypeRenameValue struct {
	OldVal EnumValue
	NewVal EnumValue
}

AlterTypeRenameValue represents an ALTER TYPE RENAME VALUE command.

func (*AlterTypeRenameValue) Format

func (node *AlterTypeRenameValue) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTypeRenameValue) TelemetryName

func (node *AlterTypeRenameValue) TelemetryName() string

TelemetryName implements the AlterTypeCmd interface.

type AlterTypeSetSchema

type AlterTypeSetSchema struct {
	Schema Name
}

AlterTypeSetSchema represents an ALTER TYPE SET SCHEMA command.

func (*AlterTypeSetSchema) Format

func (node *AlterTypeSetSchema) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AlterTypeSetSchema) TelemetryName

func (node *AlterTypeSetSchema) TelemetryName() string

TelemetryName implements the AlterTypeCmd interface.

type Analyze

type Analyze struct {
	Table TableExpr
}

Analyze represents an ANALYZE statement.

func (*Analyze) Format

func (node *Analyze) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Analyze) StatementReturnType

func (*Analyze) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Analyze) StatementTag

func (*Analyze) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Analyze) StatementType

func (*Analyze) StatementType() StatementType

StatementType implements the Statement interface.

func (*Analyze) String

func (n *Analyze) String() string

type AndExpr

type AndExpr struct {
	Left, Right Expr
	// contains filtered or unexported fields
}

AndExpr represents an AND expression.

func NewTypedAndExpr

func NewTypedAndExpr(left, right TypedExpr) *AndExpr

NewTypedAndExpr returns a new AndExpr that is verified to be well-typed.

func (*AndExpr) Eval

func (node *AndExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*AndExpr) Format

func (node *AndExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (AndExpr) ResolvedType

func (ta AndExpr) ResolvedType() *types.T

func (*AndExpr) String

func (node *AndExpr) String() string

func (*AndExpr) TypeCheck

func (expr *AndExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*AndExpr) TypedLeft

func (node *AndExpr) TypedLeft() TypedExpr

TypedLeft returns the AndExpr's left expression as a TypedExpr.

func (*AndExpr) TypedRight

func (node *AndExpr) TypedRight() TypedExpr

TypedRight returns the AndExpr's right expression as a TypedExpr.

func (*AndExpr) Walk

func (expr *AndExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type AnnotateTypeExpr

type AnnotateTypeExpr struct {
	Expr Expr
	Type ResolvableTypeReference

	SyntaxMode annotateSyntaxMode
}

AnnotateTypeExpr represents a ANNOTATE_TYPE(expr, type) expression.

func (*AnnotateTypeExpr) Format

func (node *AnnotateTypeExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*AnnotateTypeExpr) String

func (node *AnnotateTypeExpr) String() string

func (*AnnotateTypeExpr) TypeCheck

func (expr *AnnotateTypeExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*AnnotateTypeExpr) TypedInnerExpr

func (node *AnnotateTypeExpr) TypedInnerExpr() TypedExpr

TypedInnerExpr returns the AnnotateTypeExpr's inner expression as a TypedExpr.

func (*AnnotateTypeExpr) Walk

func (expr *AnnotateTypeExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type AnnotatedNode

type AnnotatedNode struct {
	AnnIdx AnnotationIdx
}

AnnotatedNode is embedded in AST nodes that have an annotation.

func (AnnotatedNode) GetAnnotation

func (n AnnotatedNode) GetAnnotation(ann *Annotations) interface{}

GetAnnotation retrieves the annotation associated with this node.

func (AnnotatedNode) SetAnnotation

func (n AnnotatedNode) SetAnnotation(ann *Annotations, annotation interface{})

SetAnnotation sets the annotation associated with this node.

type AnnotationIdx

type AnnotationIdx int32

AnnotationIdx is the 1-based index of an annotation. AST nodes that can be annotated store such an index (unique within that AST).

const NoAnnotation AnnotationIdx = 0

NoAnnotation is the uninitialized annotation index.

type Annotations

type Annotations []interface{}

Annotations is a container for AST annotations.

func MakeAnnotations

func MakeAnnotations(numAnnotations AnnotationIdx) Annotations

MakeAnnotations allocates an annotations container of the given size.

func (*Annotations) Get

func (a *Annotations) Get(idx AnnotationIdx) interface{}

Get an annotation from the container.

func (*Annotations) Set

func (a *Annotations) Set(idx AnnotationIdx, annotation interface{})

Set an annotation in the container.

type AppendToMaybeNullArrayOp

type AppendToMaybeNullArrayOp struct {
	Typ *types.T
}

AppendToMaybeNullArrayOp is a BinaryEvalOp.

func (*AppendToMaybeNullArrayOp) Eval

Eval is part of the BinaryEvalOp interface.

type Array

type Array struct {
	Exprs Exprs
	// contains filtered or unexported fields
}

Array represents an array constructor.

func NewTypedArray

func NewTypedArray(typedExprs TypedExprs, typ *types.T) *Array

NewTypedArray returns an Array that is well-typed.

func (*Array) Eval

func (node *Array) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*Array) Format

func (node *Array) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (Array) ResolvedType

func (ta Array) ResolvedType() *types.T

func (*Array) String

func (node *Array) String() string

func (*Array) TypeCheck

func (expr *Array) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*Array) Walk

func (expr *Array) Walk(v Visitor) Expr

Walk implements the Expr interface.

type ArrayFlatten

type ArrayFlatten struct {
	Subquery Expr
	// contains filtered or unexported fields
}

ArrayFlatten represents a subquery array constructor.

func NewTypedArrayFlattenExpr

func NewTypedArrayFlattenExpr(input Expr) *ArrayFlatten

NewTypedArrayFlattenExpr returns a new ArrayFlattenExpr that is verified to be well-typed.

func (*ArrayFlatten) Eval

func (node *ArrayFlatten) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*ArrayFlatten) Format

func (node *ArrayFlatten) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (ArrayFlatten) ResolvedType

func (ta ArrayFlatten) ResolvedType() *types.T

func (*ArrayFlatten) String

func (node *ArrayFlatten) String() string

func (*ArrayFlatten) TypeCheck

func (expr *ArrayFlatten) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*ArrayFlatten) Walk

func (expr *ArrayFlatten) Walk(v Visitor) Expr

Walk implements the Expr interface.

type ArraySubscript

type ArraySubscript struct {
	Begin Expr
	End   Expr
	Slice bool
}

ArraySubscript corresponds to the syntax `<name>[ ... ]`.

func (*ArraySubscript) Format

func (a *ArraySubscript) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type ArraySubscripts

type ArraySubscripts []*ArraySubscript

ArraySubscripts represents a sequence of one or more array subscripts.

func (*ArraySubscripts) Format

func (a *ArraySubscripts) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type ArrayTypeReference

type ArrayTypeReference struct {
	ElementType ResolvableTypeReference
}

ArrayTypeReference represents an array of possibly unknown type references.

func (*ArrayTypeReference) Format

func (node *ArrayTypeReference) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ArrayTypeReference) SQLString

func (node *ArrayTypeReference) SQLString() string

SQLString implements the ResolvableTypeReference interface.

type AsOfClause

type AsOfClause struct {
	Expr Expr
}

AsOfClause represents an as of time.

func (*AsOfClause) Format

func (a *AsOfClause) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type AuditMode

type AuditMode int

AuditMode represents a table audit mode

const (
	// AuditModeDisable is the default mode - no audit.
	AuditModeDisable AuditMode = iota
	// AuditModeReadWrite enables audit on read or write statements.
	AuditModeReadWrite
)

func (AuditMode) String

func (m AuditMode) String() string

func (AuditMode) TelemetryName

func (m AuditMode) TelemetryName() string

TelemetryName returns a friendly string for use in telemetry that represents the AuditMode.

type Backup

type Backup struct {
	Targets *BackupTargetList

	// To is set to the root directory of the backup (called the <destination> in
	// the docs).
	To StringOrPlaceholderOptList

	// IncrementalFrom is only set for the old 'BACKUP .... TO ...' syntax.
	IncrementalFrom Exprs

	AsOf    AsOfClause
	Options BackupOptions

	// Nested is set to true when the user creates a backup with
	//`BACKUP ... INTO... ` syntax.
	Nested bool

	// AppendToLatest is set to true if the user creates a backup with
	//`BACKUP...INTO LATEST...`
	AppendToLatest bool

	// Subdir may be set by the parser when the SQL query is of the form `BACKUP
	// INTO 'subdir' IN...`. Alternatively, if Nested is true but a subdir was not
	// explicitly specified by the user, then this will be set during BACKUP
	// planning once the destination has been resolved.
	Subdir Expr
}

Backup represents a BACKUP statement.

func (Backup) Coverage

func (node Backup) Coverage() DescriptorCoverage

Coverage return the coverage (all vs requested).

func (*Backup) Format

func (node *Backup) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Backup) StatementReturnType

func (*Backup) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Backup) StatementTag

func (*Backup) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Backup) StatementType

func (*Backup) StatementType() StatementType

StatementType implements the Statement interface.

func (*Backup) String

func (n *Backup) String() string

type BackupKMS

type BackupKMS struct {
	NewKMSURI StringOrPlaceholderOptList
	OldKMSURI StringOrPlaceholderOptList
}

BackupKMS represents possible options used when altering a backup KMS

type BackupOptions

type BackupOptions struct {
	CaptureRevisionHistory          Expr
	IncludeAllSecondaryTenants      Expr
	EncryptionPassphrase            Expr
	Detached                        *DBool
	EncryptionKMSURI                StringOrPlaceholderOptList
	IncrementalStorage              StringOrPlaceholderOptList
	ExecutionLocality               Expr
	UpdatesClusterMonitoringMetrics Expr
}

BackupOptions describes options for the BACKUP execution.

func (*BackupOptions) CombineWith

func (o *BackupOptions) CombineWith(other *BackupOptions) error

CombineWith merges other backup options into this backup options struct. An error is returned if the same option merged multiple times.

func (*BackupOptions) Format

func (o *BackupOptions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface

func (BackupOptions) IsDefault

func (o BackupOptions) IsDefault() bool

IsDefault returns true if this backup options struct has default value.

type BackupTargetList

type BackupTargetList struct {
	Databases NameList
	Schemas   ObjectNamePrefixList
	Tables    TableAttrs
	TenantID  TenantID
}

BackupTargetList represents a list of targets. Only one field may be non-nil.

func (*BackupTargetList) Format

func (tl *BackupTargetList) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type Batch

type Batch struct {
	Params []BatchParam
}

Batch represents a BATCH clause.

func (*Batch) Format

func (b *Batch) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type BatchParam

type BatchParam interface {
	NodeFormatter
}

type BeginTransaction

type BeginTransaction struct {
	// FormatWithStart says whether this statement must be formatted with
	// "START" rather than "BEGIN". This is needed if this statement is in a
	// BEGIN ATOMIC block of a procedure or function.
	FormatWithStart bool
	Modes           TransactionModes
}

BeginTransaction represents a BEGIN statement

func (*BeginTransaction) Format

func (node *BeginTransaction) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*BeginTransaction) StatementReturnType

func (*BeginTransaction) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*BeginTransaction) StatementTag

func (*BeginTransaction) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*BeginTransaction) StatementType

func (*BeginTransaction) StatementType() StatementType

StatementType implements the Statement interface.

func (*BeginTransaction) String

func (n *BeginTransaction) String() string

type BinOp

type BinOp struct {
	LeftType          *types.T
	RightType         *types.T
	ReturnType        *types.T
	CalledOnNullInput bool
	EvalOp            BinaryEvalOp
	Volatility        volatility.V
	PreferredOverload bool

	OnTypeCheck func()
	// contains filtered or unexported fields
}

BinOp is a binary operator.

func FindBinaryOverload

func FindBinaryOverload(
	bin treebin.BinaryOperatorSymbol, leftType, rightType *types.T,
) (ret *BinOp, ok bool)

FindBinaryOverload finds the correct type signature overload for the specified binary operator, given the types of its inputs. If an overload is found, FindBinaryOverload returns true, plus a pointer to the overload. If an overload is not found, FindBinaryOverload returns false.

type BinOpOverloads

type BinOpOverloads struct {
	// contains filtered or unexported fields
}

BinOpOverloads is an overloaded set of binary operator implementations. It implements overloadSet.

func (*BinOpOverloads) ForEachBinOp

func (o *BinOpOverloads) ForEachBinOp(f func(op *BinOp) error) error

ForEachBinOp iterates the BinOps in the set.

func (*BinOpOverloads) LookupImpl

func (o *BinOpOverloads) LookupImpl(left, right *types.T) (*BinOp, bool)

LookupImpl can be used to look up the overload which match the requested types.

type BinaryEvalOp

type BinaryEvalOp interface {
	Eval(context.Context, OpEvaluator, Datum, Datum) (Datum, error)
}

BinaryEvalOp is a binary operation which can be evaluated.

type BinaryExpr

type BinaryExpr struct {
	Operator    treebin.BinaryOperator
	Left, Right Expr

	Op *BinOp
	// contains filtered or unexported fields
}

BinaryExpr represents a binary value expression.

func NewBinExprIfValidOverload

func NewBinExprIfValidOverload(
	op treebin.BinaryOperator, left TypedExpr, right TypedExpr,
) *BinaryExpr

NewBinExprIfValidOverload constructs a new BinaryExpr if and only if the pair of arguments have a valid implementation for the given BinaryOperator.

func NewTypedBinaryExpr

func NewTypedBinaryExpr(
	op treebin.BinaryOperator, left, right TypedExpr, typ *types.T,
) *BinaryExpr

NewTypedBinaryExpr returns a new BinaryExpr that is well-typed.

func (*BinaryExpr) Eval

func (node *BinaryExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*BinaryExpr) Format

func (node *BinaryExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*BinaryExpr) ResolvedBinOp

func (node *BinaryExpr) ResolvedBinOp() *BinOp

ResolvedBinOp returns the resolved binary op overload; can only be called after Resolve (which happens during TypeCheck).

func (BinaryExpr) ResolvedType

func (ta BinaryExpr) ResolvedType() *types.T

func (*BinaryExpr) String

func (node *BinaryExpr) String() string

func (*BinaryExpr) TypeCheck

func (expr *BinaryExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*BinaryExpr) TypedLeft

func (node *BinaryExpr) TypedLeft() TypedExpr

TypedLeft returns the BinaryExpr's left expression as a TypedExpr.

func (*BinaryExpr) TypedRight

func (node *BinaryExpr) TypedRight() TypedExpr

TypedRight returns the BinaryExpr's right expression as a TypedExpr.

func (*BinaryExpr) Walk

func (expr *BinaryExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type BinaryOpEvaluator

type BinaryOpEvaluator interface {
	EvalAppendToMaybeNullArrayOp(context.Context, *AppendToMaybeNullArrayOp, Datum, Datum) (Datum, error)
	EvalBitAndINetOp(context.Context, *BitAndINetOp, Datum, Datum) (Datum, error)
	EvalBitAndIntOp(context.Context, *BitAndIntOp, Datum, Datum) (Datum, error)
	EvalBitAndVarBitOp(context.Context, *BitAndVarBitOp, Datum, Datum) (Datum, error)
	EvalBitOrINetOp(context.Context, *BitOrINetOp, Datum, Datum) (Datum, error)
	EvalBitOrIntOp(context.Context, *BitOrIntOp, Datum, Datum) (Datum, error)
	EvalBitOrVarBitOp(context.Context, *BitOrVarBitOp, Datum, Datum) (Datum, error)
	EvalBitXorIntOp(context.Context, *BitXorIntOp, Datum, Datum) (Datum, error)
	EvalBitXorVarBitOp(context.Context, *BitXorVarBitOp, Datum, Datum) (Datum, error)
	EvalCompareBox2DOp(context.Context, *CompareBox2DOp, Datum, Datum) (Datum, error)
	EvalCompareScalarOp(context.Context, *CompareScalarOp, Datum, Datum) (Datum, error)
	EvalCompareTupleOp(context.Context, *CompareTupleOp, Datum, Datum) (Datum, error)
	EvalConcatArraysOp(context.Context, *ConcatArraysOp, Datum, Datum) (Datum, error)
	EvalConcatBytesOp(context.Context, *ConcatBytesOp, Datum, Datum) (Datum, error)
	EvalConcatJsonbOp(context.Context, *ConcatJsonbOp, Datum, Datum) (Datum, error)
	EvalConcatOp(context.Context, *ConcatOp, Datum, Datum) (Datum, error)
	EvalConcatStringOp(context.Context, *ConcatStringOp, Datum, Datum) (Datum, error)
	EvalConcatVarBitOp(context.Context, *ConcatVarBitOp, Datum, Datum) (Datum, error)
	EvalContainedByArrayOp(context.Context, *ContainedByArrayOp, Datum, Datum) (Datum, error)
	EvalContainedByJsonbOp(context.Context, *ContainedByJsonbOp, Datum, Datum) (Datum, error)
	EvalContainsArrayOp(context.Context, *ContainsArrayOp, Datum, Datum) (Datum, error)
	EvalContainsJsonbOp(context.Context, *ContainsJsonbOp, Datum, Datum) (Datum, error)
	EvalDivDecimalIntOp(context.Context, *DivDecimalIntOp, Datum, Datum) (Datum, error)
	EvalDivDecimalOp(context.Context, *DivDecimalOp, Datum, Datum) (Datum, error)
	EvalDivFloatOp(context.Context, *DivFloatOp, Datum, Datum) (Datum, error)
	EvalDivIntDecimalOp(context.Context, *DivIntDecimalOp, Datum, Datum) (Datum, error)
	EvalDivIntOp(context.Context, *DivIntOp, Datum, Datum) (Datum, error)
	EvalDivIntervalFloatOp(context.Context, *DivIntervalFloatOp, Datum, Datum) (Datum, error)
	EvalDivIntervalIntOp(context.Context, *DivIntervalIntOp, Datum, Datum) (Datum, error)
	EvalFloorDivDecimalIntOp(context.Context, *FloorDivDecimalIntOp, Datum, Datum) (Datum, error)
	EvalFloorDivDecimalOp(context.Context, *FloorDivDecimalOp, Datum, Datum) (Datum, error)
	EvalFloorDivFloatOp(context.Context, *FloorDivFloatOp, Datum, Datum) (Datum, error)
	EvalFloorDivIntDecimalOp(context.Context, *FloorDivIntDecimalOp, Datum, Datum) (Datum, error)
	EvalFloorDivIntOp(context.Context, *FloorDivIntOp, Datum, Datum) (Datum, error)
	EvalInTupleOp(context.Context, *InTupleOp, Datum, Datum) (Datum, error)
	EvalJSONAllExistsOp(context.Context, *JSONAllExistsOp, Datum, Datum) (Datum, error)
	EvalJSONExistsOp(context.Context, *JSONExistsOp, Datum, Datum) (Datum, error)
	EvalJSONFetchTextIntOp(context.Context, *JSONFetchTextIntOp, Datum, Datum) (Datum, error)
	EvalJSONFetchTextPathOp(context.Context, *JSONFetchTextPathOp, Datum, Datum) (Datum, error)
	EvalJSONFetchTextStringOp(context.Context, *JSONFetchTextStringOp, Datum, Datum) (Datum, error)
	EvalJSONFetchValIntOp(context.Context, *JSONFetchValIntOp, Datum, Datum) (Datum, error)
	EvalJSONFetchValPathOp(context.Context, *JSONFetchValPathOp, Datum, Datum) (Datum, error)
	EvalJSONFetchValStringOp(context.Context, *JSONFetchValStringOp, Datum, Datum) (Datum, error)
	EvalJSONSomeExistsOp(context.Context, *JSONSomeExistsOp, Datum, Datum) (Datum, error)
	EvalLShiftINetOp(context.Context, *LShiftINetOp, Datum, Datum) (Datum, error)
	EvalLShiftIntOp(context.Context, *LShiftIntOp, Datum, Datum) (Datum, error)
	EvalLShiftVarBitIntOp(context.Context, *LShiftVarBitIntOp, Datum, Datum) (Datum, error)
	EvalMatchLikeOp(context.Context, *MatchLikeOp, Datum, Datum) (Datum, error)
	EvalMatchRegexpOp(context.Context, *MatchRegexpOp, Datum, Datum) (Datum, error)
	EvalMinusDateIntOp(context.Context, *MinusDateIntOp, Datum, Datum) (Datum, error)
	EvalMinusDateIntervalOp(context.Context, *MinusDateIntervalOp, Datum, Datum) (Datum, error)
	EvalMinusDateOp(context.Context, *MinusDateOp, Datum, Datum) (Datum, error)
	EvalMinusDateTimeOp(context.Context, *MinusDateTimeOp, Datum, Datum) (Datum, error)
	EvalMinusDecimalIntOp(context.Context, *MinusDecimalIntOp, Datum, Datum) (Datum, error)
	EvalMinusDecimalOp(context.Context, *MinusDecimalOp, Datum, Datum) (Datum, error)
	EvalMinusFloatOp(context.Context, *MinusFloatOp, Datum, Datum) (Datum, error)
	EvalMinusINetIntOp(context.Context, *MinusINetIntOp, Datum, Datum) (Datum, error)
	EvalMinusINetOp(context.Context, *MinusINetOp, Datum, Datum) (Datum, error)
	EvalMinusIntDecimalOp(context.Context, *MinusIntDecimalOp, Datum, Datum) (Datum, error)
	EvalMinusIntOp(context.Context, *MinusIntOp, Datum, Datum) (Datum, error)
	EvalMinusIntervalOp(context.Context, *MinusIntervalOp, Datum, Datum) (Datum, error)
	EvalMinusJsonbIntOp(context.Context, *MinusJsonbIntOp, Datum, Datum) (Datum, error)
	EvalMinusJsonbStringArrayOp(context.Context, *MinusJsonbStringArrayOp, Datum, Datum) (Datum, error)
	EvalMinusJsonbStringOp(context.Context, *MinusJsonbStringOp, Datum, Datum) (Datum, error)
	EvalMinusPGLSNDecimalOp(context.Context, *MinusPGLSNDecimalOp, Datum, Datum) (Datum, error)
	EvalMinusPGLSNOp(context.Context, *MinusPGLSNOp, Datum, Datum) (Datum, error)
	EvalMinusTimeIntervalOp(context.Context, *MinusTimeIntervalOp, Datum, Datum) (Datum, error)
	EvalMinusTimeOp(context.Context, *MinusTimeOp, Datum, Datum) (Datum, error)
	EvalMinusTimeTZIntervalOp(context.Context, *MinusTimeTZIntervalOp, Datum, Datum) (Datum, error)
	EvalMinusTimestampIntervalOp(context.Context, *MinusTimestampIntervalOp, Datum, Datum) (Datum, error)
	EvalMinusTimestampOp(context.Context, *MinusTimestampOp, Datum, Datum) (Datum, error)
	EvalMinusTimestampTZIntervalOp(context.Context, *MinusTimestampTZIntervalOp, Datum, Datum) (Datum, error)
	EvalMinusTimestampTZOp(context.Context, *MinusTimestampTZOp, Datum, Datum) (Datum, error)
	EvalMinusTimestampTZTimestampOp(context.Context, *MinusTimestampTZTimestampOp, Datum, Datum) (Datum, error)
	EvalMinusTimestampTimestampTZOp(context.Context, *MinusTimestampTimestampTZOp, Datum, Datum) (Datum, error)
	EvalModDecimalIntOp(context.Context, *ModDecimalIntOp, Datum, Datum) (Datum, error)
	EvalModDecimalOp(context.Context, *ModDecimalOp, Datum, Datum) (Datum, error)
	EvalModFloatOp(context.Context, *ModFloatOp, Datum, Datum) (Datum, error)
	EvalModIntDecimalOp(context.Context, *ModIntDecimalOp, Datum, Datum) (Datum, error)
	EvalModIntOp(context.Context, *ModIntOp, Datum, Datum) (Datum, error)
	EvalModStringOp(context.Context, *ModStringOp, Datum, Datum) (Datum, error)
	EvalMultDecimalIntOp(context.Context, *MultDecimalIntOp, Datum, Datum) (Datum, error)
	EvalMultDecimalIntervalOp(context.Context, *MultDecimalIntervalOp, Datum, Datum) (Datum, error)
	EvalMultDecimalOp(context.Context, *MultDecimalOp, Datum, Datum) (Datum, error)
	EvalMultFloatIntervalOp(context.Context, *MultFloatIntervalOp, Datum, Datum) (Datum, error)
	EvalMultFloatOp(context.Context, *MultFloatOp, Datum, Datum) (Datum, error)
	EvalMultIntDecimalOp(context.Context, *MultIntDecimalOp, Datum, Datum) (Datum, error)
	EvalMultIntIntervalOp(context.Context, *MultIntIntervalOp, Datum, Datum) (Datum, error)
	EvalMultIntOp(context.Context, *MultIntOp, Datum, Datum) (Datum, error)
	EvalMultIntervalDecimalOp(context.Context, *MultIntervalDecimalOp, Datum, Datum) (Datum, error)
	EvalMultIntervalFloatOp(context.Context, *MultIntervalFloatOp, Datum, Datum) (Datum, error)
	EvalMultIntervalIntOp(context.Context, *MultIntervalIntOp, Datum, Datum) (Datum, error)
	EvalOverlapsArrayOp(context.Context, *OverlapsArrayOp, Datum, Datum) (Datum, error)
	EvalOverlapsINetOp(context.Context, *OverlapsINetOp, Datum, Datum) (Datum, error)
	EvalPlusDateIntOp(context.Context, *PlusDateIntOp, Datum, Datum) (Datum, error)
	EvalPlusDateIntervalOp(context.Context, *PlusDateIntervalOp, Datum, Datum) (Datum, error)
	EvalPlusDateTimeOp(context.Context, *PlusDateTimeOp, Datum, Datum) (Datum, error)
	EvalPlusDateTimeTZOp(context.Context, *PlusDateTimeTZOp, Datum, Datum) (Datum, error)
	EvalPlusDecimalIntOp(context.Context, *PlusDecimalIntOp, Datum, Datum) (Datum, error)
	EvalPlusDecimalOp(context.Context, *PlusDecimalOp, Datum, Datum) (Datum, error)
	EvalPlusDecimalPGLSNOp(context.Context, *PlusDecimalPGLSNOp, Datum, Datum) (Datum, error)
	EvalPlusFloatOp(context.Context, *PlusFloatOp, Datum, Datum) (Datum, error)
	EvalPlusINetIntOp(context.Context, *PlusINetIntOp, Datum, Datum) (Datum, error)
	EvalPlusIntDateOp(context.Context, *PlusIntDateOp, Datum, Datum) (Datum, error)
	EvalPlusIntDecimalOp(context.Context, *PlusIntDecimalOp, Datum, Datum) (Datum, error)
	EvalPlusIntINetOp(context.Context, *PlusIntINetOp, Datum, Datum) (Datum, error)
	EvalPlusIntOp(context.Context, *PlusIntOp, Datum, Datum) (Datum, error)
	EvalPlusIntervalDateOp(context.Context, *PlusIntervalDateOp, Datum, Datum) (Datum, error)
	EvalPlusIntervalOp(context.Context, *PlusIntervalOp, Datum, Datum) (Datum, error)
	EvalPlusIntervalTimeOp(context.Context, *PlusIntervalTimeOp, Datum, Datum) (Datum, error)
	EvalPlusIntervalTimeTZOp(context.Context, *PlusIntervalTimeTZOp, Datum, Datum) (Datum, error)
	EvalPlusIntervalTimestampOp(context.Context, *PlusIntervalTimestampOp, Datum, Datum) (Datum, error)
	EvalPlusIntervalTimestampTZOp(context.Context, *PlusIntervalTimestampTZOp, Datum, Datum) (Datum, error)
	EvalPlusPGLSNDecimalOp(context.Context, *PlusPGLSNDecimalOp, Datum, Datum) (Datum, error)
	EvalPlusTimeDateOp(context.Context, *PlusTimeDateOp, Datum, Datum) (Datum, error)
	EvalPlusTimeIntervalOp(context.Context, *PlusTimeIntervalOp, Datum, Datum) (Datum, error)
	EvalPlusTimeTZDateOp(context.Context, *PlusTimeTZDateOp, Datum, Datum) (Datum, error)
	EvalPlusTimeTZIntervalOp(context.Context, *PlusTimeTZIntervalOp, Datum, Datum) (Datum, error)
	EvalPlusTimestampIntervalOp(context.Context, *PlusTimestampIntervalOp, Datum, Datum) (Datum, error)
	EvalPlusTimestampTZIntervalOp(context.Context, *PlusTimestampTZIntervalOp, Datum, Datum) (Datum, error)
	EvalPowDecimalIntOp(context.Context, *PowDecimalIntOp, Datum, Datum) (Datum, error)
	EvalPowDecimalOp(context.Context, *PowDecimalOp, Datum, Datum) (Datum, error)
	EvalPowFloatOp(context.Context, *PowFloatOp, Datum, Datum) (Datum, error)
	EvalPowIntDecimalOp(context.Context, *PowIntDecimalOp, Datum, Datum) (Datum, error)
	EvalPowIntOp(context.Context, *PowIntOp, Datum, Datum) (Datum, error)
	EvalPrependToMaybeNullArrayOp(context.Context, *PrependToMaybeNullArrayOp, Datum, Datum) (Datum, error)
	EvalRShiftINetOp(context.Context, *RShiftINetOp, Datum, Datum) (Datum, error)
	EvalRShiftIntOp(context.Context, *RShiftIntOp, Datum, Datum) (Datum, error)
	EvalRShiftVarBitIntOp(context.Context, *RShiftVarBitIntOp, Datum, Datum) (Datum, error)
	EvalSimilarToOp(context.Context, *SimilarToOp, Datum, Datum) (Datum, error)
	EvalTSMatchesQueryVectorOp(context.Context, *TSMatchesQueryVectorOp, Datum, Datum) (Datum, error)
	EvalTSMatchesVectorQueryOp(context.Context, *TSMatchesVectorQueryOp, Datum, Datum) (Datum, error)
}

UnaryOpEvaluator knows how to evaluate BinaryEvalOps.

type BitAndINetOp

type BitAndINetOp struct{}

BitAndINetOp is a BinaryEvalOp.

func (*BitAndINetOp) Eval

func (op *BitAndINetOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type BitAndIntOp

type BitAndIntOp struct{}

BitAndIntOp is a BinaryEvalOp.

func (*BitAndIntOp) Eval

func (op *BitAndIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type BitAndVarBitOp

type BitAndVarBitOp struct{}

BitAndVarBitOp is a BinaryEvalOp.

func (*BitAndVarBitOp) Eval

func (op *BitAndVarBitOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type BitOrINetOp

type BitOrINetOp struct{}

BitOrINetOp is a BinaryEvalOp.

func (*BitOrINetOp) Eval

func (op *BitOrINetOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type BitOrIntOp

type BitOrIntOp struct{}

BitOrIntOp is a BinaryEvalOp.

func (*BitOrIntOp) Eval

func (op *BitOrIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type BitOrVarBitOp

type BitOrVarBitOp struct{}

BitOrVarBitOp is a BinaryEvalOp.

func (*BitOrVarBitOp) Eval

func (op *BitOrVarBitOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type BitXorIntOp

type BitXorIntOp struct{}

BitXorIntOp is a BinaryEvalOp.

func (*BitXorIntOp) Eval

func (op *BitXorIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type BitXorVarBitOp

type BitXorVarBitOp struct{}

BitXorVarBitOp is a BinaryEvalOp.

func (*BitXorVarBitOp) Eval

func (op *BitXorVarBitOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type BlockState

type BlockState struct {
	// ExceptionHandler is the exception handler for the current block, if any.
	ExceptionHandler *RoutineExceptionHandler

	// SavepointTok allows the exception handler to roll-back changes to database
	// state if an error occurs during its execution. It currently maps to
	// kv.SavepointToken. We use the empty interface here rather than
	// kv.SavepointToken to avoid import cycles.
	SavepointTok interface{}

	// Cursors is a list of the names of cursors that have been opened within the
	// current block. If the exception handler catches an exception, these cursors
	// must be closed before the handler can proceed.
	// TODO(111139): Once we support nested routine calls, we may have to track
	// newly opened cursors differently.
	Cursors []Name
}

BlockState is shared state between all routines that make up a PLpgSQL block. It allows for coordination between the routines for exception handling.

type CCLOnlyStatement

type CCLOnlyStatement interface {
	// contains filtered or unexported methods
}

CCLOnlyStatement is a marker interface for statements that require a CCL binary for successful planning or execution. It is used to enhance error messages when attempting to use these statements in non-CCL binaries.

type CTE

type CTE struct {
	Name AliasClause
	Mtr  CTEMaterializeClause
	Stmt Statement
}

CTE represents a common table expression inside of a WITH clause.

type CTEMaterializeClause

type CTEMaterializeClause int8

CTEMaterializeClause represents either MATERIALIZED, NOT MATERIALIZED, or an empty materialization clause.

const (
	// CTEMaterializeDefault represents an empty materialization clause.
	CTEMaterializeDefault CTEMaterializeClause = iota
	// CTEMaterializeAlways represents MATERIALIZED.
	CTEMaterializeAlways
	// CTEMaterializeNever represents NOT MATERIALIZED.
	CTEMaterializeNever
)

type Call

type Call struct {
	// Proc contains the procedure reference and the arguments of the procedure.
	Proc *FuncExpr
}

Call represents a CALL statement to invoke a procedure.

func (*Call) Format

func (node *Call) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Call) StatementReturnType

func (*Call) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Call) StatementTag

func (*Call) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Call) StatementType

func (*Call) StatementType() StatementType

StatementType implements the Statement interface.

func (*Call) String

func (n *Call) String() string

type CancelQueries

type CancelQueries struct {
	Queries  *Select
	IfExists bool
}

CancelQueries represents a CANCEL QUERIES statement.

func (*CancelQueries) Format

func (node *CancelQueries) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CancelQueries) StatementReturnType

func (*CancelQueries) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CancelQueries) StatementTag

func (*CancelQueries) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CancelQueries) StatementType

func (*CancelQueries) StatementType() StatementType

StatementType implements the Statement interface.

func (*CancelQueries) String

func (n *CancelQueries) String() string

type CancelSessions

type CancelSessions struct {
	Sessions *Select
	IfExists bool
}

CancelSessions represents a CANCEL SESSIONS statement.

func (*CancelSessions) Format

func (node *CancelSessions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CancelSessions) StatementReturnType

func (*CancelSessions) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CancelSessions) StatementTag

func (*CancelSessions) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CancelSessions) StatementType

func (*CancelSessions) StatementType() StatementType

StatementType implements the Statement interface.

func (*CancelSessions) String

func (n *CancelSessions) String() string

type CannedOptPlan

type CannedOptPlan struct {
	Plan string
}

CannedOptPlan is used as the AST for a PREPARE .. AS OPT PLAN statement. This is a testing facility that allows execution (and benchmarking) of specific plans. See exprgen package for more information on the syntax.

func (*CannedOptPlan) Format

func (node *CannedOptPlan) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CannedOptPlan) StatementReturnType

func (*CannedOptPlan) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CannedOptPlan) StatementTag

func (*CannedOptPlan) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CannedOptPlan) StatementType

func (*CannedOptPlan) StatementType() StatementType

StatementType implements the Statement interface.

func (*CannedOptPlan) String

func (n *CannedOptPlan) String() string

type CaseExpr

type CaseExpr struct {
	Expr  Expr
	Whens []*When
	Else  Expr
	// contains filtered or unexported fields
}

CaseExpr represents a CASE expression.

func NewTypedCaseExpr

func NewTypedCaseExpr(
	expr TypedExpr, whens []*When, elseStmt TypedExpr, typ *types.T,
) (*CaseExpr, error)

NewTypedCaseExpr returns a new CaseExpr that is verified to be well-typed.

func (*CaseExpr) Eval

func (node *CaseExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*CaseExpr) Format

func (node *CaseExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (CaseExpr) ResolvedType

func (ta CaseExpr) ResolvedType() *types.T

func (*CaseExpr) String

func (node *CaseExpr) String() string

func (*CaseExpr) TypeCheck

func (expr *CaseExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*CaseExpr) Walk

func (expr *CaseExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type CaseMode

type CaseMode int

CaseMode directs which casing mode to use.

const (
	// LowerCase transforms case-insensitive strings (like SQL keywords) to lowercase.
	LowerCase CaseMode = 0
	// UpperCase transforms case-insensitive strings (like SQL keywords) to uppercase.
	UpperCase CaseMode = 1
)

type CastCounterType

type CastCounterType struct {
	From, To types.Family
}

CastCounterType represents a cast from one family to another.

type CastExpr

type CastExpr struct {
	Expr Expr
	Type ResolvableTypeReference

	SyntaxMode castSyntaxMode
	// contains filtered or unexported fields
}

CastExpr represents a CAST(expr AS type) expression.

func NewTypedCastExpr

func NewTypedCastExpr(expr TypedExpr, typ *types.T) *CastExpr

NewTypedCastExpr returns a new CastExpr that is verified to be well-typed.

func (*CastExpr) Eval

func (node *CastExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*CastExpr) Format

func (node *CastExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (CastExpr) ResolvedType

func (ta CastExpr) ResolvedType() *types.T

func (*CastExpr) String

func (node *CastExpr) String() string

func (*CastExpr) TypeCheck

func (expr *CastExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, _ *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*CastExpr) Walk

func (expr *CastExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type CbrtDecimalOp

type CbrtDecimalOp struct{}

CbrtDecimalOp is a UnaryEvalOp.

func (*CbrtDecimalOp) Eval

func (op *CbrtDecimalOp) Eval(ctx context.Context, e OpEvaluator, v Datum) (Datum, error)

Eval is part of the UnaryEvalOp interface.

type CbrtFloatOp

type CbrtFloatOp struct{}

CbrtFloatOp is a UnaryEvalOp.

func (*CbrtFloatOp) Eval

func (op *CbrtFloatOp) Eval(ctx context.Context, e OpEvaluator, v Datum) (Datum, error)

Eval is part of the UnaryEvalOp interface.

type ChangefeedTarget

type ChangefeedTarget struct {
	TableName  TablePattern
	FamilyName Name
}

ChangefeedTarget represents a database object to be watched by a changefeed.

func ChangefeedTargetFromTableExpr

func ChangefeedTargetFromTableExpr(e TableExpr) (ChangefeedTarget, error)

ChangefeedTargetFromTableExpr returns ChangefeedTarget for the specified table expression.

func (*ChangefeedTarget) Format

func (ct *ChangefeedTarget) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type ChangefeedTargets

type ChangefeedTargets []ChangefeedTarget

ChangefeedTargets represents a list of database objects to be watched by a changefeed.

func (*ChangefeedTargets) Format

func (cts *ChangefeedTargets) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type CheckConstraintTableDef

type CheckConstraintTableDef struct {
	Name                  Name
	Expr                  Expr
	FromHashShardedColumn bool
	IfNotExists           bool
}

CheckConstraintTableDef represents a check constraint within a CREATE TABLE statement.

func (*CheckConstraintTableDef) Format

func (node *CheckConstraintTableDef) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CheckConstraintTableDef) SetIfNotExists

func (node *CheckConstraintTableDef) SetIfNotExists()

SetIfNotExists implements the ConstraintTableDef interface.

func (*CheckConstraintTableDef) SetName

func (node *CheckConstraintTableDef) SetName(name Name)

SetName implements the ConstraintTableDef interface.

type CloseCursor

type CloseCursor struct {
	Name Name
	All  bool
}

CloseCursor represents a CLOSE statement.

func (CloseCursor) Format

func (c CloseCursor) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CloseCursor) StatementReturnType

func (*CloseCursor) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CloseCursor) StatementTag

func (*CloseCursor) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CloseCursor) StatementType

func (*CloseCursor) StatementType() StatementType

StatementType implements the Statement interface.

func (*CloseCursor) String

func (n *CloseCursor) String() string

type CmpOp

type CmpOp struct {
	LeftType  *types.T
	RightType *types.T

	// Datum return type is a union between *DBool and dNull.
	EvalOp BinaryEvalOp

	OnTypeCheck func()

	// If CalledOnNullInput is false, the operator returns NULL
	// whenever either argument is NULL.
	CalledOnNullInput bool

	Volatility volatility.V

	PreferredOverload bool
	// contains filtered or unexported fields
}

CmpOp is a comparison operator.

type CmpOpOverloads

type CmpOpOverloads struct {
	// contains filtered or unexported fields
}

CmpOpOverloads is an overloaded set of comparison operator implementations.

func (*CmpOpOverloads) ForEachCmpOp

func (o *CmpOpOverloads) ForEachCmpOp(f func(op *CmpOp) error) error

ForEachCmpOp iterates the ops in the set.

func (*CmpOpOverloads) LookupImpl

func (o *CmpOpOverloads) LookupImpl(left, right *types.T) (*CmpOp, bool)

LookupImpl is used to look up the overload for a pair of types.

type CoalesceExpr

type CoalesceExpr struct {
	Name  string
	Exprs Exprs
	// contains filtered or unexported fields
}

CoalesceExpr represents a COALESCE or IFNULL expression.

func NewTypedCoalesceExpr

func NewTypedCoalesceExpr(typedExprs TypedExprs, typ *types.T) *CoalesceExpr

NewTypedCoalesceExpr returns a CoalesceExpr that is well-typed.

func (*CoalesceExpr) Eval

func (node *CoalesceExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*CoalesceExpr) Format

func (node *CoalesceExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CoalesceExpr) GetWhenCondition

func (node *CoalesceExpr) GetWhenCondition(i int) (whenCond Expr)

GetWhenCondition builds the WHEN condition to use for the ith expression inside the Coalesce.

func (CoalesceExpr) ResolvedType

func (ta CoalesceExpr) ResolvedType() *types.T

func (*CoalesceExpr) String

func (node *CoalesceExpr) String() string

func (*CoalesceExpr) TypeCheck

func (expr *CoalesceExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*CoalesceExpr) TypedExprAt

func (node *CoalesceExpr) TypedExprAt(idx int) TypedExpr

TypedExprAt returns the expression at the specified index as a TypedExpr.

func (*CoalesceExpr) Walk

func (expr *CoalesceExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type CollateExpr

type CollateExpr struct {
	Expr   Expr
	Locale string
	// contains filtered or unexported fields
}

CollateExpr represents an (expr COLLATE locale) expression.

func NewTypedCollateExpr

func NewTypedCollateExpr(expr TypedExpr, locale string) *CollateExpr

NewTypedCollateExpr returns a new CollateExpr that is verified to be well-typed.

func (*CollateExpr) Eval

func (node *CollateExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*CollateExpr) Format

func (node *CollateExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (CollateExpr) ResolvedType

func (ta CollateExpr) ResolvedType() *types.T

func (*CollateExpr) String

func (node *CollateExpr) String() string

func (*CollateExpr) TypeCheck

func (expr *CollateExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*CollateExpr) Walk

func (expr *CollateExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type CollationEnvironment

type CollationEnvironment struct {
	// contains filtered or unexported fields
}

CollationEnvironment stores the state needed by NewDCollatedString to construct collation keys efficiently.

type ColumnAccessExpr

type ColumnAccessExpr struct {
	Expr Expr

	// ByIndex, if set, indicates that the access is using a numeric
	// column reference and ColIndex below is already set.
	ByIndex bool

	// ColName is the name of the column to access. Empty if ByIndex is
	// set.
	ColName Name

	// ColIndex indicates the index of the column in the tuple. This is
	// either:
	// - set during type checking based on the label in ColName if
	//   ByIndex is false,
	// - or checked for validity during type checking if ByIndex is true.
	// The first column in the tuple is at index 0. The input
	// syntax (E).@N populates N-1 in this field.
	ColIndex int
	// contains filtered or unexported fields
}

ColumnAccessExpr represents (E).x expressions. Specifically, it allows accessing the column(s) from a Set Returning Function.

func NewTypedColumnAccessExpr

func NewTypedColumnAccessExpr(expr TypedExpr, colName Name, colIdx int) *ColumnAccessExpr

NewTypedColumnAccessExpr creates a pre-typed ColumnAccessExpr. A by-index ColumnAccessExpr can be specified by passing an empty string as colName.

func (*ColumnAccessExpr) Eval

func (node *ColumnAccessExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*ColumnAccessExpr) Format

func (node *ColumnAccessExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (ColumnAccessExpr) ResolvedType

func (ta ColumnAccessExpr) ResolvedType() *types.T

func (*ColumnAccessExpr) String

func (node *ColumnAccessExpr) String() string

func (*ColumnAccessExpr) TypeCheck

func (expr *ColumnAccessExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*ColumnAccessExpr) Walk

func (expr *ColumnAccessExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type ColumnCheckConstraint

type ColumnCheckConstraint struct {
	Expr Expr
}

ColumnCheckConstraint represents either a check on a column.

type ColumnCollation

type ColumnCollation string

ColumnCollation represents a COLLATE clause for a column.

type ColumnComputedDef

type ColumnComputedDef struct {
	Expr    Expr
	Virtual bool
}

ColumnComputedDef represents the description of a computed column.

type ColumnDef

type ColumnDef struct {
	Name Name
	Type ResolvableTypeReference
}

ColumnDef represents a column definition in the context of a record type alias, like in select * from json_to_record(...) AS foo(a INT, b INT).

func (*ColumnDef) Format

func (c *ColumnDef) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type ColumnDefList

type ColumnDefList []ColumnDef

ColumnDefList represents a list of ColumnDefs.

func (*ColumnDefList) Format

func (c *ColumnDefList) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type ColumnDefault

type ColumnDefault struct {
	Expr Expr
}

ColumnDefault represents a DEFAULT clause for a column.

type ColumnFKConstraint

type ColumnFKConstraint struct {
	Table   TableName
	Col     Name // empty-string means use PK
	Actions ReferenceActions
	Match   CompositeKeyMatchMethod
}

ColumnFKConstraint represents a FK-constaint on a column.

type ColumnFamilyConstraint

type ColumnFamilyConstraint struct {
	Family      Name
	Create      bool
	IfNotExists bool
}

ColumnFamilyConstraint represents FAMILY on a column.

type ColumnID

type ColumnID = catid.ColumnID

ColumnID is a custom type for ColumnDescriptor IDs.

type ColumnItem

type ColumnItem struct {
	// TableName holds the table prefix, if the name refers to a column. It is
	// optional.
	//
	// This uses UnresolvedObjectName because we need to preserve the
	// information about which parts were initially specified in the SQL
	// text. ColumnItems are intermediate data structures anyway, that
	// still need to undergo name resolution.
	TableName *UnresolvedObjectName
	// ColumnName names the designated column.
	ColumnName Name
}

ColumnItem corresponds to the name of a column in an expression.

func MakeColumnItem

func MakeColumnItem(tn *TableName, colName Name) ColumnItem

MakeColumnItem constructs a column item from an already valid TableName. This can be used for e.g. pretty-printing.

func NewColumnItem

func NewColumnItem(tn *TableName, colName Name) *ColumnItem

NewColumnItem constructs a column item from an already valid TableName. This can be used for e.g. pretty-printing.

func (*ColumnItem) Column

func (c *ColumnItem) Column() string

Column retrieves the unqualified column name.

func (*ColumnItem) Eval

func (node *ColumnItem) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*ColumnItem) Format

func (c *ColumnItem) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface. If this is updated, then dummyColumnItem.Format should be updated as well.

func (*ColumnItem) NormalizeVarName

func (c *ColumnItem) NormalizeVarName() (VarName, error)

NormalizeVarName implements the VarName interface.

func (*ColumnItem) ResolvedType

func (c *ColumnItem) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*ColumnItem) String

func (c *ColumnItem) String() string

func (*ColumnItem) TypeCheck

func (expr *ColumnItem) TypeCheck(
	_ context.Context, _ *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface. This function has a valid implementation only for testing within this package. During query execution, ColumnItems are replaced to IndexedVars prior to type checking.

func (*ColumnItem) Variable

func (c *ColumnItem) Variable()

Variable implements the VariableExpr interface.

Note that in common uses, ColumnItem ought to be replaced to an IndexedVar prior to evaluation.

func (*ColumnItem) Walk

func (expr *ColumnItem) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type ColumnMutationCmd

type ColumnMutationCmd interface {
	AlterTableCmd
	GetColumn() Name
}

ColumnMutationCmd is the subset of AlterTableCmds that modify an existing column.

type ColumnOnUpdate

type ColumnOnUpdate struct {
	Expr Expr
}

ColumnOnUpdate represents a ON UPDATE clause for a column.

type ColumnQualification

type ColumnQualification interface {
	// contains filtered or unexported methods
}

ColumnQualification represents a constraint on a column.

type ColumnTableDef

type ColumnTableDef struct {
	Name     Name
	Type     ResolvableTypeReference
	IsSerial bool
	// IsCreateAs is set to true if the Type is resolved after parsing.
	// CREATE AS statements must not display column types during formatting.
	IsCreateAs        bool
	GeneratedIdentity struct {
		IsGeneratedAsIdentity   bool
		GeneratedAsIdentityType GeneratedIdentityType
		SeqOptions              SequenceOptions
	}
	Hidden   bool
	Nullable struct {
		Nullability    Nullability
		ConstraintName Name
	}
	PrimaryKey struct {
		IsPrimaryKey  bool
		Sharded       bool
		ShardBuckets  Expr
		StorageParams StorageParams
	}
	Unique struct {
		IsUnique       bool
		WithoutIndex   bool
		ConstraintName Name
	}
	DefaultExpr struct {
		Expr           Expr
		ConstraintName Name
	}
	OnUpdateExpr struct {
		Expr           Expr
		ConstraintName Name
	}
	CheckExprs []ColumnTableDefCheckExpr
	References struct {
		Table          *TableName
		Col            Name
		ConstraintName Name
		Actions        ReferenceActions
		Match          CompositeKeyMatchMethod
	}
	Computed struct {
		Computed bool
		Expr     Expr
		Virtual  bool
	}
	Family struct {
		Name        Name
		Create      bool
		IfNotExists bool
	}
}

ColumnTableDef represents a column definition within a CREATE TABLE statement.

func NewColumnTableDef

func NewColumnTableDef(
	name Name,
	typRef ResolvableTypeReference,
	isSerial bool,
	qualifications []NamedColumnQualification,
) (*ColumnTableDef, error)

NewColumnTableDef constructs a column definition for a CreateTable statement.

func (*ColumnTableDef) Format

func (node *ColumnTableDef) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ColumnTableDef) HasColumnFamily

func (node *ColumnTableDef) HasColumnFamily() bool

HasColumnFamily returns if the ColumnTableDef has a column family.

func (*ColumnTableDef) HasDefaultExpr

func (node *ColumnTableDef) HasDefaultExpr() bool

HasDefaultExpr returns if the ColumnTableDef has a default expression.

func (*ColumnTableDef) HasFKConstraint

func (node *ColumnTableDef) HasFKConstraint() bool

HasFKConstraint returns if the ColumnTableDef has a foreign key constraint.

func (*ColumnTableDef) HasOnUpdateExpr

func (node *ColumnTableDef) HasOnUpdateExpr() bool

HasOnUpdateExpr returns if the ColumnTableDef has an ON UPDATE expression.

func (*ColumnTableDef) IsComputed

func (node *ColumnTableDef) IsComputed() bool

IsComputed returns if the ColumnTableDef is a computed column.

func (*ColumnTableDef) IsVirtual

func (node *ColumnTableDef) IsVirtual() bool

IsVirtual returns if the ColumnTableDef is a virtual column.

func (*ColumnTableDef) String

func (node *ColumnTableDef) String() string

String implements the fmt.Stringer interface.

type ColumnTableDefCheckExpr

type ColumnTableDefCheckExpr struct {
	Expr           Expr
	ConstraintName Name
}

ColumnTableDefCheckExpr represents a check constraint on a column definition within a CREATE TABLE statement.

type CommentOnColumn

type CommentOnColumn struct {
	*ColumnItem
	Comment *string
}

CommentOnColumn represents an COMMENT ON COLUMN statement.

func (*CommentOnColumn) Format

func (n *CommentOnColumn) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CommentOnColumn) StatementReturnType

func (*CommentOnColumn) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CommentOnColumn) StatementTag

func (*CommentOnColumn) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CommentOnColumn) StatementType

func (*CommentOnColumn) StatementType() StatementType

StatementType implements the Statement interface.

func (*CommentOnColumn) String

func (n *CommentOnColumn) String() string

type CommentOnConstraint

type CommentOnConstraint struct {
	Constraint Name
	Table      *UnresolvedObjectName
	Comment    *string
}

CommentOnConstraint represents a COMMENT ON CONSTRAINT statement

func (*CommentOnConstraint) Format

func (n *CommentOnConstraint) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CommentOnConstraint) StatementReturnType

func (*CommentOnConstraint) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CommentOnConstraint) StatementTag

func (*CommentOnConstraint) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CommentOnConstraint) StatementType

func (*CommentOnConstraint) StatementType() StatementType

StatementType implements the Statement interface.

func (*CommentOnConstraint) String

func (n *CommentOnConstraint) String() string

type CommentOnDatabase

type CommentOnDatabase struct {
	Name    Name
	Comment *string
}

CommentOnDatabase represents an COMMENT ON DATABASE statement.

func (*CommentOnDatabase) Format

func (n *CommentOnDatabase) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CommentOnDatabase) StatementReturnType

func (*CommentOnDatabase) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CommentOnDatabase) StatementTag

func (*CommentOnDatabase) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CommentOnDatabase) StatementType

func (*CommentOnDatabase) StatementType() StatementType

StatementType implements the Statement interface.

func (*CommentOnDatabase) String

func (n *CommentOnDatabase) String() string

type CommentOnIndex

type CommentOnIndex struct {
	Index   TableIndexName
	Comment *string
}

CommentOnIndex represents a COMMENT ON INDEX statement.

func (*CommentOnIndex) Format

func (n *CommentOnIndex) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CommentOnIndex) StatementReturnType

func (*CommentOnIndex) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CommentOnIndex) StatementTag

func (*CommentOnIndex) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CommentOnIndex) StatementType

func (*CommentOnIndex) StatementType() StatementType

StatementType implements the Statement interface.

func (*CommentOnIndex) String

func (n *CommentOnIndex) String() string

type CommentOnSchema

type CommentOnSchema struct {
	Name    ObjectNamePrefix
	Comment *string
}

CommentOnSchema represents an COMMENT ON SCHEMA statement.

func (*CommentOnSchema) Format

func (n *CommentOnSchema) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CommentOnSchema) StatementReturnType

func (*CommentOnSchema) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CommentOnSchema) StatementTag

func (*CommentOnSchema) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CommentOnSchema) StatementType

func (*CommentOnSchema) StatementType() StatementType

StatementType implements the Statement interface.

func (*CommentOnSchema) String

func (n *CommentOnSchema) String() string

type CommentOnTable

type CommentOnTable struct {
	Table   *UnresolvedObjectName
	Comment *string
}

CommentOnTable represents an COMMENT ON TABLE statement.

func (*CommentOnTable) Format

func (n *CommentOnTable) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CommentOnTable) StatementReturnType

func (*CommentOnTable) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CommentOnTable) StatementTag

func (*CommentOnTable) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CommentOnTable) StatementType

func (*CommentOnTable) StatementType() StatementType

StatementType implements the Statement interface.

func (*CommentOnTable) String

func (n *CommentOnTable) String() string

type CommitTransaction

type CommitTransaction struct{}

CommitTransaction represents a COMMIT statement.

func (*CommitTransaction) Format

func (node *CommitTransaction) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CommitTransaction) StatementReturnType

func (*CommitTransaction) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CommitTransaction) StatementTag

func (*CommitTransaction) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CommitTransaction) StatementType

func (*CommitTransaction) StatementType() StatementType

StatementType implements the Statement interface.

func (*CommitTransaction) String

func (n *CommitTransaction) String() string

type CompareAnyTupleOp

type CompareAnyTupleOp CompareTupleOp

CompareAnyTupleOp is a BinaryEvalOp.

func (*CompareAnyTupleOp) Eval

func (t *CompareAnyTupleOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval suppresses an auto-generated binding and membership in the OpEvaluator interface.

type CompareBox2DOp

type CompareBox2DOp struct {
	Op func(left, right Datum) bool
}

CompareBox2DOp is a BinaryEvalOp.

func (*CompareBox2DOp) Eval

func (op *CompareBox2DOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type CompareContext

type CompareContext interface {

	// UnwrapDatum will unwrap the OIDs and potentially the placeholders.
	UnwrapDatum(d Datum) Datum
	GetLocation() *time.Location
	GetRelativeParseTime() time.Time

	// MustGetPlaceholderValue is used to compare Datum
	MustGetPlaceholderValue(p *Placeholder) Datum
}

CompareContext represents the dependencies used to evaluate comparisons between datums.

type CompareScalarOp

type CompareScalarOp struct {
	treecmp.ComparisonOperator
}

CompareScalarOp is a BinaryEvalOp.

func (*CompareScalarOp) Eval

func (op *CompareScalarOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type CompareTupleOp

type CompareTupleOp struct {
	treecmp.ComparisonOperator
}

CompareTupleOp is a BinaryEvalOp.

func (*CompareTupleOp) Eval

func (op *CompareTupleOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type ComparisonExpr

type ComparisonExpr struct {
	Operator    treecmp.ComparisonOperator
	SubOperator treecmp.ComparisonOperator // used for array operators (when Operator is Any, Some, or All)
	Left, Right Expr

	Op *CmpOp
	// contains filtered or unexported fields
}

ComparisonExpr represents a two-value comparison expression.

func NewTypedComparisonExpr

func NewTypedComparisonExpr(op treecmp.ComparisonOperator, left, right TypedExpr) *ComparisonExpr

NewTypedComparisonExpr returns a new ComparisonExpr that is verified to be well-typed.

func NewTypedComparisonExprWithSubOp

func NewTypedComparisonExprWithSubOp(
	op, subOp treecmp.ComparisonOperator, left, right TypedExpr,
) *ComparisonExpr

NewTypedComparisonExprWithSubOp returns a new ComparisonExpr that is verified to be well-typed.

func (*ComparisonExpr) Eval

func (node *ComparisonExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*ComparisonExpr) Format

func (node *ComparisonExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (ComparisonExpr) ResolvedType

func (ta ComparisonExpr) ResolvedType() *types.T

func (*ComparisonExpr) String

func (node *ComparisonExpr) String() string

func (*ComparisonExpr) TypeCheck

func (expr *ComparisonExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*ComparisonExpr) TypedLeft

func (node *ComparisonExpr) TypedLeft() TypedExpr

TypedLeft returns the ComparisonExpr's left expression as a TypedExpr.

func (*ComparisonExpr) TypedRight

func (node *ComparisonExpr) TypedRight() TypedExpr

TypedRight returns the ComparisonExpr's right expression as a TypedExpr.

func (*ComparisonExpr) Walk

func (expr *ComparisonExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type ComplementINetOp

type ComplementINetOp struct{}

ComplementINetOp is a UnaryEvalOp.

func (*ComplementINetOp) Eval

func (op *ComplementINetOp) Eval(ctx context.Context, e OpEvaluator, v Datum) (Datum, error)

Eval is part of the UnaryEvalOp interface.

type ComplementIntOp

type ComplementIntOp struct{}

ComplementIntOp is a UnaryEvalOp.

func (*ComplementIntOp) Eval

func (op *ComplementIntOp) Eval(ctx context.Context, e OpEvaluator, v Datum) (Datum, error)

Eval is part of the UnaryEvalOp interface.

type ComplementVarBitOp

type ComplementVarBitOp struct{}

ComplementVarBitOp is a UnaryEvalOp.

func (*ComplementVarBitOp) Eval

Eval is part of the UnaryEvalOp interface.

type CompositeDatum

type CompositeDatum interface {
	Datum
	// IsComposite returns true if this datum is not round-tripable in a key
	// encoding.
	IsComposite() bool
}

CompositeDatum is a Datum that may require composite encoding in indexes. Any Datum implementing this interface must also add itself to colinfo.HasCompositeKeyEncoding.

type CompositeKeyMatchMethod

type CompositeKeyMatchMethod semenumpb.Match

CompositeKeyMatchMethod is the algorithm use when matching composite keys. See https://github.com/cockroachdb/cockroachdb-parser/issues/20305 or https://www.postgresql.org/docs/11/sql-createtable.html for details on the different composite foreign key matching methods.

const (
	MatchSimple CompositeKeyMatchMethod = iota
	MatchFull
	MatchPartial // Note: PARTIAL not actually supported at this point.
)

The values for CompositeKeyMatchMethod.

func (CompositeKeyMatchMethod) String

func (x CompositeKeyMatchMethod) String() string

String implements the fmt.Stringer interface.

type CompositeTypeElem

type CompositeTypeElem struct {
	Label Name
	Type  ResolvableTypeReference
}

CompositeTypeElem is a single element in a composite type definition.

type ConcatArraysOp

type ConcatArraysOp struct {
	Typ *types.T
}

ConcatArraysOp is a BinaryEvalOp.

func (*ConcatArraysOp) Eval

func (op *ConcatArraysOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type ConcatBytesOp

type ConcatBytesOp struct{}

ConcatBytesOp is a BinaryEvalOp.

func (*ConcatBytesOp) Eval

func (op *ConcatBytesOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type ConcatJsonbOp

type ConcatJsonbOp struct{}

ConcatJsonbOp is a BinaryEvalOp.

func (*ConcatJsonbOp) Eval

func (op *ConcatJsonbOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type ConcatOp

type ConcatOp struct {
	Left  *types.T
	Right *types.T
}

ConcatOp is a BinaryEvalOp.

func (*ConcatOp) Eval

func (op *ConcatOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type ConcatStringOp

type ConcatStringOp struct{}

ConcatStringOp is a BinaryEvalOp.

func (*ConcatStringOp) Eval

func (op *ConcatStringOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type ConcatVarBitOp

type ConcatVarBitOp struct{}

ConcatVarBitOp is a BinaryEvalOp.

func (*ConcatVarBitOp) Eval

func (op *ConcatVarBitOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type Constant

type Constant interface {
	Expr
	// AvailableTypes returns the ordered set of types that the Constant is able to
	// be resolved into. The order of the type slice provides a notion of precedence,
	// with the first element in the ordering being the Constant's "natural type".
	AvailableTypes() []*types.T
	// DesirableTypes returns the ordered set of types that the constant would
	// prefer to be resolved into. As in AvailableTypes, the order of the returned
	// type slice provides a notion of precedence, with the first element in the
	// ordering being the Constant's "natural type." The function is meant to be
	// differentiated from AvailableTypes in that it will exclude certain types
	// that are possible, but not desirable.
	//
	// An example of this is a floating point numeric constant without a value
	// past the decimal point. It is possible to resolve this constant as a
	// decimal, but it is not desirable.
	DesirableTypes() []*types.T
	// ResolveAsType resolves the Constant as the specified type, or returns an
	// error if the Constant could not be resolved as that type. The method should
	// only be passed a type returned from AvailableTypes and should never be
	// called more than once for a given Constant.
	//
	// The returned expression is either a Datum or a CastExpr wrapping a Datum;
	// the latter is necessary for cases where the result would depend on the
	// context (like the timezone or the current time).
	ResolveAsType(context.Context, *SemaContext, *types.T) (TypedExpr, error)
}

Constant is an constant literal expression which may be resolved to more than one type.

type ConstraintTableDef

type ConstraintTableDef interface {
	TableDef

	// SetName replaces the name of the definition in-place. Used in the parser.
	SetName(name Name)

	// SetIfNotExists sets this definition as coming from an
	// ADD CONSTRAINT IF NOT EXISTS statement. Used in the parser.
	SetIfNotExists()
	// contains filtered or unexported methods
}

ConstraintTableDef represents a constraint definition within a CREATE TABLE statement.

type ContainedByArrayOp

type ContainedByArrayOp struct{}

ContainedByArrayOp is a BinaryEvalOp.

func (*ContainedByArrayOp) Eval

func (op *ContainedByArrayOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type ContainedByJsonbOp

type ContainedByJsonbOp struct{}

ContainedByJsonbOp is a BinaryEvalOp.

func (*ContainedByJsonbOp) Eval

func (op *ContainedByJsonbOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type ContainsArrayOp

type ContainsArrayOp struct{}

ContainsArrayOp is a BinaryEvalOp.

func (*ContainsArrayOp) Eval

func (op *ContainsArrayOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type ContainsJsonbOp

type ContainsJsonbOp struct{}

ContainsJsonbOp is a BinaryEvalOp.

func (*ContainsJsonbOp) Eval

func (op *ContainsJsonbOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type ControlJobs

type ControlJobs struct {
	Jobs    *Select
	Command JobCommand
	Reason  Expr
}

ControlJobs represents a PAUSE/RESUME/CANCEL JOBS statement.

func (*ControlJobs) Format

func (n *ControlJobs) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ControlJobs) StatementReturnType

func (*ControlJobs) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ControlJobs) StatementTag

func (n *ControlJobs) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ControlJobs) StatementType

func (*ControlJobs) StatementType() StatementType

StatementType implements the Statement interface.

func (*ControlJobs) String

func (n *ControlJobs) String() string

type ControlJobsForSchedules

type ControlJobsForSchedules struct {
	Schedules *Select
	Command   JobCommand
}

ControlJobsForSchedules represents PAUSE/RESUME/CANCEL clause which applies job command to the jobs matching specified schedule(s).

func (*ControlJobsForSchedules) Format

func (n *ControlJobsForSchedules) Format(ctx *FmtCtx)

Format implements NodeFormatter interface.

func (*ControlJobsForSchedules) StatementReturnType

func (*ControlJobsForSchedules) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ControlJobsForSchedules) StatementTag

func (n *ControlJobsForSchedules) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ControlJobsForSchedules) StatementType

func (*ControlJobsForSchedules) StatementType() StatementType

StatementType implements the Statement interface.

func (*ControlJobsForSchedules) String

func (n *ControlJobsForSchedules) String() string

type ControlJobsOfType

type ControlJobsOfType struct {
	Type    string
	Command JobCommand
}

ControlJobsOfType represents PAUSE/RESUME/CANCEL clause which applies the job command to the job matching a specified type

func (*ControlJobsOfType) Format

func (n *ControlJobsOfType) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ControlJobsOfType) StatementReturnType

func (*ControlJobsOfType) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ControlJobsOfType) StatementTag

func (n *ControlJobsOfType) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ControlJobsOfType) StatementType

func (*ControlJobsOfType) StatementType() StatementType

StatementType implements the Statement interface.

func (*ControlJobsOfType) String

func (n *ControlJobsOfType) String() string

type ControlSchedules

type ControlSchedules struct {
	Schedules *Select
	Command   ScheduleCommand
}

ControlSchedules represents PAUSE/RESUME SCHEDULE statement.

func (*ControlSchedules) Format

func (n *ControlSchedules) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ControlSchedules) StatementReturnType

func (*ControlSchedules) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ControlSchedules) StatementTag

func (n *ControlSchedules) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ControlSchedules) StatementType

func (*ControlSchedules) StatementType() StatementType

StatementType implements the Statement interface.

func (*ControlSchedules) String

func (n *ControlSchedules) String() string

type CopyFormat

type CopyFormat int

CopyFormat identifies a COPY data format.

const (
	CopyFormatText CopyFormat = iota
	CopyFormatBinary
	CopyFormatCSV
)

Valid values for CopyFormat.

type CopyFrom

type CopyFrom struct {
	Table   TableName
	Columns NameList
	Stdin   bool
	Options CopyOptions
}

CopyFrom represents a COPY FROM statement.

func (*CopyFrom) Format

func (node *CopyFrom) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CopyFrom) StatementReturnType

func (*CopyFrom) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CopyFrom) StatementTag

func (*CopyFrom) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CopyFrom) StatementType

func (*CopyFrom) StatementType() StatementType

StatementType implements the Statement interface.

func (*CopyFrom) String

func (n *CopyFrom) String() string

type CopyOptions

type CopyOptions struct {
	Destination Expr
	CopyFormat  CopyFormat
	Delimiter   Expr
	Null        Expr
	Escape      *StrVal
	Header      bool
	Quote       *StrVal

	// Additional flags are needed to keep track of whether explicit default
	// values were already set.
	HasFormat bool
	HasHeader bool
}

CopyOptions describes options for COPY execution.

func (*CopyOptions) CombineWith

func (o *CopyOptions) CombineWith(other *CopyOptions) error

CombineWith merges other options into this struct. An error is returned if the same option merged multiple times.

func (*CopyOptions) Format

func (o *CopyOptions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface

func (CopyOptions) IsDefault

func (o CopyOptions) IsDefault() bool

IsDefault returns true if this struct has default value.

type CopyTo

type CopyTo struct {
	Table     TableName
	Columns   NameList
	Statement Statement
	Options   CopyOptions
}

CopyTo represents a COPY TO statement.

func (*CopyTo) Format

func (node *CopyTo) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CopyTo) StatementReturnType

func (*CopyTo) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CopyTo) StatementTag

func (*CopyTo) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CopyTo) StatementType

func (*CopyTo) StatementType() StatementType

StatementType implements the Statement interface.

func (*CopyTo) String

func (n *CopyTo) String() string

type CreateChangefeed

type CreateChangefeed struct {
	Targets ChangefeedTargets
	SinkURI Expr
	Options KVOptions
	Select  *SelectClause
}

CreateChangefeed represents a CREATE CHANGEFEED statement.

func (*CreateChangefeed) Format

func (node *CreateChangefeed) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CreateChangefeed) StatementReturnType

func (*CreateChangefeed) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CreateChangefeed) StatementTag

func (n *CreateChangefeed) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateChangefeed) StatementType

func (*CreateChangefeed) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateChangefeed) String

func (n *CreateChangefeed) String() string

type CreateDatabase

type CreateDatabase struct {
	IfNotExists     bool
	Name            Name
	Template        string
	Encoding        string
	Collate         string
	CType           string
	ConnectionLimit int32
	PrimaryRegion   Name
	Regions         NameList
	SurvivalGoal    SurvivalGoal
	Placement       DataPlacement
	Owner           RoleSpec
	SuperRegion     SuperRegion
	SecondaryRegion Name
}

CreateDatabase represents a CREATE DATABASE statement.

func (*CreateDatabase) Format

func (node *CreateDatabase) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CreateDatabase) StatementReturnType

func (*CreateDatabase) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CreateDatabase) StatementTag

func (*CreateDatabase) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateDatabase) StatementType

func (*CreateDatabase) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateDatabase) String

func (n *CreateDatabase) String() string

type CreateExtension

type CreateExtension struct {
	Name        Name
	IfNotExists bool
}

CreateExtension represents a CREATE EXTENSION statement.

func (*CreateExtension) Format

func (node *CreateExtension) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CreateExtension) StatementReturnType

func (*CreateExtension) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CreateExtension) StatementTag

func (*CreateExtension) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateExtension) StatementType

func (*CreateExtension) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateExtension) String

func (n *CreateExtension) String() string

type CreateExternalConnection

type CreateExternalConnection struct {
	ConnectionLabelSpec LabelSpec
	As                  Expr
}

CreateExternalConnection represents a CREATE EXTERNAL CONNECTION statement.

func (*CreateExternalConnection) Format

func (node *CreateExternalConnection) Format(ctx *FmtCtx)

Format implements the Statement interface.

func (*CreateExternalConnection) StatementReturnType

func (*CreateExternalConnection) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CreateExternalConnection) StatementTag

func (*CreateExternalConnection) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateExternalConnection) StatementType

func (*CreateExternalConnection) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateExternalConnection) String

func (n *CreateExternalConnection) String() string

type CreateIndex

type CreateIndex struct {
	Name        Name
	Table       TableName
	Unique      bool
	Inverted    bool
	IfNotExists bool
	Columns     IndexElemList
	Sharded     *ShardedIndexDef
	// Extra columns to be stored together with the indexed ones as an optimization
	// for improved reading performance.
	Storing          NameList
	PartitionByIndex *PartitionByIndex
	StorageParams    StorageParams
	Predicate        Expr
	Concurrently     bool
	Invisibility     IndexInvisibility
}

CreateIndex represents a CREATE INDEX statement.

func (*CreateIndex) Format

func (node *CreateIndex) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CreateIndex) StatementReturnType

func (*CreateIndex) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CreateIndex) StatementTag

func (*CreateIndex) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateIndex) StatementType

func (*CreateIndex) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateIndex) String

func (n *CreateIndex) String() string

type CreateRole

type CreateRole struct {
	Name        RoleSpec
	IfNotExists bool
	IsRole      bool
	KVOptions   KVOptions
}

CreateRole represents a CREATE ROLE statement.

func (*CreateRole) Format

func (node *CreateRole) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CreateRole) StatementReturnType

func (*CreateRole) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CreateRole) StatementTag

func (*CreateRole) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateRole) StatementType

func (*CreateRole) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateRole) String

func (n *CreateRole) String() string

type CreateRoutine

type CreateRoutine struct {
	IsProcedure bool
	Replace     bool
	Name        RoutineName
	Params      RoutineParams
	ReturnType  RoutineReturnType
	Options     RoutineOptions
	RoutineBody *RoutineBody
	// BodyStatements is not assigned during initial parsing of user input. It's
	// assigned during opt builder for logging purpose at the moment. It stores
	// all parsed AST nodes of body statements with all expression in original
	// format. That is sequence names and type name in expressions are not
	// rewritten with OIDs.
	BodyStatements Statements
	// BodyAnnotations is not assigned during initial parsing of user input. It's
	// assigned by the opt builder when the optimizer parses the body statements.
	BodyAnnotations []*Annotations
}

CreateRoutine represents a CREATE FUNCTION or CREATE PROCEDURE statement.

func (*CreateRoutine) Format

func (node *CreateRoutine) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CreateRoutine) StatementReturnType

func (*CreateRoutine) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CreateRoutine) StatementTag

func (n *CreateRoutine) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateRoutine) StatementType

func (*CreateRoutine) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateRoutine) String

func (n *CreateRoutine) String() string

type CreateSchema

type CreateSchema struct {
	IfNotExists bool
	AuthRole    RoleSpec
	Schema      ObjectNamePrefix
}

CreateSchema represents a CREATE SCHEMA statement.

func (*CreateSchema) Format

func (node *CreateSchema) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CreateSchema) StatementReturnType

func (n *CreateSchema) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CreateSchema) StatementTag

func (n *CreateSchema) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateSchema) StatementType

func (*CreateSchema) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateSchema) String

func (n *CreateSchema) String() string

type CreateSequence

type CreateSequence struct {
	IfNotExists bool
	Name        TableName
	Persistence Persistence
	Options     SequenceOptions
}

CreateSequence represents a CREATE SEQUENCE statement.

func (*CreateSequence) Format

func (node *CreateSequence) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CreateSequence) StatementReturnType

func (*CreateSequence) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CreateSequence) StatementTag

func (*CreateSequence) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateSequence) StatementType

func (*CreateSequence) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateSequence) String

func (n *CreateSequence) String() string

type CreateStats

type CreateStats struct {
	Name        Name
	ColumnNames NameList
	Table       TableExpr
	Options     CreateStatsOptions
}

CreateStats represents a CREATE STATISTICS statement.

func (*CreateStats) Format

func (node *CreateStats) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CreateStats) StatementReturnType

func (*CreateStats) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CreateStats) StatementTag

func (*CreateStats) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateStats) StatementType

func (*CreateStats) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateStats) String

func (n *CreateStats) String() string

type CreateStatsOptions

type CreateStatsOptions struct {
	// Throttling enables throttling and indicates the fraction of time we are
	// idling (between 0 and 1).
	Throttling float64

	// AsOf performs a historical read at the given timestamp.
	// Note that the timestamp will be moved up during the operation if it gets
	// too old (in order to avoid problems with TTL expiration).
	AsOf AsOfClause

	// UsingExtremes is true when the statistics collection is at
	// extreme values of the table or the index specified.
	UsingExtremes bool

	// Where will specify statistics collection in a set of rows of the table
	// or index specified.
	Where *Where
}

CreateStatsOptions contains options for CREATE STATISTICS.

func (*CreateStatsOptions) CombineWith

func (o *CreateStatsOptions) CombineWith(other *CreateStatsOptions) error

CombineWith combines two options, erroring out if the two options contain incompatible settings.

func (*CreateStatsOptions) Empty

func (o *CreateStatsOptions) Empty() bool

Empty returns true if no options were provided.

func (*CreateStatsOptions) Format

func (o *CreateStatsOptions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type CreateTable

type CreateTable struct {
	IfNotExists      bool
	Table            TableName
	PartitionByTable *PartitionByTable
	Persistence      Persistence
	StorageParams    StorageParams
	OnCommit         CreateTableOnCommitSetting
	// In CREATE...AS queries, Defs represents a list of ColumnTableDefs, one for
	// each column, and a ConstraintTableDef for each constraint on a subset of
	// these columns.
	Defs     TableDefs
	AsSource *Select
	Locality *Locality
}

CreateTable represents a CREATE TABLE statement.

func (*CreateTable) As

func (node *CreateTable) As() bool

As returns true if this table represents a CREATE TABLE ... AS statement, false otherwise.

func (*CreateTable) AsHasUserSpecifiedPrimaryKey

func (node *CreateTable) AsHasUserSpecifiedPrimaryKey() bool

AsHasUserSpecifiedPrimaryKey returns true if a CREATE TABLE ... AS statement has a PRIMARY KEY constraint specified.

func (*CreateTable) Format

func (node *CreateTable) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CreateTable) FormatBody

func (node *CreateTable) FormatBody(ctx *FmtCtx)

FormatBody formats the "body" of the create table definition - everything but the CREATE TABLE tableName part.

func (*CreateTable) HoistConstraints

func (node *CreateTable) HoistConstraints()

HoistConstraints finds column check and foreign key constraints defined inline with their columns and makes them table-level constraints, stored in n.Defs. For example, the foreign key constraint in

CREATE TABLE foo (a INT REFERENCES bar(a))

gets pulled into a top-level constraint like:

CREATE TABLE foo (a INT, FOREIGN KEY (a) REFERENCES bar(a))

Similarly, the CHECK constraint in

CREATE TABLE foo (a INT CHECK (a < 1), b INT)

gets pulled into a top-level constraint like:

CREATE TABLE foo (a INT, b INT, CHECK (a < 1))

Note that some SQL databases require that a constraint attached to a column to refer only to the column it is attached to. We follow Postgres' behavior, however, in omitting this restriction by blindly hoisting all column constraints. For example, the following table definition is accepted in CockroachDB and Postgres, but not necessarily other SQL databases:

CREATE TABLE foo (a INT CHECK (a < b), b INT)

Unique constraints are not hoisted.

func (*CreateTable) StatementReturnType

func (n *CreateTable) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CreateTable) StatementTag

func (n *CreateTable) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateTable) StatementType

func (*CreateTable) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateTable) String

func (n *CreateTable) String() string

type CreateTableOnCommitSetting

type CreateTableOnCommitSetting uint32

CreateTableOnCommitSetting represents the CREATE TABLE ... ON COMMIT <action> parameters.

const (
	// CreateTableOnCommitUnset indicates that ON COMMIT was unset.
	CreateTableOnCommitUnset CreateTableOnCommitSetting = iota
	// CreateTableOnCommitPreserveRows indicates that ON COMMIT PRESERVE ROWS was set.
	CreateTableOnCommitPreserveRows
)

type CreateTenant

type CreateTenant struct {
	IfNotExists bool
	TenantSpec  *TenantSpec
	Like        *LikeTenantSpec
}

CreateTenant represents a CREATE VIRTUAL CLUSTER statement.

func (*CreateTenant) Format

func (node *CreateTenant) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CreateTenant) StatementReturnType

func (*CreateTenant) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CreateTenant) StatementTag

func (*CreateTenant) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateTenant) StatementType

func (*CreateTenant) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateTenant) String

func (n *CreateTenant) String() string

type CreateTenantFromReplication

type CreateTenantFromReplication struct {
	IfNotExists bool
	TenantSpec  *TenantSpec

	// ReplicationSourceTenantName is the name of the tenant that
	// we are replicating into the newly created tenant.
	// Note: even though this field can only be a name
	// (this is guaranteed during parsing), we still want
	// to use the TenantSpec type. This supports the auto-promotion
	// of simple identifiers to strings.
	ReplicationSourceTenantName *TenantSpec
	// ReplicationSourceAddress is the address of the source cluster that we are
	// replicating data from.
	ReplicationSourceAddress Expr

	Options TenantReplicationOptions

	Like *LikeTenantSpec
}

CreateTenantFromReplication represents a CREATE VIRTUAL CLUSTER...FROM REPLICATION statement.

func (*CreateTenantFromReplication) Format

func (node *CreateTenantFromReplication) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CreateTenantFromReplication) StatementReturnType

func (*CreateTenantFromReplication) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CreateTenantFromReplication) StatementTag

func (*CreateTenantFromReplication) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateTenantFromReplication) StatementType

func (*CreateTenantFromReplication) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateTenantFromReplication) String

func (n *CreateTenantFromReplication) String() string

type CreateType

type CreateType struct {
	TypeName *UnresolvedObjectName
	Variety  CreateTypeVariety
	// EnumLabels is set when this represents a CREATE TYPE ... AS ENUM statement.
	EnumLabels EnumValueList
	// CompositeTypeList is set when this repesnets a CREATE TYPE ... AS ( )
	// statement.
	CompositeTypeList []CompositeTypeElem
	// IfNotExists is true if IF NOT EXISTS was requested.
	IfNotExists bool
}

CreateType represents a CREATE TYPE statement.

func (*CreateType) Format

func (node *CreateType) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CreateType) StatementReturnType

func (*CreateType) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CreateType) StatementTag

func (*CreateType) StatementTag() string

StatementTag implements the Statement interface.

func (*CreateType) StatementType

func (*CreateType) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateType) String

func (node *CreateType) String() string

type CreateTypeVariety

type CreateTypeVariety int

CreateTypeVariety represents a particular variety of user defined types.

const (

	// Enum represents an ENUM user defined type.
	Enum CreateTypeVariety
	// Composite represents a composite user defined type.
	Composite
	// Range represents a RANGE user defined type.
	Range
	// Base represents a base user defined type.
	Base
	// Shell represents a shell user defined type.
	Shell
	// Domain represents a DOMAIN user defined type.
	Domain
)

func (CreateTypeVariety) String

func (i CreateTypeVariety) String() string

type CreateView

type CreateView struct {
	Name         TableName
	ColumnNames  NameList
	AsSource     *Select
	IfNotExists  bool
	Persistence  Persistence
	Replace      bool
	Materialized bool
	WithData     bool
}

CreateView represents a CREATE VIEW statement.

func (*CreateView) Format

func (node *CreateView) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*CreateView) StatementReturnType

func (*CreateView) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*CreateView) StatementTag

func (*CreateView) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateView) StatementType

func (*CreateView) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateView) String

func (n *CreateView) String() string

type CursorScrollOption

type CursorScrollOption int8

CursorScrollOption represents the scroll option, if one was given, for a DECLARE statement.

const (
	// UnspecifiedScroll represents no SCROLL option having been given. In
	// Postgres, this is like NO SCROLL, but the returned cursor also supports
	// some simple cases of backward seeking. For CockroachDB, this is the same
	// as NO SCROLL.
	UnspecifiedScroll CursorScrollOption = iota
	// Scroll represents the SCROLL option. It is supposed to indicate that the
	// declared cursor is "scrollable", meaning it can be seeked backward.
	Scroll
	// NoScroll represents the NO SCROLL option, which means that the declared
	// cursor can only be moved forward.
	NoScroll
)

func (CursorScrollOption) String

func (o CursorScrollOption) String() string

type CursorSensitivity

type CursorSensitivity int

CursorSensitivity represents the "sensitivity" of a cursor, which describes whether it sees writes that occur within the transaction after it was declared. CockroachDB, like Postgres, only supports "insensitive" cursors, and all three variants of sensitivity here resolve to insensitive. SENSITIVE cursors are not supported.

const (
	// UnspecifiedSensitivity indicates that no sensitivity was specified. This
	// is the same as INSENSITIVE.
	UnspecifiedSensitivity CursorSensitivity = iota
	// Insensitive indicates that the cursor is "insensitive" to subsequent
	// writes, meaning that it sees a snapshot of data from the moment it was
	// declared, and won't see subsequent writes within the transaction.
	Insensitive
	// Asensitive indicates that "the cursor is implementation dependent".
	Asensitive
)

func (CursorSensitivity) String

func (o CursorSensitivity) String() string

type CursorStmt

type CursorStmt struct {
	Name      Name
	FetchType FetchType
	Count     int64
}

CursorStmt represents the shared structure between a FETCH and MOVE statement.

func (CursorStmt) Format

func (c CursorStmt) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type DArray

type DArray struct {
	ParamTyp *types.T
	Array    Datums
	// HasNulls is set to true if any of the datums within the array are null.
	// This is used in the binary array serialization format.
	HasNulls bool
	// HasNonNulls is set to true if any of the datums within the are non-null.
	// This is used in expression serialization (FmtParsable).
	HasNonNulls bool
	// contains filtered or unexported fields
}

DArray is the array Datum. Any Datum inserted into a DArray are treated as text during serialization.

func AsDArray

func AsDArray(e Expr) (*DArray, bool)

AsDArray attempts to retrieve a *DArray from an Expr, returning a *DArray and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DArray wrapped by a *DOidWrapper is possible.

func MustBeDArray

func MustBeDArray(e Expr) *DArray

MustBeDArray attempts to retrieve a *DArray from an Expr, panicking if the assertion fails.

func NewDArray

func NewDArray(paramTyp *types.T) *DArray

NewDArray returns a DArray containing elements of the specified type.

func ParseDArrayFromString

func ParseDArrayFromString(
	ctx ParseContext, s string, t *types.T,
) (_ *DArray, dependsOnContext bool, _ error)

ParseDArrayFromString parses the string-form of constructing arrays, handling cases such as `'{1,2,3}'::INT[]`. The input type t is the type of the parameter of the array to parse.

The dependsOnContext return value indicates if we had to consult the ParseContext (either for the time or the local timezone).

func (*DArray) AmbiguousFormat

func (d *DArray) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DArray) Append

func (d *DArray) Append(v Datum) error

Append appends a Datum to the array, whose parameterized type must be consistent with the type of the Datum.

func (*DArray) Compare

func (d *DArray) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DArray) CompareError

func (d *DArray) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DArray) Eval

func (node *DArray) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DArray) FirstIndex

func (d *DArray) FirstIndex() int

FirstIndex returns the first index of the array. 1 for normal SQL arrays, which are 1-indexed, and 0 for the special Postgers vector types which are 0-indexed.

func (*DArray) Format

func (d *DArray) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DArray) IsComposite

func (d *DArray) IsComposite() bool

IsComposite implements the CompositeDatum interface.

func (*DArray) IsMax

func (d *DArray) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DArray) IsMin

func (d *DArray) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DArray) Len

func (d *DArray) Len() int

Len returns the length of the Datum array.

func (*DArray) Max

func (d *DArray) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DArray) MaybeSetCustomOid

func (d *DArray) MaybeSetCustomOid(t *types.T) error

MaybeSetCustomOid checks whether t has a special oid that we want to set into d. Must be kept in sync with DArray.ResolvedType. Returns an error if t is not an array type.

func (*DArray) Min

func (d *DArray) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DArray) Next

func (d *DArray) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DArray) Prev

func (d *DArray) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DArray) ResolvedType

func (d *DArray) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface. Must be kept in sync with DArray.MaybeSetCustomOid.

func (*DArray) Size

func (d *DArray) Size() uintptr

Size implements the Datum interface.

func (*DArray) String

func (node *DArray) String() string

func (*DArray) TypeCheck

func (d *DArray) TypeCheck(_ context.Context, _ *SemaContext, desired *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DArray) Validate

func (d *DArray) Validate() error

Validate checks that the given array is valid, for example, that it's not too big.

func (*DArray) Walk

func (expr *DArray) Walk(v Visitor) Expr

Walk implements the Expr interface.

type DBitArray

type DBitArray struct {
	bitarray.BitArray
}

DBitArray is the BIT/VARBIT Datum.

func AsDBitArray

func AsDBitArray(e Expr) (*DBitArray, bool)

AsDBitArray attempts to retrieve a *DBitArray from an Expr, returning a *DBitArray and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions.

func FormatBitArrayToType

func FormatBitArrayToType(d *DBitArray, t *types.T) *DBitArray

FormatBitArrayToType formats bit arrays such that they fill the total width if too short, or truncate if too long.

func MakeDBitArray

func MakeDBitArray(bitLen uint) DBitArray

MakeDBitArray returns a DBitArray.

func MustBeDBitArray

func MustBeDBitArray(e Expr) *DBitArray

MustBeDBitArray attempts to retrieve a DBitArray from an Expr, panicking if the assertion fails.

func NewDBitArray

func NewDBitArray(bitLen uint) *DBitArray

NewDBitArray returns a DBitArray.

func NewDBitArrayFromInt

func NewDBitArrayFromInt(i int64, width uint) (*DBitArray, error)

NewDBitArrayFromInt creates a bit array from the specified integer at the specified width. If the width is zero, only positive integers can be converted. If the width is nonzero, the value is truncated to that width. Negative values are encoded using two's complement.

func ParseDBitArray

func ParseDBitArray(s string) (*DBitArray, error)

ParseDBitArray parses a string representation of binary digits.

func (*DBitArray) AmbiguousFormat

func (*DBitArray) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DBitArray) AsDInt

func (d *DBitArray) AsDInt(n uint) *DInt

AsDInt computes the integer value of the given bit array. The value is assumed to be encoded using two's complement. The result is truncated to the given integer number of bits, if specified. The given width must be 64 or smaller. The results are undefined if n is greater than 64.

func (*DBitArray) Compare

func (d *DBitArray) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DBitArray) CompareError

func (d *DBitArray) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DBitArray) Eval

func (node *DBitArray) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DBitArray) Format

func (d *DBitArray) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DBitArray) IsMax

func (d *DBitArray) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DBitArray) IsMin

func (d *DBitArray) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DBitArray) Max

func (d *DBitArray) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DBitArray) Min

func (d *DBitArray) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DBitArray) Next

func (d *DBitArray) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DBitArray) Prev

func (d *DBitArray) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DBitArray) ResolvedType

func (*DBitArray) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DBitArray) Size

func (d *DBitArray) Size() uintptr

Size implements the Datum interface.

func (*DBitArray) String

func (node *DBitArray) String() string

func (*DBitArray) TypeCheck

func (d *DBitArray) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DBitArray) Walk

func (expr *DBitArray) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DBool

type DBool bool

DBool is the boolean Datum.

func ArrayContains

func ArrayContains(ctx CompareContext, haystack *DArray, needles *DArray) (*DBool, error)

ArrayContains return true if the haystack contains all needles.

func ArrayOverlaps

func ArrayOverlaps(ctx CompareContext, array, other *DArray) (*DBool, error)

ArrayOverlaps return true if there is even one element common between the left and right arrays.

func AsDBool

func AsDBool(e Expr) (DBool, bool)

AsDBool attempts to retrieve a *DBool from an Expr, returning a *DBool and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions.

func GetBool

func GetBool(d Datum) (DBool, error)

GetBool gets DBool or an error (also treats NULL as false, not an error).

func JSONExistsAny

func JSONExistsAny(json DJSON, dArray *DArray) (*DBool, error)

JSONExistsAny return true if any value in dArray is exist in the json

func MakeDBool

func MakeDBool(d DBool) *DBool

MakeDBool converts its argument to a *DBool, returning either DBoolTrue or DBoolFalse.

func MustBeDBool

func MustBeDBool(e Expr) DBool

MustBeDBool attempts to retrieve a DBool from an Expr, panicking if the assertion fails.

func ParseDBool

func ParseDBool(s string) (*DBool, error)

ParseDBool parses and returns the *DBool Datum value represented by the provided string, or an error if parsing is unsuccessful. See https://github.com/postgres/postgres/blob/90627cf98a8e7d0531789391fd798c9bfcc3bc1a/src/backend/utils/adt/bool.c#L36

func (*DBool) AmbiguousFormat

func (*DBool) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DBool) Compare

func (d *DBool) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DBool) CompareError

func (d *DBool) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DBool) Eval

func (node *DBool) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DBool) Format

func (d *DBool) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DBool) IsMax

func (d *DBool) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DBool) IsMin

func (d *DBool) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DBool) Max

func (d *DBool) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DBool) Min

func (d *DBool) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DBool) Next

func (*DBool) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DBool) Prev

func (*DBool) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DBool) ResolvedType

func (*DBool) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DBool) Size

func (d *DBool) Size() uintptr

Size implements the Datum interface.

func (*DBool) String

func (node *DBool) String() string

func (*DBool) TypeCheck

func (d *DBool) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DBool) Walk

func (expr *DBool) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DBox2D

type DBox2D struct {
	geo.CartesianBoundingBox
}

DBox2D is the Datum representation of the Box2D type.

func AsDBox2D

func AsDBox2D(e Expr) (*DBox2D, bool)

AsDBox2D attempts to retrieve a *DBox2D from an Expr, returning a *DBox2D and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DBox2D wrapped by a *DOidWrapper is possible.

func MustBeDBox2D

func MustBeDBox2D(e Expr) *DBox2D

MustBeDBox2D attempts to retrieve a *DBox2D from an Expr, panicking if the assertion fails.

func NewDBox2D

func NewDBox2D(b geo.CartesianBoundingBox) *DBox2D

NewDBox2D returns a new Box2D Datum.

func ParseDBox2D

func ParseDBox2D(str string) (*DBox2D, error)

ParseDBox2D attempts to pass `str` as a Box2D type.

func (*DBox2D) AmbiguousFormat

func (*DBox2D) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DBox2D) Compare

func (d *DBox2D) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DBox2D) CompareError

func (d *DBox2D) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DBox2D) Eval

func (node *DBox2D) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DBox2D) Format

func (d *DBox2D) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DBox2D) IsMax

func (d *DBox2D) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DBox2D) IsMin

func (d *DBox2D) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DBox2D) Max

func (d *DBox2D) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DBox2D) Min

func (d *DBox2D) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DBox2D) Next

func (d *DBox2D) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DBox2D) Prev

func (d *DBox2D) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DBox2D) ResolvedType

func (*DBox2D) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DBox2D) Size

func (d *DBox2D) Size() uintptr

Size implements the Datum interface.

func (*DBox2D) String

func (node *DBox2D) String() string

func (*DBox2D) TypeCheck

func (d *DBox2D) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DBox2D) Walk

func (expr *DBox2D) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DBytes

type DBytes string

DBytes is the bytes Datum. The underlying type is a string because we want the immutability, but this may contain arbitrary bytes.

func AsDBytes

func AsDBytes(e Expr) (DBytes, bool)

AsDBytes attempts to convert an Expr into a DBytes, returning a flag indicating whether it was successful.

func MustBeDBytes

func MustBeDBytes(e Expr) DBytes

MustBeDBytes attempts to convert an Expr into a DBytes, panicking if unsuccessful.

func NewDBytes

func NewDBytes(d DBytes) *DBytes

NewDBytes is a helper routine to create a *DBytes initialized from its argument.

func ParseDByte

func ParseDByte(s string) (*DBytes, error)

ParseDByte parses a string representation of hex encoded binary data. It supports both the hex format, with "\x" followed by a string of hexadecimal digits (the "\x" prefix occurs just once at the beginning), and the escaped format, which supports "\\" and octal escapes.

func (*DBytes) AmbiguousFormat

func (*DBytes) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DBytes) Compare

func (d *DBytes) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DBytes) CompareError

func (d *DBytes) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DBytes) Eval

func (node *DBytes) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DBytes) Format

func (d *DBytes) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DBytes) IsMax

func (*DBytes) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DBytes) IsMin

func (d *DBytes) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DBytes) Max

func (d *DBytes) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DBytes) Min

func (d *DBytes) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DBytes) Next

func (d *DBytes) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DBytes) Prev

func (d *DBytes) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DBytes) ResolvedType

func (*DBytes) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DBytes) Size

func (d *DBytes) Size() uintptr

Size implements the Datum interface.

func (*DBytes) String

func (node *DBytes) String() string

func (*DBytes) TypeCheck

func (d *DBytes) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DBytes) UnsafeBytes

func (d *DBytes) UnsafeBytes() []byte

UnsafeBytes returns the raw bytes avoiding allocation. It is "unsafe" because the contract is that callers must not to mutate the bytes but there is nothing stopping that from happening.

func (*DBytes) Walk

func (expr *DBytes) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DCollatedString

type DCollatedString struct {
	Contents string
	Locale   string
	// Key is the collation key.
	Key []byte
}

DCollatedString is the Datum for strings with a locale. The struct members are intended to be immutable.

func AsDCollatedString

func AsDCollatedString(e Expr) (DCollatedString, bool)

AsDCollatedString attempts to retrieve a DString from an Expr, returning a AsDCollatedString and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DCollatedString wrapped by a *DOidWrapper is possible.

func NewDCollatedString

func NewDCollatedString(
	contents string, locale string, env *CollationEnvironment,
) (*DCollatedString, error)

NewDCollatedString is a helper routine to create a *DCollatedString. Panics if locale is invalid. Not safe for concurrent use.

func (*DCollatedString) AmbiguousFormat

func (*DCollatedString) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DCollatedString) Compare

func (d *DCollatedString) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DCollatedString) CompareError

func (d *DCollatedString) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DCollatedString) Eval

func (node *DCollatedString) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DCollatedString) Format

func (d *DCollatedString) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DCollatedString) IsComposite

func (d *DCollatedString) IsComposite() bool

IsComposite implements the CompositeDatum interface.

func (*DCollatedString) IsMax

func (*DCollatedString) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DCollatedString) IsMin

func (d *DCollatedString) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DCollatedString) Max

func (d *DCollatedString) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DCollatedString) Min

func (d *DCollatedString) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DCollatedString) Next

func (d *DCollatedString) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DCollatedString) Prev

func (d *DCollatedString) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DCollatedString) ResolvedType

func (d *DCollatedString) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DCollatedString) Size

func (d *DCollatedString) Size() uintptr

Size implements the Datum interface.

func (*DCollatedString) String

func (node *DCollatedString) String() string

func (*DCollatedString) TypeCheck

func (d *DCollatedString) TypeCheck(
	_ context.Context, _ *SemaContext, _ *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DCollatedString) UnsafeContentBytes

func (d *DCollatedString) UnsafeContentBytes() []byte

UnsafeContentBytes returns the raw bytes avoiding allocation. It is "unsafe" because the contract is that callers must not to mutate the bytes but there is nothing stopping that from happening.

func (*DCollatedString) Walk

func (expr *DCollatedString) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DDate

type DDate struct {
	pgdate.Date
}

DDate is the date Datum represented as the number of days after the Unix epoch.

func AsDDate

func AsDDate(e Expr) (DDate, bool)

AsDDate attempts to retrieve a DDate from an Expr, returning a DDate and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DDate wrapped by a *DOidWrapper is possible.

func MakeDDate

func MakeDDate(d pgdate.Date) DDate

MakeDDate makes a DDate from a pgdate.Date.

func MustBeDDate

func MustBeDDate(e Expr) DDate

MustBeDDate attempts to retrieve a DDate from an Expr, panicking if the assertion fails.

func NewDDate

func NewDDate(d pgdate.Date) *DDate

NewDDate is a helper routine to create a *DDate initialized from its argument.

func NewDDateFromTime

func NewDDateFromTime(t time.Time) (*DDate, error)

NewDDateFromTime constructs a *DDate from a time.Time.

func ParseDDate

func ParseDDate(ctx ParseContext, s string) (_ *DDate, dependsOnContext bool, _ error)

ParseDDate parses and returns the *DDate Datum value represented by the provided string in the provided location, or an error if parsing is unsuccessful.

The dependsOnContext return value indicates if we had to consult the ParseContext (either for the time or the local timezone).

func (*DDate) AmbiguousFormat

func (*DDate) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DDate) Compare

func (d *DDate) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DDate) CompareError

func (d *DDate) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DDate) Eval

func (node *DDate) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DDate) Format

func (d *DDate) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DDate) IsMax

func (d *DDate) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DDate) IsMin

func (d *DDate) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DDate) Max

func (d *DDate) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DDate) Min

func (d *DDate) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DDate) Next

func (d *DDate) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DDate) Prev

func (d *DDate) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DDate) ResolvedType

func (*DDate) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DDate) Size

func (d *DDate) Size() uintptr

Size implements the Datum interface.

func (*DDate) String

func (node *DDate) String() string

func (*DDate) TypeCheck

func (d *DDate) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DDate) Walk

func (expr *DDate) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DDecimal

type DDecimal struct {
	apd.Decimal
}

DDecimal is the decimal Datum.

var DecimalOne DDecimal

DecimalOne represents the constant 1 as DECIMAL.

func AsDDecimal

func AsDDecimal(e Expr) (*DDecimal, bool)

AsDDecimal attempts to retrieve a DDecimal from an Expr, returning a DDecimal and a flag signifying whether the assertion was successful.

func MustBeDDecimal

func MustBeDDecimal(e Expr) DDecimal

MustBeDDecimal attempts to retrieve a DDecimal from an Expr, panicking if the assertion fails.

func ParseDDecimal

func ParseDDecimal(s string) (*DDecimal, error)

ParseDDecimal parses and returns the *DDecimal Datum value represented by the provided string, or an error if parsing is unsuccessful.

func (*DDecimal) AmbiguousFormat

func (*DDecimal) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DDecimal) Compare

func (d *DDecimal) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DDecimal) CompareError

func (d *DDecimal) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DDecimal) Eval

func (node *DDecimal) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DDecimal) Format

func (d *DDecimal) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DDecimal) IsComposite

func (d *DDecimal) IsComposite() bool

IsComposite implements the CompositeDatum interface.

func (*DDecimal) IsMax

func (d *DDecimal) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DDecimal) IsMin

func (d *DDecimal) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DDecimal) Max

func (d *DDecimal) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DDecimal) Min

func (d *DDecimal) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DDecimal) Next

func (d *DDecimal) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DDecimal) Prev

func (d *DDecimal) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DDecimal) ResolvedType

func (*DDecimal) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DDecimal) SetString

func (d *DDecimal) SetString(s string) error

SetString sets d to s. Any non-standard NaN values are converted to a normal NaN. Any negative zero is converted to positive.

func (*DDecimal) Size

func (d *DDecimal) Size() uintptr

Size implements the Datum interface.

func (*DDecimal) String

func (node *DDecimal) String() string

func (*DDecimal) TypeCheck

func (d *DDecimal) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DDecimal) Walk

func (expr *DDecimal) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DEncodedKey

type DEncodedKey string

DEncodedKey is a special Datum of types.EncodedKey type, used to pass through encoded key data. It is similar to DBytes, except when it comes to encoding/decoding. It is currently used to pass around inverted index keys, which do not fully encode an object.

func NewDEncodedKey

func NewDEncodedKey(d DEncodedKey) *DEncodedKey

NewDEncodedKey is a helper routine to create a *DEncodedKey initialized from its argument.

func (*DEncodedKey) AmbiguousFormat

func (*DEncodedKey) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DEncodedKey) Compare

func (d *DEncodedKey) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DEncodedKey) CompareError

func (d *DEncodedKey) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DEncodedKey) Eval

func (node *DEncodedKey) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DEncodedKey) Format

func (d *DEncodedKey) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DEncodedKey) IsMax

func (*DEncodedKey) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DEncodedKey) IsMin

func (d *DEncodedKey) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DEncodedKey) Max

func (d *DEncodedKey) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DEncodedKey) Min

func (d *DEncodedKey) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DEncodedKey) Next

func (d *DEncodedKey) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DEncodedKey) Prev

func (d *DEncodedKey) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DEncodedKey) ResolvedType

func (*DEncodedKey) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DEncodedKey) Size

func (d *DEncodedKey) Size() uintptr

Size implements the Datum interface.

func (*DEncodedKey) String

func (node *DEncodedKey) String() string

func (*DEncodedKey) TypeCheck

func (d *DEncodedKey) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DEncodedKey) UnsafeBytes

func (d *DEncodedKey) UnsafeBytes() []byte

UnsafeBytes returns the raw bytes avoiding allocation. It is "unsafe" because the contract is that callers must not to mutate the bytes but there is nothing stopping that from happening.

func (*DEncodedKey) Walk

func (expr *DEncodedKey) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DEnum

type DEnum struct {
	// EnumType is the hydrated type of this enum.
	EnumTyp *types.T
	// PhysicalRep is a slice containing the encodable and ordered physical
	// representation of this datum. It is used for comparisons and encoding.
	PhysicalRep []byte
	// LogicalRep is a string containing the user visible value of the enum.
	LogicalRep string
}

DEnum represents an ENUM value.

func AsDEnum

func AsDEnum(e Expr) (*DEnum, bool)

AsDEnum attempts to retrieve a DEnum from an Expr, returning a DEnum and a flag signifying whether the assertion was successful. The function should // be used instead of direct type assertions wherever a *DEnum wrapped by a // *DOidWrapper is possible.

func MakeDEnumFromLogicalRepresentation

func MakeDEnumFromLogicalRepresentation(typ *types.T, rep string) (DEnum, error)

MakeDEnumFromLogicalRepresentation creates a DEnum of the input type and input logical representation. It returns an error if the input logical representation is invalid.

func MakeDEnumFromPhysicalRepresentation

func MakeDEnumFromPhysicalRepresentation(typ *types.T, rep []byte) (DEnum, error)

MakeDEnumFromPhysicalRepresentation creates a DEnum of the input type and the input physical representation.

func NewDEnum

func NewDEnum(e DEnum) *DEnum

NewDEnum initializes a new DEnum from its argument.

func (*DEnum) AmbiguousFormat

func (d *DEnum) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DEnum) Compare

func (d *DEnum) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DEnum) CompareError

func (d *DEnum) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DEnum) Eval

func (node *DEnum) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DEnum) Format

func (d *DEnum) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DEnum) IsMax

func (d *DEnum) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DEnum) IsMin

func (d *DEnum) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DEnum) Max

func (d *DEnum) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DEnum) MaxWriteable

func (d *DEnum) MaxWriteable() (Datum, bool)

MaxWriteable returns the largest member of the enum that is writeable.

func (*DEnum) Min

func (d *DEnum) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DEnum) MinWriteable

func (d *DEnum) MinWriteable() (Datum, bool)

MinWriteable returns the smallest member of the enum that is writeable.

func (*DEnum) Next

func (d *DEnum) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DEnum) Prev

func (d *DEnum) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DEnum) ResolvedType

func (d *DEnum) ResolvedType() *types.T

ResolvedType implements the Datum interface.

func (*DEnum) Size

func (d *DEnum) Size() uintptr

Size implements the Datum interface.

func (*DEnum) String

func (d *DEnum) String() string

func (*DEnum) TypeCheck

func (d *DEnum) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DEnum) Walk

func (expr *DEnum) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DFloat

type DFloat float64

DFloat is the float Datum.

func AsDFloat

func AsDFloat(e Expr) (*DFloat, bool)

AsDFloat attempts to retrieve a DFloat from an Expr, returning a DFloat and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DFloat wrapped by a *DOidWrapper is possible.

func MustBeDFloat

func MustBeDFloat(e Expr) DFloat

MustBeDFloat attempts to retrieve a DFloat from an Expr, panicking if the assertion fails.

func NewDFloat

func NewDFloat(d DFloat) *DFloat

NewDFloat is a helper routine to create a *DFloat initialized from its argument.

func ParseDFloat

func ParseDFloat(s string) (*DFloat, error)

ParseDFloat parses and returns the *DFloat Datum value represented by the provided string, or an error if parsing is unsuccessful.

func (*DFloat) AmbiguousFormat

func (*DFloat) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DFloat) Compare

func (d *DFloat) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DFloat) CompareError

func (d *DFloat) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DFloat) Eval

func (node *DFloat) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DFloat) Format

func (d *DFloat) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DFloat) IsComposite

func (d *DFloat) IsComposite() bool

IsComposite implements the CompositeDatum interface.

func (*DFloat) IsMax

func (d *DFloat) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DFloat) IsMin

func (d *DFloat) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DFloat) Max

func (d *DFloat) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DFloat) Min

func (d *DFloat) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DFloat) Next

func (d *DFloat) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DFloat) Prev

func (d *DFloat) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DFloat) ResolvedType

func (*DFloat) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DFloat) Size

func (d *DFloat) Size() uintptr

Size implements the Datum interface.

func (*DFloat) String

func (node *DFloat) String() string

func (*DFloat) TypeCheck

func (d *DFloat) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DFloat) Walk

func (expr *DFloat) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DGeography

type DGeography struct {
	geo.Geography
}

DGeography is the Geometry Datum.

func AsDGeography

func AsDGeography(e Expr) (*DGeography, bool)

AsDGeography attempts to retrieve a *DGeography from an Expr, returning a *DGeography and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DGeography wrapped by a *DOidWrapper is possible.

func MustBeDGeography

func MustBeDGeography(e Expr) *DGeography

MustBeDGeography attempts to retrieve a *DGeography from an Expr, panicking if the assertion fails.

func NewDGeography

func NewDGeography(g geo.Geography) *DGeography

NewDGeography returns a new Geography Datum.

func ParseDGeography

func ParseDGeography(str string) (*DGeography, error)

ParseDGeography attempts to pass `str` as a Geography type.

func (*DGeography) AmbiguousFormat

func (*DGeography) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DGeography) Compare

func (d *DGeography) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DGeography) CompareError

func (d *DGeography) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DGeography) Eval

func (node *DGeography) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DGeography) Format

func (d *DGeography) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DGeography) IsMax

func (d *DGeography) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DGeography) IsMin

func (d *DGeography) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DGeography) Max

func (d *DGeography) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DGeography) Min

func (d *DGeography) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DGeography) Next

func (d *DGeography) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DGeography) Prev

func (d *DGeography) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DGeography) ResolvedType

func (*DGeography) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DGeography) Size

func (d *DGeography) Size() uintptr

Size implements the Datum interface.

func (*DGeography) String

func (node *DGeography) String() string

func (*DGeography) TypeCheck

func (d *DGeography) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DGeography) Walk

func (expr *DGeography) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DGeometry

type DGeometry struct {
	geo.Geometry
}

DGeometry is the Geometry Datum.

func AsDGeometry

func AsDGeometry(e Expr) (*DGeometry, bool)

AsDGeometry attempts to retrieve a *DGeometry from an Expr, returning a *DGeometry and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DGeometry wrapped by a *DOidWrapper is possible.

func MustBeDGeometry

func MustBeDGeometry(e Expr) *DGeometry

MustBeDGeometry attempts to retrieve a *DGeometry from an Expr, panicking if the assertion fails.

func NewDGeometry

func NewDGeometry(g geo.Geometry) *DGeometry

NewDGeometry returns a new Geometry Datum.

func ParseDGeometry

func ParseDGeometry(str string) (*DGeometry, error)

ParseDGeometry attempts to pass `str` as a Geometry type.

func (*DGeometry) AmbiguousFormat

func (*DGeometry) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DGeometry) Compare

func (d *DGeometry) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DGeometry) CompareError

func (d *DGeometry) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DGeometry) Eval

func (node *DGeometry) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DGeometry) Format

func (d *DGeometry) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DGeometry) IsMax

func (d *DGeometry) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DGeometry) IsMin

func (d *DGeometry) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DGeometry) Max

func (d *DGeometry) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DGeometry) Min

func (d *DGeometry) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DGeometry) Next

func (d *DGeometry) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DGeometry) Prev

func (d *DGeometry) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DGeometry) ResolvedType

func (*DGeometry) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DGeometry) Size

func (d *DGeometry) Size() uintptr

Size implements the Datum interface.

func (*DGeometry) String

func (node *DGeometry) String() string

func (*DGeometry) TypeCheck

func (d *DGeometry) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DGeometry) Walk

func (expr *DGeometry) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DIPAddr

type DIPAddr struct {
	ipaddr.IPAddr
}

DIPAddr is the IPAddr Datum.

func AsDIPAddr

func AsDIPAddr(e Expr) (DIPAddr, bool)

AsDIPAddr attempts to retrieve a *DIPAddr from an Expr, returning a *DIPAddr and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DIPAddr wrapped by a *DOidWrapper is possible.

func MustBeDIPAddr

func MustBeDIPAddr(e Expr) DIPAddr

MustBeDIPAddr attempts to retrieve a DIPAddr from an Expr, panicking if the assertion fails.

func NewDIPAddr

func NewDIPAddr(d DIPAddr) *DIPAddr

NewDIPAddr is a helper routine to create a *DIPAddr initialized from its argument.

func ParseDIPAddrFromINetString

func ParseDIPAddrFromINetString(s string) (*DIPAddr, error)

ParseDIPAddrFromINetString parses and returns the *DIPAddr Datum value represented by the provided input INet string, or an error.

func (*DIPAddr) AmbiguousFormat

func (*DIPAddr) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DIPAddr) Compare

func (d *DIPAddr) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DIPAddr) CompareError

func (d *DIPAddr) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DIPAddr) Eval

func (node *DIPAddr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DIPAddr) Format

func (d *DIPAddr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DIPAddr) IsMax

func (d *DIPAddr) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DIPAddr) IsMin

func (d *DIPAddr) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DIPAddr) Max

func (*DIPAddr) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DIPAddr) Min

func (*DIPAddr) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DIPAddr) Next

func (d *DIPAddr) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DIPAddr) Prev

func (d *DIPAddr) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DIPAddr) ResolvedType

func (*DIPAddr) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DIPAddr) Size

func (d *DIPAddr) Size() uintptr

Size implements the Datum interface.

func (*DIPAddr) String

func (node *DIPAddr) String() string

func (*DIPAddr) TypeCheck

func (d *DIPAddr) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DIPAddr) Walk

func (expr *DIPAddr) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DInt

type DInt int64

DInt is the int Datum.

func AsDInt

func AsDInt(e Expr) (DInt, bool)

AsDInt attempts to retrieve a DInt from an Expr, returning a DInt and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DInt wrapped by a *DOidWrapper is possible.

func MustBeDInt

func MustBeDInt(e Expr) DInt

MustBeDInt attempts to retrieve a DInt from an Expr, panicking if the assertion fails.

func NewDInt

func NewDInt(d DInt) *DInt

NewDInt is a helper routine to create a *DInt initialized from its argument.

func ParseDInt

func ParseDInt(s string) (*DInt, error)

ParseDInt parses and returns the *DInt Datum value represented by the provided string, or an error if parsing is unsuccessful.

func (*DInt) AmbiguousFormat

func (*DInt) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DInt) Compare

func (d *DInt) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DInt) CompareError

func (d *DInt) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DInt) Eval

func (node *DInt) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DInt) Format

func (d *DInt) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DInt) IsMax

func (d *DInt) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DInt) IsMin

func (d *DInt) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DInt) Max

func (d *DInt) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DInt) Min

func (d *DInt) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DInt) Next

func (d *DInt) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DInt) Prev

func (d *DInt) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DInt) ResolvedType

func (*DInt) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DInt) Size

func (d *DInt) Size() uintptr

Size implements the Datum interface.

func (*DInt) String

func (node *DInt) String() string

func (*DInt) TypeCheck

func (d *DInt) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DInt) Walk

func (expr *DInt) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DInterval

type DInterval struct {
	duration.Duration
}

DInterval is the interval Datum.

func AsDInterval

func AsDInterval(e Expr) (*DInterval, bool)

AsDInterval attempts to retrieve a DInterval from an Expr, returning a DInterval and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DInterval wrapped by a *DOidWrapper is possible.

func MustBeDInterval

func MustBeDInterval(e Expr) *DInterval

MustBeDInterval attempts to retrieve a DInterval from an Expr, panicking if the assertion fails.

func NewDInterval

NewDInterval creates a new DInterval.

func ParseDInterval

func ParseDInterval(style duration.IntervalStyle, s string) (*DInterval, error)

ParseDInterval parses and returns the *DInterval Datum value represented by the provided string, or an error if parsing is unsuccessful.

func ParseDIntervalWithTypeMetadata

func ParseDIntervalWithTypeMetadata(
	style duration.IntervalStyle, s string, itm types.IntervalTypeMetadata,
) (*DInterval, error)

ParseDIntervalWithTypeMetadata is like ParseDInterval, but it also takes a types.IntervalTypeMetadata that both specifies the units for unitless, numeric intervals and also specifies the precision of the interval.

func (*DInterval) AmbiguousFormat

func (*DInterval) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DInterval) Compare

func (d *DInterval) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DInterval) CompareError

func (d *DInterval) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DInterval) Eval

func (node *DInterval) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DInterval) Format

func (d *DInterval) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DInterval) IsMax

func (d *DInterval) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DInterval) IsMin

func (d *DInterval) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DInterval) Max

func (d *DInterval) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DInterval) Min

func (d *DInterval) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DInterval) Next

func (d *DInterval) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DInterval) Prev

func (d *DInterval) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DInterval) ResolvedType

func (*DInterval) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DInterval) Size

func (d *DInterval) Size() uintptr

Size implements the Datum interface.

func (*DInterval) String

func (node *DInterval) String() string

func (*DInterval) TypeCheck

func (d *DInterval) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DInterval) ValueAsISO8601String

func (d *DInterval) ValueAsISO8601String() string

ValueAsISO8601String returns the interval as an ISO 8601 Duration string (e.g. "P1Y2MT6S").

func (*DInterval) Walk

func (expr *DInterval) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DJSON

type DJSON struct{ json.JSON }

DJSON is the JSON Datum.

func AsDJSON

func AsDJSON(e Expr) (*DJSON, bool)

AsDJSON attempts to retrieve a *DJSON from an Expr, returning a *DJSON and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DJSON wrapped by a *DOidWrapper is possible.

func MustBeDJSON

func MustBeDJSON(e Expr) DJSON

MustBeDJSON attempts to retrieve a DJSON from an Expr, panicking if the assertion fails.

func NewDJSON

func NewDJSON(j json.JSON) *DJSON

NewDJSON is a helper routine to create a DJSON initialized from its argument.

func (*DJSON) AmbiguousFormat

func (*DJSON) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DJSON) Compare

func (d *DJSON) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DJSON) CompareError

func (d *DJSON) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DJSON) Eval

func (node *DJSON) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DJSON) Format

func (d *DJSON) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DJSON) IsComposite

func (d *DJSON) IsComposite() bool

IsComposite implements the CompositeDatum interface.

func (*DJSON) IsMax

func (d *DJSON) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DJSON) IsMin

func (d *DJSON) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DJSON) Max

func (d *DJSON) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DJSON) Min

func (d *DJSON) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DJSON) Next

func (d *DJSON) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DJSON) Prev

func (d *DJSON) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DJSON) ResolvedType

func (*DJSON) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DJSON) Size

func (d *DJSON) Size() uintptr

Size implements the Datum interface. TODO(justin): is this a frequently-called method? Should we be caching the computed size?

func (*DJSON) String

func (node *DJSON) String() string

func (*DJSON) TypeCheck

func (d *DJSON) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DJSON) Walk

func (expr *DJSON) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DOid

type DOid struct {
	// A DOid embeds a oid.Oid, the underlying integer OID for this OID datum.
	Oid oid.Oid
	// contains filtered or unexported fields
}

DOid is the Postgres OID datum. It can represent either an OID type or any of the reg* types, such as regproc or regclass. An OID must only be 32 bits, since this width encoding is enforced in the pgwire protocol. OIDs are not guaranteed to be globally unique.

func AsDOid

func AsDOid(e Expr) (*DOid, bool)

AsDOid attempts to retrieve a DOid from an Expr, returning a DOid and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DOid wrapped by a *DOidWrapper is possible.

func IntToOid

func IntToOid(i DInt) (*DOid, error)

IntToOid is a helper that turns a DInt into a *DOid and checks that the value is in range.

func MakeDOid

func MakeDOid(d oid.Oid, semanticType *types.T) DOid

MakeDOid is a helper routine to create a DOid initialized from a DInt.

func MustBeDOid

func MustBeDOid(e Expr) *DOid

MustBeDOid attempts to retrieve a DOid from an Expr, panicking if the assertion fails.

func NewDOid

func NewDOid(d oid.Oid) *DOid

NewDOid is a helper routine to create a *DOid initialized from a DInt.

func NewDOidWithName

func NewDOidWithName(d oid.Oid, typ *types.T, name string) *DOid

NewDOidWithName is a helper routine to create a *DOid initialized from a DInt and a string.

func NewDOidWithType

func NewDOidWithType(d oid.Oid, semanticType *types.T) *DOid

NewDOidWithType constructs a DOid with the given type and no name.

func NewDOidWithTypeAndName

func NewDOidWithTypeAndName(d oid.Oid, semanticType *types.T, name string) *DOid

NewDOidWithTypeAndName constructs a DOid with the given type and name.

func ParseDOidAsInt

func ParseDOidAsInt(s string) (*DOid, error)

ParseDOidAsInt parses the input and returns it as an OID. If the input is not formatted as an int, an error is returned.

func (*DOid) AmbiguousFormat

func (*DOid) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DOid) AsRegProc

func (d *DOid) AsRegProc(name string) *DOid

AsRegProc changes the input DOid into a regproc with the given name and returns it.

func (*DOid) Compare

func (d *DOid) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DOid) CompareError

func (d *DOid) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DOid) Eval

func (node *DOid) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DOid) Format

func (d *DOid) Format(ctx *FmtCtx)

Format implements the Datum interface.

func (*DOid) IsMax

func (d *DOid) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DOid) IsMin

func (d *DOid) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DOid) Max

func (d *DOid) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DOid) Min

func (d *DOid) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DOid) Name

func (d *DOid) Name() string

Name returns the name associated with this DOid.

func (*DOid) Next

func (d *DOid) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DOid) Prev

func (d *DOid) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DOid) ResolvedType

func (d *DOid) ResolvedType() *types.T

ResolvedType implements the Datum interface.

func (*DOid) Size

func (d *DOid) Size() uintptr

Size implements the Datum interface.

func (*DOid) String

func (node *DOid) String() string

func (*DOid) TypeCheck

func (d *DOid) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DOid) Walk

func (expr *DOid) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DOidWrapper

type DOidWrapper struct {
	Wrapped Datum
	Oid     oid.Oid
}

DOidWrapper is a Datum implementation which is a wrapper around a Datum, allowing custom Oid values to be attached to the Datum and its types.T. The reason the Datum type was introduced was to permit the introduction of Datum types with new Object IDs while maintaining identical behavior to current Datum types. Specifically, it obviates the need to define a new tree.Datum type for each possible Oid value.

Instead, DOidWrapper allows a standard Datum to be wrapped with a new Oid. This approach provides two major advantages:

  • performance of the existing Datum types are not affected because they do not need to have custom oid.Oids added to their structure.
  • the introduction of new Datum aliases is straightforward and does not require additions to typing rules or type-dependent evaluation behavior.

Types that currently benefit from DOidWrapper are: - DName => DOidWrapper(*DString, oid.T_name) - DRefCursor => DOidWrapper(*DString, oid.T_refcursor)

func (*DOidWrapper) AmbiguousFormat

func (d *DOidWrapper) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DOidWrapper) Compare

func (d *DOidWrapper) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DOidWrapper) CompareError

func (d *DOidWrapper) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DOidWrapper) Eval

func (node *DOidWrapper) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DOidWrapper) Format

func (d *DOidWrapper) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DOidWrapper) IsMax

func (d *DOidWrapper) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DOidWrapper) IsMin

func (d *DOidWrapper) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DOidWrapper) Max

func (d *DOidWrapper) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DOidWrapper) Min

func (d *DOidWrapper) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DOidWrapper) Next

func (d *DOidWrapper) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DOidWrapper) Prev

func (d *DOidWrapper) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DOidWrapper) ResolvedType

func (d *DOidWrapper) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DOidWrapper) Size

func (d *DOidWrapper) Size() uintptr

Size implements the Datum interface.

func (*DOidWrapper) String

func (node *DOidWrapper) String() string

func (*DOidWrapper) TypeCheck

func (d *DOidWrapper) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DOidWrapper) Walk

func (expr *DOidWrapper) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DPGLSN

type DPGLSN struct {
	lsn.LSN
}

func AsDPGLSN

func AsDPGLSN(e Expr) (*DPGLSN, bool)

AsDPGLSN attempts to retrieve a *DPGLSN from an Expr, returning a *DPGLSN and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DPGLSN wrapped by a *DOidWrapper is possible.

func MustBeDPGLSN

func MustBeDPGLSN(e Expr) *DPGLSN

MustBeDPGLSN attempts to retrieve a *DPGLSN from an Expr, panicking if the assertion fails.

func NewDPGLSN

func NewDPGLSN(l lsn.LSN) *DPGLSN

NewDPGLSN returns a new PGLSN Datum.

func ParseDPGLSN

func ParseDPGLSN(str string) (*DPGLSN, error)

ParseDPGLSN attempts to pass `str` as a PGLSN type.

func (*DPGLSN) AmbiguousFormat

func (*DPGLSN) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DPGLSN) Compare

func (d *DPGLSN) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DPGLSN) CompareError

func (d *DPGLSN) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DPGLSN) Eval

func (node *DPGLSN) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DPGLSN) Format

func (d *DPGLSN) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DPGLSN) IsMax

func (d *DPGLSN) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DPGLSN) IsMin

func (d *DPGLSN) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DPGLSN) Max

func (d *DPGLSN) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DPGLSN) Min

func (d *DPGLSN) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DPGLSN) Next

func (d *DPGLSN) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DPGLSN) Prev

func (d *DPGLSN) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DPGLSN) ResolvedType

func (*DPGLSN) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DPGLSN) Size

func (d *DPGLSN) Size() uintptr

Size implements the Datum interface.

func (*DPGLSN) String

func (node *DPGLSN) String() string

func (*DPGLSN) TypeCheck

func (d *DPGLSN) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DPGLSN) Walk

func (expr *DPGLSN) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DString

type DString string

DString is the string Datum.

func AsDString

func AsDString(e Expr) (DString, bool)

AsDString attempts to retrieve a DString from an Expr, returning a DString and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DString wrapped by a *DOidWrapper is possible.

func MustBeDString

func MustBeDString(e Expr) DString

MustBeDString attempts to retrieve a DString from an Expr, panicking if the assertion fails.

func MustBeDStringOrDNull

func MustBeDStringOrDNull(e Expr) DString

MustBeDStringOrDNull attempts to retrieve a DString or DNull from an Expr, panicking if the assertion fails.

func NewDString

func NewDString(d string) *DString

NewDString is a helper routine to create a *DString initialized from its argument.

func (*DString) AmbiguousFormat

func (*DString) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DString) Compare

func (d *DString) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DString) CompareError

func (d *DString) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DString) Eval

func (node *DString) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DString) Format

func (d *DString) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DString) IsMax

func (*DString) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DString) IsMin

func (d *DString) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DString) Max

func (d *DString) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DString) Min

func (d *DString) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DString) Next

func (d *DString) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DString) Prev

func (d *DString) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DString) ResolvedType

func (*DString) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DString) Size

func (d *DString) Size() uintptr

Size implements the Datum interface.

func (*DString) String

func (node *DString) String() string

func (*DString) TypeCheck

func (d *DString) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DString) UnsafeBytes

func (d *DString) UnsafeBytes() []byte

UnsafeBytes returns the raw bytes avoiding allocation. It is "Unsafe" because the contract is that callers must not to mutate the bytes but there is nothing stopping that from happening.

func (*DString) Walk

func (expr *DString) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DTSQuery

type DTSQuery struct {
	tsearch.TSQuery
}

DTSQuery is the tsquery Datum.

func AsDTSQuery

func AsDTSQuery(e Expr) (*DTSQuery, bool)

AsDTSQuery attempts to retrieve a DTSQuery from an Expr, returning a DTSQuery and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DTSQuery wrapped by a *DOidWrapper is possible.

func MustBeDTSQuery

func MustBeDTSQuery(e Expr) *DTSQuery

MustBeDTSQuery attempts to retrieve a DTSQuery from an Expr, panicking if the assertion fails.

func NewDTSQuery

func NewDTSQuery(q tsearch.TSQuery) *DTSQuery

NewDTSQuery is a helper routine to create a DTSQuery initialized from its argument.

func (*DTSQuery) AmbiguousFormat

func (d *DTSQuery) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DTSQuery) Compare

func (d *DTSQuery) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DTSQuery) CompareError

func (d *DTSQuery) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DTSQuery) Eval

func (node *DTSQuery) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DTSQuery) Format

func (d *DTSQuery) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DTSQuery) IsMax

func (d *DTSQuery) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DTSQuery) IsMin

func (d *DTSQuery) IsMin(_ CompareContext) bool

IsMin implements the Datum interface.

func (*DTSQuery) Max

func (d *DTSQuery) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DTSQuery) Min

func (d *DTSQuery) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DTSQuery) Next

func (d *DTSQuery) Next(_ CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DTSQuery) Prev

func (d *DTSQuery) Prev(_ CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DTSQuery) ResolvedType

func (d *DTSQuery) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DTSQuery) Size

func (d *DTSQuery) Size() uintptr

Size implements the Datum interface.

func (*DTSQuery) TypeCheck

func (d *DTSQuery) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DTSQuery) Walk

func (expr *DTSQuery) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DTSVector

type DTSVector struct {
	tsearch.TSVector
}

DTSVector is the tsvector Datum.

func AsDTSVector

func AsDTSVector(e Expr) (*DTSVector, bool)

AsDTSVector attempts to retrieve a DTSVector from an Expr, returning a DTSVector and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DTSVector wrapped by a *DOidWrapper is possible.

func MustBeDTSVector

func MustBeDTSVector(e Expr) *DTSVector

MustBeDTSVector attempts to retrieve a DTSVector from an Expr, panicking if the assertion fails.

func NewDTSVector

func NewDTSVector(v tsearch.TSVector) *DTSVector

NewDTSVector is a helper routine to create a DTSVector initialized from its argument.

func (*DTSVector) AmbiguousFormat

func (d *DTSVector) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DTSVector) Compare

func (d *DTSVector) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DTSVector) CompareError

func (d *DTSVector) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DTSVector) Eval

func (node *DTSVector) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DTSVector) Format

func (d *DTSVector) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DTSVector) IsMax

func (d *DTSVector) IsMax(_ CompareContext) bool

IsMax implements the Datum interface.

func (*DTSVector) IsMin

func (d *DTSVector) IsMin(_ CompareContext) bool

IsMin implements the Datum interface.

func (*DTSVector) Max

func (d *DTSVector) Max(_ CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DTSVector) Min

func (d *DTSVector) Min(_ CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DTSVector) Next

func (d *DTSVector) Next(_ CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DTSVector) Prev

func (d *DTSVector) Prev(_ CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DTSVector) ResolvedType

func (d *DTSVector) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DTSVector) Size

func (d *DTSVector) Size() uintptr

Size implements the Datum interface.

func (*DTSVector) TypeCheck

func (d *DTSVector) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DTSVector) Walk

func (expr *DTSVector) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DTime

type DTime timeofday.TimeOfDay

DTime is the time Datum.

func AsDTime

func AsDTime(e Expr) (DTime, bool)

AsDTime attempts to retrieve a DTime from an Expr, returning a DTimestamp and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DTime wrapped by a *DOidWrapper is possible.

func MakeDTime

func MakeDTime(t timeofday.TimeOfDay) *DTime

MakeDTime creates a DTime from a TimeOfDay.

func ParseDTime

func ParseDTime(
	ctx ParseContext, s string, precision time.Duration,
) (_ *DTime, dependsOnContext bool, _ error)

ParseDTime parses and returns the *DTime Datum value represented by the provided string, or an error if parsing is unsuccessful.

The dependsOnContext return value indicates if we had to consult the ParseContext (either for the time or the local timezone).

func (*DTime) AmbiguousFormat

func (*DTime) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DTime) Compare

func (d *DTime) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DTime) CompareError

func (d *DTime) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DTime) Eval

func (node *DTime) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DTime) Format

func (d *DTime) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DTime) IsMax

func (d *DTime) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DTime) IsMin

func (d *DTime) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DTime) Max

func (d *DTime) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DTime) Min

func (d *DTime) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DTime) Next

func (d *DTime) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DTime) Prev

func (d *DTime) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DTime) ResolvedType

func (*DTime) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DTime) Round

func (d *DTime) Round(precision time.Duration) *DTime

Round returns a new DTime to the specified precision.

func (*DTime) Size

func (d *DTime) Size() uintptr

Size implements the Datum interface.

func (*DTime) String

func (node *DTime) String() string

func (*DTime) TypeCheck

func (d *DTime) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DTime) Walk

func (expr *DTime) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DTimeTZ

type DTimeTZ struct {
	timetz.TimeTZ
}

DTimeTZ is the time with time zone Datum.

func AsDTimeTZ

func AsDTimeTZ(e Expr) (DTimeTZ, bool)

AsDTimeTZ attempts to retrieve a DTimeTZ from an Expr, returning a DTimeTZ and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DTimeTZ wrapped by a *DOidWrapper is possible.

func NewDTimeTZ

func NewDTimeTZ(t timetz.TimeTZ) *DTimeTZ

NewDTimeTZ creates a DTimeTZ from a timetz.TimeTZ.

func NewDTimeTZFromLocation

func NewDTimeTZFromLocation(t timeofday.TimeOfDay, loc *time.Location) *DTimeTZ

NewDTimeTZFromLocation creates a DTimeTZ from a TimeOfDay and time.Location.

func NewDTimeTZFromOffset

func NewDTimeTZFromOffset(t timeofday.TimeOfDay, offsetSecs int32) *DTimeTZ

NewDTimeTZFromOffset creates a DTimeTZ from a TimeOfDay and offset.

func NewDTimeTZFromTime

func NewDTimeTZFromTime(t time.Time) *DTimeTZ

NewDTimeTZFromTime creates a DTimeTZ from time.Time.

func ParseDTimeTZ

func ParseDTimeTZ(
	ctx ParseContext, s string, precision time.Duration,
) (_ *DTimeTZ, dependsOnContext bool, _ error)

ParseDTimeTZ parses and returns the *DTime Datum value represented by the provided string, or an error if parsing is unsuccessful.

The dependsOnContext return value indicates if we had to consult the ParseContext (either for the time or the local timezone).

func (*DTimeTZ) AmbiguousFormat

func (*DTimeTZ) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DTimeTZ) Compare

func (d *DTimeTZ) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DTimeTZ) CompareError

func (d *DTimeTZ) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DTimeTZ) Eval

func (node *DTimeTZ) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DTimeTZ) Format

func (d *DTimeTZ) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DTimeTZ) IsMax

func (d *DTimeTZ) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DTimeTZ) IsMin

func (d *DTimeTZ) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DTimeTZ) Max

func (d *DTimeTZ) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DTimeTZ) Min

func (d *DTimeTZ) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DTimeTZ) Next

func (d *DTimeTZ) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DTimeTZ) Prev

func (d *DTimeTZ) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DTimeTZ) ResolvedType

func (*DTimeTZ) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DTimeTZ) Round

func (d *DTimeTZ) Round(precision time.Duration) *DTimeTZ

Round returns a new DTimeTZ to the specified precision.

func (*DTimeTZ) Size

func (d *DTimeTZ) Size() uintptr

Size implements the Datum interface.

func (*DTimeTZ) String

func (node *DTimeTZ) String() string

func (*DTimeTZ) TypeCheck

func (d *DTimeTZ) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DTimeTZ) Walk

func (expr *DTimeTZ) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DTimestamp

type DTimestamp struct {
	// DTimestamp represents a timezoneless date and time value. It is stored in
	// the time.Time as if it had UTC location, regardless of what timezone it
	// actually represents (which is unknown within the database). See comment
	// above ParseTimestampWithoutTimezone for some examples.
	time.Time
}

DTimestamp is the timestamp Datum.

func AsDTimestamp

func AsDTimestamp(e Expr) (DTimestamp, bool)

AsDTimestamp attempts to retrieve a DTimestamp from an Expr, returning a DTimestamp and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DTimestamp wrapped by a *DOidWrapper is possible.

func MakeDTimestamp

func MakeDTimestamp(t time.Time, precision time.Duration) (*DTimestamp, error)

MakeDTimestamp creates a DTimestamp with specified precision.

func MustBeDTimestamp

func MustBeDTimestamp(e Expr) DTimestamp

MustBeDTimestamp attempts to retrieve a DTimestamp from an Expr, panicking if the assertion fails.

func MustMakeDTimestamp

func MustMakeDTimestamp(t time.Time, precision time.Duration) *DTimestamp

MustMakeDTimestamp wraps MakeDTimestamp but panics if there is an error. This is intended for testing applications only.

func ParseDTimestamp

func ParseDTimestamp(
	ctx ParseContext, s string, precision time.Duration,
) (_ *DTimestamp, dependsOnContext bool, _ error)

ParseDTimestamp parses and returns the *DTimestamp Datum value represented by the provided string in UTC, or an error if parsing is unsuccessful.

The dependsOnContext return value indicates if we had to consult the ParseContext (either for the time or the local timezone).

Parts of this function are inlined into ParseAndRequireStringHandler, if this changes materially the timestamp case arms there may need to change too.

func (*DTimestamp) AddTimeZone

func (d *DTimestamp) AddTimeZone(
	loc *time.Location, precision time.Duration,
) (*DTimestampTZ, error)

AddTimeZone uses the supplied location to convert this Timestamp to a timestamp with a timezone. It is the inverse of EvalAtAndRemoveTimeZone.

func (*DTimestamp) AmbiguousFormat

func (*DTimestamp) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DTimestamp) Compare

func (d *DTimestamp) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DTimestamp) CompareError

func (d *DTimestamp) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DTimestamp) Eval

func (node *DTimestamp) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DTimestamp) Format

func (d *DTimestamp) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DTimestamp) IsMax

func (d *DTimestamp) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DTimestamp) IsMin

func (d *DTimestamp) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DTimestamp) Max

func (d *DTimestamp) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DTimestamp) Min

func (d *DTimestamp) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DTimestamp) Next

func (d *DTimestamp) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DTimestamp) Prev

func (d *DTimestamp) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DTimestamp) ResolvedType

func (*DTimestamp) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DTimestamp) Round

func (d *DTimestamp) Round(precision time.Duration) (*DTimestamp, error)

Round returns a new DTimestamp to the specified precision.

func (*DTimestamp) Size

func (d *DTimestamp) Size() uintptr

Size implements the Datum interface.

func (*DTimestamp) String

func (node *DTimestamp) String() string

func (*DTimestamp) TypeCheck

func (d *DTimestamp) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DTimestamp) Walk

func (expr *DTimestamp) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DTimestampTZ

type DTimestampTZ struct {
	// Just like time.Time, DTimestampTZ represents an instant in global time that
	// is stored internally in UTC and converted to local time when rendering.
	//
	// Functions that render the TimestampTZ typically take the session time zone
	// as an argument and ignore the Time's set location, but we do sometimes set
	// the Time's location (e.g. when it comes from ParseDTimestampTZ).
	time.Time
}

DTimestampTZ is the timestamp Datum that is rendered with session offset.

func AsDTimestampTZ

func AsDTimestampTZ(e Expr) (DTimestampTZ, bool)

AsDTimestampTZ attempts to retrieve a DTimestampTZ from an Expr, returning a DTimestampTZ and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DTimestamp wrapped by a *DOidWrapper is possible.

func MakeDTimestampTZ

func MakeDTimestampTZ(t time.Time, precision time.Duration) (_ *DTimestampTZ, err error)

MakeDTimestampTZ creates a DTimestampTZ with specified precision.

func MakeDTimestampTZFromDate

func MakeDTimestampTZFromDate(loc *time.Location, d *DDate) (*DTimestampTZ, error)

MakeDTimestampTZFromDate creates a DTimestampTZ from a DDate. This will be equivalent to the midnight of the given zone.

func MustBeDTimestampTZ

func MustBeDTimestampTZ(e Expr) DTimestampTZ

MustBeDTimestampTZ attempts to retrieve a DTimestampTZ from an Expr, panicking if the assertion fails.

func MustMakeDTimestampTZ

func MustMakeDTimestampTZ(t time.Time, precision time.Duration) *DTimestampTZ

MustMakeDTimestampTZ wraps MakeDTimestampTZ but panics if there is an error. This is intended for testing applications only.

func ParseDTimestampTZ

func ParseDTimestampTZ(
	ctx ParseContext, s string, precision time.Duration,
) (_ *DTimestampTZ, dependsOnContext bool, _ error)

ParseDTimestampTZ parses and returns the *DTimestampTZ Datum value represented by the provided string in the provided location, or an error if parsing is unsuccessful.

The dependsOnContext return value indicates if we had to consult the ParseContext (either for the time or the local timezone).

Parts of this function are inlined into ParseAndRequireStringHandler, if this changes materially the timestamp case arms there may need to change too.

func (*DTimestampTZ) AmbiguousFormat

func (*DTimestampTZ) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DTimestampTZ) Compare

func (d *DTimestampTZ) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DTimestampTZ) CompareError

func (d *DTimestampTZ) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DTimestampTZ) Eval

func (node *DTimestampTZ) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DTimestampTZ) EvalAtAndRemoveTimeZone

func (d *DTimestampTZ) EvalAtAndRemoveTimeZone(
	loc *time.Location, precision time.Duration,
) (*DTimestamp, error)

EvalAtAndRemoveTimeZone evaluates this TimestampTZ as if it were in the supplied location, and then removes the timezone, returning a timestamp without a timezone. This is identical to pgdate.stripTimezone but uses the provided location instead of the DTimestampTZ's location. It is the inverse of AddTimeZone.

func (*DTimestampTZ) Format

func (d *DTimestampTZ) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DTimestampTZ) IsMax

func (d *DTimestampTZ) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DTimestampTZ) IsMin

func (d *DTimestampTZ) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DTimestampTZ) Max

func (d *DTimestampTZ) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DTimestampTZ) Min

func (d *DTimestampTZ) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DTimestampTZ) Next

func (d *DTimestampTZ) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DTimestampTZ) Prev

func (d *DTimestampTZ) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DTimestampTZ) ResolvedType

func (*DTimestampTZ) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DTimestampTZ) Round

func (d *DTimestampTZ) Round(precision time.Duration) (*DTimestampTZ, error)

Round returns a new DTimestampTZ to the specified precision.

func (*DTimestampTZ) Size

func (d *DTimestampTZ) Size() uintptr

Size implements the Datum interface.

func (*DTimestampTZ) String

func (node *DTimestampTZ) String() string

func (*DTimestampTZ) TypeCheck

func (d *DTimestampTZ) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DTimestampTZ) Walk

func (expr *DTimestampTZ) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DTuple

type DTuple struct {
	D Datums
	// contains filtered or unexported fields
}

DTuple is the tuple Datum.

func AsDTuple

func AsDTuple(e Expr) (*DTuple, bool)

AsDTuple attempts to retrieve a *DTuple from an Expr, returning a *DTuple and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DTuple wrapped by a *DOidWrapper is possible.

func MakeDTuple

func MakeDTuple(typ *types.T, d ...Datum) DTuple

MakeDTuple creates a DTuple with the provided datums. See NewDTuple.

func MustBeDTuple

func MustBeDTuple(e Expr) *DTuple

MustBeDTuple attempts to retrieve a *DTuple from an Expr, panicking if the assertion fails.

func NewDTuple

func NewDTuple(typ *types.T, d ...Datum) *DTuple

NewDTuple creates a *DTuple with the provided datums. When creating a new DTuple with Datums that are known to be sorted in ascending order, chain this call with DTuple.SetSorted.

func NewDTupleWithLen

func NewDTupleWithLen(typ *types.T, l int) *DTuple

NewDTupleWithLen creates a *DTuple with the provided length.

func ParseDTupleFromString

func ParseDTupleFromString(
	ctx ParseContext, s string, t *types.T,
) (_ *DTuple, dependsOnContext bool, _ error)

ParseDTupleFromString parses the string-form of constructing tuples, handling cases such as `'(1,2,3)'::record`. The input type t is the type of the tuple to parse.

The dependsOnContext return value indicates if we had to consult the ParseContext (either for the time or the local timezone).

func (*DTuple) AmbiguousFormat

func (*DTuple) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DTuple) AssertSorted

func (d *DTuple) AssertSorted()

AssertSorted asserts that the DTuple is sorted.

func (*DTuple) Compare

func (d *DTuple) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DTuple) CompareError

func (d *DTuple) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DTuple) ContainsNull

func (d *DTuple) ContainsNull() bool

ContainsNull returns true if the tuple contains NULL, possibly nested inside other tuples. For example, all the following tuples contain NULL:

(1, 2, NULL)
((1, 1), (2, NULL))
(((1, 1), (2, 2)), ((3, 3), (4, NULL)))

func (*DTuple) Eval

func (node *DTuple) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DTuple) Format

func (d *DTuple) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DTuple) IsMax

func (d *DTuple) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DTuple) IsMin

func (d *DTuple) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DTuple) Max

func (d *DTuple) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DTuple) Min

func (d *DTuple) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DTuple) Next

func (d *DTuple) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DTuple) Normalize

func (d *DTuple) Normalize(ctx CompareContext)

Normalize sorts and uniques the datum tuple.

func (*DTuple) Prev

func (d *DTuple) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DTuple) ResolvedType

func (d *DTuple) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DTuple) SearchSorted

func (d *DTuple) SearchSorted(ctx CompareContext, target Datum) (int, bool)

SearchSorted searches the tuple for the target Datum, returning an int with the same contract as sort.Search and a boolean flag signifying whether the datum was found. It assumes that the DTuple is sorted and panics if it is not.

The target Datum cannot be NULL or a DTuple that contains NULLs (we cannot binary search in this case; for example `(1, NULL) IN ((1, 2), ..)` needs to be

func (*DTuple) SetSorted

func (d *DTuple) SetSorted() *DTuple

SetSorted sets the sorted flag on the DTuple. This should be used when a DTuple is known to be sorted based on the datums added to it.

func (*DTuple) Size

func (d *DTuple) Size() uintptr

Size implements the Datum interface.

func (*DTuple) Sorted

func (d *DTuple) Sorted() bool

Sorted returns true if the tuple is known to be sorted (and contains no NULLs).

func (*DTuple) String

func (node *DTuple) String() string

func (*DTuple) TypeCheck

func (d *DTuple) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DTuple) Walk

func (expr *DTuple) Walk(v Visitor) Expr

Walk implements the Expr interface.

type DUuid

type DUuid struct {
	uuid.UUID
}

DUuid is the UUID Datum.

func AsDUuid

func AsDUuid(e Expr) (DUuid, bool)

AsDUuid attempts to retrieve a DUuid from an Expr, returning a DUuid and a flag signifying whether the assertion was successful.

func MustBeDUuid

func MustBeDUuid(e Expr) DUuid

MustBeDUuid attempts to retrieve a DUuid from an Expr, panicking if the assertion fails.

func NewDUuid

func NewDUuid(d DUuid) *DUuid

NewDUuid is a helper routine to create a *DUuid initialized from its argument.

func ParseDUuidFromBytes

func ParseDUuidFromBytes(b []byte) (*DUuid, error)

ParseDUuidFromBytes parses and returns the *DUuid Datum value represented by the provided input bytes, or an error.

func ParseDUuidFromString

func ParseDUuidFromString(s string) (*DUuid, error)

ParseDUuidFromString parses and returns the *DUuid Datum value represented by the provided input string, or an error.

func (*DUuid) AmbiguousFormat

func (*DUuid) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DUuid) Compare

func (d *DUuid) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DUuid) CompareError

func (d *DUuid) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DUuid) Eval

func (node *DUuid) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DUuid) Format

func (d *DUuid) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DUuid) IsMax

func (d *DUuid) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DUuid) IsMin

func (d *DUuid) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DUuid) Max

func (*DUuid) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DUuid) Min

func (*DUuid) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DUuid) Next

func (d *DUuid) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DUuid) Prev

func (d *DUuid) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DUuid) ResolvedType

func (*DUuid) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DUuid) Size

func (d *DUuid) Size() uintptr

Size implements the Datum interface.

func (*DUuid) String

func (node *DUuid) String() string

func (*DUuid) TypeCheck

func (d *DUuid) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DUuid) Walk

func (expr *DUuid) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DVoid

type DVoid struct{}

DVoid represents a void type.

func (*DVoid) AmbiguousFormat

func (*DVoid) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DVoid) Compare

func (d *DVoid) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*DVoid) CompareError

func (d *DVoid) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*DVoid) Eval

func (node *DVoid) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*DVoid) Format

func (d *DVoid) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DVoid) IsMax

func (d *DVoid) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*DVoid) IsMin

func (d *DVoid) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*DVoid) Max

func (d *DVoid) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*DVoid) Min

func (d *DVoid) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*DVoid) Next

func (d *DVoid) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*DVoid) Prev

func (d *DVoid) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*DVoid) ResolvedType

func (*DVoid) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*DVoid) Size

func (d *DVoid) Size() uintptr

Size implements the Datum interface.

func (*DVoid) String

func (node *DVoid) String() string

func (*DVoid) TypeCheck

func (d *DVoid) TypeCheck(_ context.Context, _ *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DVoid) Walk

func (expr *DVoid) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DataPlacement

type DataPlacement uint32

DataPlacement represents the desired data placement strategy for a given database.

const (
	// DataPlacementUnspecified indicates an unspecified placement policy.
	// This will get translated to the default value when persisted.
	DataPlacementUnspecified DataPlacement = iota
	// DataPlacementDefault indicates specified default data placement policy,
	DataPlacementDefault
	// DataPlacementRestricted indicates the database will not use non-voters for
	// REGIONAL BY [TABLE | ROW] tables.
	DataPlacementRestricted
)

func (*DataPlacement) Format

func (node *DataPlacement) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DataPlacement) TelemetryName

func (node *DataPlacement) TelemetryName() string

TelemetryName returns a representation of DataPlacement suitable for telemetry.

type Datum

type Datum interface {
	TypedExpr

	// AmbiguousFormat indicates whether the result of formatting this Datum can
	// be interpreted into more than one type. Used with
	// fmtFlags.disambiguateDatumTypes.
	AmbiguousFormat() bool

	// Compare returns -1 if the receiver is less than other, 0 if receiver is
	// equal to other and +1 if receiver is greater than other.
	// TODO(rafi): Migrate all usages of this to CompareError, then delete this.
	Compare(ctx CompareContext, other Datum) int

	// CompareError is the same as Compare, but it returns an error instead of
	// panicking.
	CompareError(ctx CompareContext, other Datum) (int, error)

	// Prev returns the previous datum and true, if one exists, or nil and false.
	// The previous datum satisfies the following definition: if the receiver is
	// "b" and the returned datum is "a", then for every compatible datum "x", it
	// holds that "x < b" is true if and only if "x <= a" is true.
	//
	// The return value is undefined if IsMin(_ *EvalContext) returns true.
	//
	// TODO(#12022): for DTuple, the contract is actually that "x < b" (SQL order,
	// where NULL < x is unknown for all x) is true only if "x <= a"
	// (.Compare/encoding order, where NULL <= x is true for all x) is true. This
	// is okay for now: the returned datum is used only to construct a span, which
	// uses .Compare/encoding order and is guaranteed to be large enough by this
	// weaker contract. The original filter expression is left in place to catch
	// false positives.
	Prev(ctx CompareContext) (Datum, bool)

	// IsMin returns true if the datum is equal to the minimum value the datum
	// type can hold.
	IsMin(ctx CompareContext) bool

	// Next returns the next datum and true, if one exists, or nil and false
	// otherwise. The next datum satisfies the following definition: if the
	// receiver is "a" and the returned datum is "b", then for every compatible
	// datum "x", it holds that "x > a" is true if and only if "x >= b" is true.
	//
	// The return value is undefined if IsMax(_ *EvalContext) returns true.
	//
	// TODO(#12022): for DTuple, the contract is actually that "x > a" (SQL order,
	// where x > NULL is unknown for all x) is true only if "x >= b"
	// (.Compare/encoding order, where x >= NULL is true for all x) is true. This
	// is okay for now: the returned datum is used only to construct a span, which
	// uses .Compare/encoding order and is guaranteed to be large enough by this
	// weaker contract. The original filter expression is left in place to catch
	// false positives.
	Next(ctx CompareContext) (Datum, bool)

	// IsMax returns true if the datum is equal to the maximum value the datum
	// type can hold.
	IsMax(ctx CompareContext) bool

	// Max returns the upper value and true, if one exists, otherwise
	// nil and false. Used By Prev().
	Max(ctx CompareContext) (Datum, bool)

	// Min returns the lower value, if one exists, otherwise nil and
	// false. Used by Next().
	Min(ctx CompareContext) (Datum, bool)

	// Size returns a lower bound on the total size of the receiver in bytes,
	// including memory that is pointed at (even if shared between Datum
	// instances) but excluding allocation overhead.
	//
	// It holds for every Datum d that d.Size().
	Size() uintptr
}

Datum represents a SQL value.

func AdjustValueToType

func AdjustValueToType(typ *types.T, inVal Datum) (outVal Datum, err error)

AdjustValueToType checks that the width (for strings, byte arrays, and bit strings) and scale (decimal). and, shape/srid (for geospatial types) fits the specified column type.

Additionally, some precision truncation may occur for the specified column type.

In case of decimals, it can truncate fractional digits in the input value in order to fit the target column. If the input value fits the target column, it is returned unchanged. If the input value can be truncated to fit, then a truncated copy is returned. Otherwise, an error is returned.

In the case of time, it can truncate fractional digits of time datums to its relevant rounding for the given type definition.

In the case of geospatial types, it will check whether the SRID and Shape in the datum matches the type definition.

This method is used by casts and parsing. It is important to note that this function will error if the given value is too wide for the given type. For explicit casts and parsing, inVal should be truncated before this function is called so that an error is not returned. For assignment casts, inVal should not be truncated before this function is called, so that an error is returned. The one exception for assignment casts is for the special "char" type. An assignment cast to "char" does not error and truncates a value if the width of the value is wider than a single character. For this exception, AdjustValueToType performs the truncation itself.

func AppendToMaybeNullArray

func AppendToMaybeNullArray(typ *types.T, left Datum, right Datum) (Datum, error)

AppendToMaybeNullArray appends an element to an array. If the first argument is NULL, an array of one element is created.

func ConcatArrays

func ConcatArrays(typ *types.T, left Datum, right Datum) (Datum, error)

ConcatArrays concatenates two arrays.

func DatumNext

func DatumNext(
	datum Datum, cmpCtx CompareContext, collationEnv *CollationEnvironment,
) (Datum, bool)

DatumNext returns a datum that is "next" to the given one. For many types it just delegates to Datum.Next, but for some types that don't have an implementation of that function this method makes the best effort to come up with a reasonable next datum that is greater than the given one.

The return value is undefined if Datum.IsMax returns true or if the value is NaN or an infinity (for floats and decimals).

func DatumPrev

func DatumPrev(
	datum Datum, cmpCtx CompareContext, collationEnv *CollationEnvironment,
) (Datum, bool)

DatumPrev returns a datum that is "previous" to the given one. For many types it just delegates to Datum.Prev, but for some types that don't have an implementation of that function this method makes the best effort to come up with a reasonable previous datum that is smaller than the given one.

The return value is undefined if Datum.IsMin returns true or if the value is NaN or an infinity (for floats and decimals).

func MakeAllDEnumsInType

func MakeAllDEnumsInType(typ *types.T) []Datum

MakeAllDEnumsInType generates a slice of all values in an enum.

func MakeDJSON

func MakeDJSON(d interface{}) (Datum, error)

MakeDJSON returns a JSON value given a Go-style representation of JSON. * JSON null is Go `nil`, * JSON true is Go `true`, * JSON false is Go `false`, * JSON numbers are json.Number | int | int64 | float64, * JSON string is a Go string, * JSON array is a Go []interface{}, * JSON object is a Go map[string]interface{}.

func NewDIntVectorFromDArray

func NewDIntVectorFromDArray(d *DArray) Datum

NewDIntVectorFromDArray is a helper routine to create a new *DArray, initialized from an existing *DArray, with the special oid for IntVector.

func NewDName

func NewDName(d string) Datum

NewDName is a helper routine to create a *DName (implemented as a *DOidWrapper) initialized from a string.

func NewDNameFromDString

func NewDNameFromDString(d *DString) Datum

NewDNameFromDString is a helper routine to create a *DName (implemented as a *DOidWrapper) initialized from an existing *DString.

func NewDOidVectorFromDArray

func NewDOidVectorFromDArray(d *DArray) Datum

NewDOidVectorFromDArray is a helper routine to create a new *DArray, initialized from an existing *DArray, with the special oid for OidVector.

func NewDRefCursor

func NewDRefCursor(d string) Datum

NewDRefCursor is a helper routine to create a *DRefCursor (implemented as a *DOidWrapper) initialized from a string.

func NewDRefCursorFromDString

func NewDRefCursorFromDString(d *DString) Datum

NewDRefCursorFromDString is a helper routine to create a *DRefCursor (implemented as a *DOidWrapper) initialized from an existing *DString.

func NewDefaultDatum

func NewDefaultDatum(collationEnv *CollationEnvironment, t *types.T) (d Datum, err error)

NewDefaultDatum returns a default non-NULL datum value for the given type. This is used when updating non-NULL columns that are being added or dropped from a table, and there is no user-defined DEFAULT value available.

func ParseAndRequireString

func ParseAndRequireString(
	t *types.T, s string, ctx ParseContext,
) (d Datum, dependsOnContext bool, err error)

ParseAndRequireString parses s as type t for simple types.

The dependsOnContext return value indicates if we had to consult the ParseContext (either for the time or the local timezone).

func ParseDJSON

func ParseDJSON(s string) (Datum, error)

ParseDJSON takes a string of JSON and returns a DJSON value.

func ParseDTSQuery

func ParseDTSQuery(s string) (Datum, error)

ParseDTSQuery takes a string of TSQuery and returns a DTSQuery value.

func ParseDTSVector

func ParseDTSVector(s string) (Datum, error)

ParseDTSVector takes a string of TSVector and returns a DTSVector value.

func PrependToMaybeNullArray

func PrependToMaybeNullArray(typ *types.T, left Datum, right Datum) (Datum, error)

PrependToMaybeNullArray prepends an element in the front of an arrray. If the argument is NULL, an array of one element is created.

func SampleDatum

func SampleDatum(t *types.T) Datum

SampleDatum is intended to be a more lightweight version of RandDatum for when you just need one consistent example of a datum.

func UnwrapDOidWrapper

func UnwrapDOidWrapper(d Datum) Datum

UnwrapDOidWrapper exposes the wrapped datum from a *DOidWrapper.

func WrapAsZeroOid

func WrapAsZeroOid(t *types.T) Datum

WrapAsZeroOid wraps ZeroOidValue with a custom Oid.

type DatumAlloc

type DatumAlloc struct {

	// AllocSize determines the number of objects allocated whenever we've used
	// up previously allocated ones. This field is exported so that the caller
	// could adjust it dynamically. If it is left unchanged by the caller, then
	// it will be set to defaultDatumAllocSize automatically.
	AllocSize int
	// contains filtered or unexported fields
}

DatumAlloc provides batch allocation of datum pointers, amortizing the cost of the allocations. NOTE: it *must* be passed in by a pointer.

func (*DatumAlloc) DoneInitNewDGeo

func (a *DatumAlloc) DoneInitNewDGeo(so *geopb.SpatialObject)

DoneInitNewDGeo is called after unmarshalling a SpatialObject allocated via NewDGeographyEmpty/NewDGeometryEmpty, to return space to the DatumAlloc.

func (*DatumAlloc) NewDBitArray

func (a *DatumAlloc) NewDBitArray(v DBitArray) *DBitArray

NewDBitArray allocates a DBitArray.

func (*DatumAlloc) NewDBox2D

func (a *DatumAlloc) NewDBox2D(v DBox2D) *DBox2D

NewDBox2D allocates a DBox2D.

func (*DatumAlloc) NewDBytes

func (a *DatumAlloc) NewDBytes(v DBytes) *DBytes

NewDBytes allocates a DBytes.

func (*DatumAlloc) NewDCollatedString

func (a *DatumAlloc) NewDCollatedString(contents string, locale string) (*DCollatedString, error)

NewDCollatedString allocates a DCollatedString.

func (*DatumAlloc) NewDDate

func (a *DatumAlloc) NewDDate(v DDate) *DDate

NewDDate allocates a DDate.

func (*DatumAlloc) NewDDecimal

func (a *DatumAlloc) NewDDecimal(v DDecimal) *DDecimal

NewDDecimal allocates a DDecimal.

func (*DatumAlloc) NewDEncodedKey

func (a *DatumAlloc) NewDEncodedKey(v DEncodedKey) *DEncodedKey

NewDEncodedKey allocates a DEncodedKey.

func (*DatumAlloc) NewDEnum

func (a *DatumAlloc) NewDEnum(v DEnum) *DEnum

NewDEnum allocates a DEnum.

func (*DatumAlloc) NewDFloat

func (a *DatumAlloc) NewDFloat(v DFloat) *DFloat

NewDFloat allocates a DFloat.

func (*DatumAlloc) NewDGeography

func (a *DatumAlloc) NewDGeography(v DGeography) *DGeography

NewDGeography allocates a DGeography.

func (*DatumAlloc) NewDGeographyEmpty

func (a *DatumAlloc) NewDGeographyEmpty() *DGeography

NewDGeographyEmpty allocates a new empty DGeography for unmarshalling. After unmarshalling, DoneInitNewDGeo must be called to return unused pre-allocated space to the DatumAlloc.

func (*DatumAlloc) NewDGeometry

func (a *DatumAlloc) NewDGeometry(v DGeometry) *DGeometry

NewDGeometry allocates a DGeometry.

func (*DatumAlloc) NewDGeometryEmpty

func (a *DatumAlloc) NewDGeometryEmpty() *DGeometry

NewDGeometryEmpty allocates a new empty DGeometry for unmarshalling. After unmarshalling, DoneInitNewDGeo must be called to return unused pre-allocated space to the DatumAlloc.

func (*DatumAlloc) NewDIPAddr

func (a *DatumAlloc) NewDIPAddr(v DIPAddr) *DIPAddr

NewDIPAddr allocates a DIPAddr.

func (*DatumAlloc) NewDInt

func (a *DatumAlloc) NewDInt(v DInt) *DInt

NewDInt allocates a DInt.

func (*DatumAlloc) NewDInterval

func (a *DatumAlloc) NewDInterval(v DInterval) *DInterval

NewDInterval allocates a DInterval.

func (*DatumAlloc) NewDJSON

func (a *DatumAlloc) NewDJSON(v DJSON) *DJSON

NewDJSON allocates a DJSON.

func (*DatumAlloc) NewDName

func (a *DatumAlloc) NewDName(v DString) Datum

NewDName allocates a DName.

func (*DatumAlloc) NewDOid

func (a *DatumAlloc) NewDOid(v DOid) Datum

NewDOid allocates a DOid.

func (*DatumAlloc) NewDPGLSN

func (a *DatumAlloc) NewDPGLSN(v DPGLSN) *DPGLSN

NewDPGLSN allocates a DPGLSN.

func (*DatumAlloc) NewDRefCursor

func (a *DatumAlloc) NewDRefCursor(v DString) Datum

NewDRefCursor allocates a DRefCursor.

func (*DatumAlloc) NewDString

func (a *DatumAlloc) NewDString(v DString) *DString

NewDString allocates a DString.

func (*DatumAlloc) NewDTime

func (a *DatumAlloc) NewDTime(v DTime) *DTime

NewDTime allocates a DTime.

func (*DatumAlloc) NewDTimeTZ

func (a *DatumAlloc) NewDTimeTZ(v DTimeTZ) *DTimeTZ

NewDTimeTZ allocates a DTimeTZ.

func (*DatumAlloc) NewDTimestamp

func (a *DatumAlloc) NewDTimestamp(v DTimestamp) *DTimestamp

NewDTimestamp allocates a DTimestamp.

func (*DatumAlloc) NewDTimestampTZ

func (a *DatumAlloc) NewDTimestampTZ(v DTimestampTZ) *DTimestampTZ

NewDTimestampTZ allocates a DTimestampTZ.

func (*DatumAlloc) NewDTuple

func (a *DatumAlloc) NewDTuple(v DTuple) *DTuple

NewDTuple allocates a DTuple.

func (*DatumAlloc) NewDUuid

func (a *DatumAlloc) NewDUuid(v DUuid) *DUuid

NewDUuid allocates a DUuid.

func (*DatumAlloc) NewDVoid

func (a *DatumAlloc) NewDVoid() *DVoid

NewDVoid allocates a new DVoid.

func (*DatumAlloc) NewDatums

func (a *DatumAlloc) NewDatums(num int) Datums

NewDatums allocates Datums of the specified size.

type Datums

type Datums []Datum

Datums is a slice of Datum values.

func (Datums) Compare

func (d Datums) Compare(evalCtx CompareContext, other Datums) int

Compare does a lexicographical comparison and returns -1 if the receiver is less than other, 0 if receiver is equal to other and +1 if receiver is greater than other.

func (*Datums) Format

func (d *Datums) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (Datums) IsDistinctFrom

func (d Datums) IsDistinctFrom(evalCtx CompareContext, other Datums) bool

IsDistinctFrom checks to see if two datums are distinct from each other. Any change in value is considered distinct, however, a NULL value is NOT considered distinct from another NULL value.

func (Datums) Len

func (d Datums) Len() int

Len returns the number of Datum values.

func (*Datums) String

func (node *Datums) String() string

type Deallocate

type Deallocate struct {
	Name Name // empty for ALL
}

Deallocate represents a DEALLOCATE statement.

func (*Deallocate) Format

func (node *Deallocate) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Deallocate) StatementReturnType

func (*Deallocate) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Deallocate) StatementTag

func (n *Deallocate) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Deallocate) StatementType

func (*Deallocate) StatementType() StatementType

StatementType implements the Statement interface.

func (*Deallocate) String

func (n *Deallocate) String() string

type DeclareCursor

type DeclareCursor struct {
	Name        Name
	Select      *Select
	Binary      bool
	Scroll      CursorScrollOption
	Sensitivity CursorSensitivity
	Hold        bool
}

DeclareCursor represents a DECLARE statement.

func (*DeclareCursor) Format

func (node *DeclareCursor) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DeclareCursor) StatementReturnType

func (n *DeclareCursor) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*DeclareCursor) StatementTag

func (*DeclareCursor) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DeclareCursor) StatementType

func (*DeclareCursor) StatementType() StatementType

StatementType implements the Statement interface.

func (*DeclareCursor) String

func (n *DeclareCursor) String() string

type DefaultVal

type DefaultVal struct{}

DefaultVal represents the DEFAULT expression.

func (*DefaultVal) Eval

func (node *DefaultVal) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (DefaultVal) Format

func (node DefaultVal) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (DefaultVal) ResolvedType

func (DefaultVal) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (DefaultVal) String

func (node DefaultVal) String() string

func (DefaultVal) TypeCheck

func (expr DefaultVal) TypeCheck(
	_ context.Context, _ *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (DefaultVal) Walk

func (expr DefaultVal) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DeferrableMode

type DeferrableMode int

DeferrableMode holds the deferrable mode for a transaction.

const (
	UnspecifiedDeferrableMode DeferrableMode = iota
	Deferrable
	NotDeferrable
)

DeferrableMode values.

func (DeferrableMode) String

func (d DeferrableMode) String() string

type Delete

type Delete struct {
	Batch     *Batch
	With      *With
	Table     TableExpr
	Where     *Where
	OrderBy   OrderBy
	Using     TableExprs
	Limit     *Limit
	Returning ReturningClause
}

Delete represents a DELETE statement.

func (*Delete) Format

func (node *Delete) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Delete) StatementReturnType

func (n *Delete) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Delete) StatementTag

func (*Delete) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Delete) StatementType

func (*Delete) StatementType() StatementType

StatementType implements the Statement interface.

func (*Delete) String

func (n *Delete) String() string

type DescriptorCoverage

type DescriptorCoverage int32

DescriptorCoverage specifies the subset of descriptors that are requested during a backup or a restore.

const (
	// RequestedDescriptors table coverage means that the backup is not
	// guaranteed to have all of the cluster data. This can be accomplished by
	// backing up a specific subset of tables/databases. Note that even if all
	// of the tables and databases have been included in the backup manually, a
	// backup is not said to have complete table coverage unless it was created
	// by a `BACKUP TO` command.
	RequestedDescriptors DescriptorCoverage = iota

	// AllDescriptors table coverage means that backup is guaranteed to have all the
	// relevant data in the cluster. These can only be created by running a
	// full cluster backup with `BACKUP TO`.
	AllDescriptors

	// SystemUsers coverage indicates that only the system.users
	// table will be restored from the backup.
	SystemUsers
)

type DesiredObjectKind

type DesiredObjectKind byte

DesiredObjectKind represents what kind of object is desired in a name resolution attempt.

const (

	// TableObject is used when a table-like object is desired from resolution.
	TableObject DesiredObjectKind
	// TypeObject is used when a type-like object is desired from resolution.
	TypeObject
	// AnyObject is used when any object is acceptable. This is primary used when
	// looking for name conflicts.
	AnyObject
)

type Direction

type Direction int8

Direction for ordering results.

const (
	DefaultDirection Direction = iota
	Ascending
	Descending
)

Direction values.

func (Direction) String

func (d Direction) String() string

type Discard

type Discard struct {
	Mode DiscardMode
}

Discard represents a DISCARD statement.

func (*Discard) Format

func (node *Discard) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Discard) StatementReturnType

func (*Discard) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Discard) StatementTag

func (d *Discard) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Discard) StatementType

func (*Discard) StatementType() StatementType

StatementType implements the Statement interface.

func (*Discard) String

func (node *Discard) String() string

String implements the Statement interface.

type DiscardMode

type DiscardMode int

DiscardMode is an enum of the various discard modes.

const (
	// DiscardModeAll represents a DISCARD ALL statement.
	DiscardModeAll DiscardMode = iota

	// DiscardModeSequences represents a DISCARD SEQUENCES statement
	DiscardModeSequences

	// DiscardModeTemp represents a DISCARD TEMPORARY statement
	DiscardModeTemp
)

type DistinctOn

type DistinctOn []Expr

DistinctOn represents a DISTINCT ON clause.

func (*DistinctOn) Format

func (node *DistinctOn) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type DivDecimalIntOp

type DivDecimalIntOp struct{}

DivDecimalIntOp is a BinaryEvalOp.

func (*DivDecimalIntOp) Eval

func (op *DivDecimalIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type DivDecimalOp

type DivDecimalOp struct{}

DivDecimalOp is a BinaryEvalOp.

func (*DivDecimalOp) Eval

func (op *DivDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type DivFloatOp

type DivFloatOp struct{}

DivFloatOp is a BinaryEvalOp.

func (*DivFloatOp) Eval

func (op *DivFloatOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type DivIntDecimalOp

type DivIntDecimalOp struct{}

DivIntDecimalOp is a BinaryEvalOp.

func (*DivIntDecimalOp) Eval

func (op *DivIntDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type DivIntOp

type DivIntOp struct{}

DivIntOp is a BinaryEvalOp.

func (*DivIntOp) Eval

func (op *DivIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type DivIntervalFloatOp

type DivIntervalFloatOp struct{}

DivIntervalFloatOp is a BinaryEvalOp.

func (*DivIntervalFloatOp) Eval

func (op *DivIntervalFloatOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type DivIntervalIntOp

type DivIntervalIntOp struct{}

DivIntervalIntOp is a BinaryEvalOp.

func (*DivIntervalIntOp) Eval

func (op *DivIntervalIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type DropBehavior

type DropBehavior int

DropBehavior represents options for dropping schema elements.

const (
	DropDefault DropBehavior = iota
	DropRestrict
	DropCascade
)

DropBehavior values.

func (DropBehavior) String

func (d DropBehavior) String() string

type DropDatabase

type DropDatabase struct {
	Name         Name
	IfExists     bool
	DropBehavior DropBehavior
}

DropDatabase represents a DROP DATABASE statement.

func (*DropDatabase) Format

func (node *DropDatabase) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DropDatabase) StatementReturnType

func (*DropDatabase) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*DropDatabase) StatementTag

func (*DropDatabase) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DropDatabase) StatementType

func (*DropDatabase) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropDatabase) String

func (n *DropDatabase) String() string

type DropExternalConnection

type DropExternalConnection struct {
	ConnectionLabel Expr
}

DropExternalConnection represents a DROP EXTERNAL CONNECTION statement.

func (*DropExternalConnection) Format

func (node *DropExternalConnection) Format(ctx *FmtCtx)

Format implements the Statement interface.

func (*DropExternalConnection) StatementReturnType

func (*DropExternalConnection) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*DropExternalConnection) StatementTag

func (*DropExternalConnection) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DropExternalConnection) StatementType

func (*DropExternalConnection) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropExternalConnection) String

func (n *DropExternalConnection) String() string

type DropIndex

type DropIndex struct {
	IndexList    TableIndexNames
	IfExists     bool
	DropBehavior DropBehavior
	Concurrently bool
}

DropIndex represents a DROP INDEX statement.

func (*DropIndex) Format

func (node *DropIndex) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DropIndex) StatementReturnType

func (*DropIndex) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*DropIndex) StatementTag

func (*DropIndex) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DropIndex) StatementType

func (*DropIndex) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropIndex) String

func (n *DropIndex) String() string

type DropOwnedBy

type DropOwnedBy struct {
	Roles        RoleSpecList
	DropBehavior DropBehavior
}

DropOwnedBy represents a DROP OWNED BY command.

func (*DropOwnedBy) Format

func (node *DropOwnedBy) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DropOwnedBy) StatementReturnType

func (*DropOwnedBy) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*DropOwnedBy) StatementTag

func (*DropOwnedBy) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DropOwnedBy) StatementType

func (*DropOwnedBy) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropOwnedBy) String

func (n *DropOwnedBy) String() string

type DropRole

type DropRole struct {
	Names    RoleSpecList
	IsRole   bool
	IfExists bool
}

DropRole represents a DROP ROLE statement

func (*DropRole) Format

func (node *DropRole) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DropRole) StatementReturnType

func (*DropRole) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*DropRole) StatementTag

func (*DropRole) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DropRole) StatementType

func (*DropRole) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropRole) String

func (n *DropRole) String() string

type DropRoutine

type DropRoutine struct {
	IfExists     bool
	Procedure    bool
	Routines     RoutineObjs
	DropBehavior DropBehavior
}

DropRoutine represents a DROP FUNCTION or DROP PROCEDURE statement.

func (*DropRoutine) Format

func (node *DropRoutine) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DropRoutine) StatementReturnType

func (*DropRoutine) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*DropRoutine) StatementTag

func (n *DropRoutine) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DropRoutine) StatementType

func (*DropRoutine) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropRoutine) String

func (n *DropRoutine) String() string

type DropSchema

type DropSchema struct {
	Names        ObjectNamePrefixList
	IfExists     bool
	DropBehavior DropBehavior
}

DropSchema represents a DROP SCHEMA command.

func (*DropSchema) Format

func (node *DropSchema) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DropSchema) StatementReturnType

func (*DropSchema) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*DropSchema) StatementTag

func (*DropSchema) StatementTag() string

StatementTag implements the Statement interface.

func (*DropSchema) StatementType

func (*DropSchema) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropSchema) String

func (n *DropSchema) String() string

type DropSequence

type DropSequence struct {
	Names        TableNames
	IfExists     bool
	DropBehavior DropBehavior
}

DropSequence represents a DROP SEQUENCE statement.

func (*DropSequence) Format

func (node *DropSequence) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DropSequence) StatementReturnType

func (*DropSequence) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*DropSequence) StatementTag

func (*DropSequence) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DropSequence) StatementType

func (*DropSequence) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropSequence) String

func (n *DropSequence) String() string

type DropTable

type DropTable struct {
	Names        TableNames
	IfExists     bool
	DropBehavior DropBehavior
}

DropTable represents a DROP TABLE statement.

func (*DropTable) Format

func (node *DropTable) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DropTable) StatementReturnType

func (*DropTable) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*DropTable) StatementTag

func (*DropTable) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DropTable) StatementType

func (*DropTable) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropTable) String

func (n *DropTable) String() string

type DropTenant

type DropTenant struct {
	TenantSpec *TenantSpec
	IfExists   bool
	Immediate  bool
}

DropTenant represents a DROP VIRTUAL CLUSTER command.

func (*DropTenant) Format

func (node *DropTenant) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DropTenant) StatementReturnType

func (*DropTenant) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*DropTenant) StatementTag

func (*DropTenant) StatementTag() string

StatementTag implements the Statement interface.

func (*DropTenant) StatementType

func (*DropTenant) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropTenant) String

func (n *DropTenant) String() string

type DropType

type DropType struct {
	Names        []*UnresolvedObjectName
	IfExists     bool
	DropBehavior DropBehavior
}

DropType represents a DROP TYPE command.

func (*DropType) Format

func (node *DropType) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DropType) StatementReturnType

func (*DropType) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*DropType) StatementTag

func (*DropType) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DropType) StatementType

func (*DropType) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropType) String

func (n *DropType) String() string

type DropView

type DropView struct {
	Names          TableNames
	IfExists       bool
	DropBehavior   DropBehavior
	IsMaterialized bool
}

DropView represents a DROP VIEW statement.

func (*DropView) Format

func (node *DropView) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*DropView) StatementReturnType

func (*DropView) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*DropView) StatementTag

func (*DropView) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DropView) StatementType

func (*DropView) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropView) String

func (n *DropView) String() string

type EnumValue

type EnumValue string

EnumValue represents a single enum value.

func (*EnumValue) Format

func (n *EnumValue) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type EnumValueList

type EnumValueList []EnumValue

EnumValueList represents a list of enum values.

func (*EnumValueList) Format

func (l *EnumValueList) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type Execute

type Execute struct {
	Name   Name
	Params Exprs
	// DiscardRows is set when we want to throw away all the rows rather than
	// returning for client (used for testing and benchmarking).
	DiscardRows bool
}

Execute represents an EXECUTE statement.

func (*Execute) Format

func (node *Execute) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Execute) StatementReturnType

func (*Execute) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Execute) StatementTag

func (*Execute) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Execute) StatementType

func (*Execute) StatementType() StatementType

StatementType implements the Statement interface.

func (*Execute) String

func (n *Execute) String() string

type Explain

type Explain struct {
	ExplainOptions

	// Statement is the statement being EXPLAINed.
	Statement Statement
}

Explain represents an EXPLAIN statement.

func (*Explain) Format

func (node *Explain) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Explain) StatementReturnType

func (*Explain) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Explain) StatementTag

func (*Explain) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Explain) StatementType

func (*Explain) StatementType() StatementType

StatementType implements the Statement interface.

func (*Explain) String

func (n *Explain) String() string

type ExplainAnalyze

type ExplainAnalyze struct {
	ExplainOptions

	// Statement is the statement being EXPLAINed.
	Statement Statement
}

ExplainAnalyze represents an EXPLAIN ANALYZE statement.

func (*ExplainAnalyze) Format

func (node *ExplainAnalyze) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ExplainAnalyze) StatementReturnType

func (*ExplainAnalyze) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ExplainAnalyze) StatementTag

func (*ExplainAnalyze) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ExplainAnalyze) StatementType

func (*ExplainAnalyze) StatementType() StatementType

StatementType implements the Statement interface.

func (*ExplainAnalyze) String

func (n *ExplainAnalyze) String() string

type ExplainFlag

type ExplainFlag uint8

ExplainFlag is a modifier in an EXPLAIN statement (like VERBOSE).

const (
	ExplainFlagVerbose ExplainFlag = 1 + iota
	ExplainFlagTypes
	ExplainFlagEnv
	ExplainFlagCatalog
	ExplainFlagJSON
	ExplainFlagMemo
	ExplainFlagShape
	ExplainFlagViz
	ExplainFlagRedact
)

Explain flags.

func (ExplainFlag) String

func (f ExplainFlag) String() string

type ExplainMode

type ExplainMode uint8

ExplainMode indicates the mode of the explain. The default is ExplainPlan.

const (
	// ExplainPlan shows information about the planNode tree for a query.
	ExplainPlan ExplainMode = 1 + iota

	// ExplainDistSQL shows the physical distsql plan for a query and whether a
	// query would be run in "auto" DISTSQL mode. See sql/explain_distsql.go for
	// details. If the ANALYZE option is included, the plan is also executed and
	// execution statistics are collected and shown in the diagram.
	ExplainDistSQL

	// ExplainOpt shows the optimized relational expression (from the cost-based
	// optimizer).
	ExplainOpt

	// ExplainVec shows the physical vectorized plan for a query and whether a
	// query would be run in "auto" vectorized mode.
	ExplainVec

	// ExplainDebug generates a statement diagnostics bundle; only used with
	// EXPLAIN ANALYZE.
	ExplainDebug

	// ExplainDDL generates a DDL plan diagram for the statement.
	ExplainDDL

	// ExplainGist generates a plan "gist".
	ExplainGist
)

func (ExplainMode) String

func (m ExplainMode) String() string

type ExplainOptions

type ExplainOptions struct {
	Mode  ExplainMode
	Flags [numExplainFlags + 1]bool
}

ExplainOptions contains information about the options passed to an EXPLAIN statement.

type Export

type Export struct {
	Query      *Select
	FileFormat string
	File       Expr
	Options    KVOptions
}

Export represents a EXPORT statement.

func (*Export) Format

func (node *Export) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Export) StatementReturnType

func (*Export) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Export) StatementTag

func (*Export) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Export) StatementType

func (*Export) StatementType() StatementType

StatementType implements the Statement interface.

func (*Export) String

func (n *Export) String() string

type Expr

type Expr interface {
	fmt.Stringer
	NodeFormatter
	// Walk recursively walks all children using WalkExpr. If any children are changed, it returns a
	// copy of this node updated to point to the new children. Otherwise the receiver is returned.
	// For childless (leaf) Exprs, its implementation is empty.
	Walk(Visitor) Expr
	// TypeCheck transforms the Expr into a well-typed TypedExpr, which further permits
	// evaluation and type introspection, or an error if the expression cannot be well-typed.
	// When type checking is complete, if no error was reported, the expression and all
	// sub-expressions will be guaranteed to be well-typed, meaning that the method effectively
	// maps the Expr tree into a TypedExpr tree.
	//
	// The semaCtx parameter defines the context in which to perform type checking.
	// The desired parameter hints the desired type that the method's caller wants from
	// the resulting TypedExpr. It is not valid to call TypeCheck with a nil desired
	// type. Instead, call it with wildcard type types.Any if no specific type is
	// desired. This restriction is also true of most methods and functions related
	// to type checking.
	TypeCheck(ctx context.Context, semaCtx *SemaContext, desired *types.T) (TypedExpr, error)
}

Expr represents an expression.

func SimpleVisit

func SimpleVisit(expr Expr, preFn SimpleVisitFn) (Expr, error)

SimpleVisit is a convenience wrapper for visitors that only have VisitPre code and don't return any results except an error. The given function is called in VisitPre for every node. The visitor stops as soon as an error is returned.

func StripMemoizedFuncs

func StripMemoizedFuncs(expr Expr) Expr

StripMemoizedFuncs strips memoized function references from expression trees. This is necessary to permit equality checks using reflect.DeepEqual. Used in testing.

func StripParens

func StripParens(expr Expr) Expr

StripParens strips any parentheses surrounding an expression and returns the inner expression. For instance:

 1   -> 1
(1)  -> 1

((1)) -> 1

func WalkExpr

func WalkExpr(v Visitor, expr Expr) (newExpr Expr, changed bool)

WalkExpr traverses the nodes in an expression.

NOTE: Do not count on the walkStmt/WalkExpr machinery to visit all expressions contained in a query. Only a sub-set of all expressions are found by walkStmt and subsequently traversed. See the comment below on walkStmt for details.

type ExprContainer

type ExprContainer interface {
	// NumRows returns number of rows.
	NumRows() int
	// NumCols returns number of columns.
	NumCols() int
	// Get returns the Expr at row i column j.
	Get(i, j int) Expr
}

ExprContainer represents an abstract container of Exprs

type ExprEvaluator

type ExprEvaluator interface {
	EvalAllColumnsSelector(context.Context, *AllColumnsSelector) (Datum, error)
	EvalAndExpr(context.Context, *AndExpr) (Datum, error)
	EvalArray(context.Context, *Array) (Datum, error)
	EvalArrayFlatten(context.Context, *ArrayFlatten) (Datum, error)
	EvalBinaryExpr(context.Context, *BinaryExpr) (Datum, error)
	EvalCaseExpr(context.Context, *CaseExpr) (Datum, error)
	EvalCastExpr(context.Context, *CastExpr) (Datum, error)
	EvalCoalesceExpr(context.Context, *CoalesceExpr) (Datum, error)
	EvalCollateExpr(context.Context, *CollateExpr) (Datum, error)
	EvalColumnAccessExpr(context.Context, *ColumnAccessExpr) (Datum, error)
	EvalColumnItem(context.Context, *ColumnItem) (Datum, error)
	EvalComparisonExpr(context.Context, *ComparisonExpr) (Datum, error)
	EvalDefaultVal(context.Context, *DefaultVal) (Datum, error)
	EvalFuncExpr(context.Context, *FuncExpr) (Datum, error)
	EvalIfErrExpr(context.Context, *IfErrExpr) (Datum, error)
	EvalIfExpr(context.Context, *IfExpr) (Datum, error)
	EvalIndexedVar(context.Context, *IndexedVar) (Datum, error)
	EvalIndirectionExpr(context.Context, *IndirectionExpr) (Datum, error)
	EvalIsNotNullExpr(context.Context, *IsNotNullExpr) (Datum, error)
	EvalIsNullExpr(context.Context, *IsNullExpr) (Datum, error)
	EvalIsOfTypeExpr(context.Context, *IsOfTypeExpr) (Datum, error)
	EvalNotExpr(context.Context, *NotExpr) (Datum, error)
	EvalNullIfExpr(context.Context, *NullIfExpr) (Datum, error)
	EvalOrExpr(context.Context, *OrExpr) (Datum, error)
	EvalParenExpr(context.Context, *ParenExpr) (Datum, error)
	EvalPlaceholder(context.Context, *Placeholder) (Datum, error)
	EvalRangeCond(context.Context, *RangeCond) (Datum, error)
	EvalRoutineExpr(context.Context, *RoutineExpr) (Datum, error)
	EvalSubquery(context.Context, *Subquery) (Datum, error)
	EvalTuple(context.Context, *Tuple) (Datum, error)
	EvalTupleStar(context.Context, *TupleStar) (Datum, error)
	EvalTypedDummy(context.Context, *TypedDummy) (Datum, error)
	EvalUnaryExpr(context.Context, *UnaryExpr) (Datum, error)
	EvalUnqualifiedStar(context.Context, UnqualifiedStar) (Datum, error)
	EvalUnresolvedName(context.Context, *UnresolvedName) (Datum, error)
}

ExprEvaluator is used to evaluate TypedExpr expressions.

type Exprs

type Exprs []Expr

Exprs represents a list of value expressions. It's not a valid expression because it's not parenthesized.

func (*Exprs) Format

func (node *Exprs) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Exprs) String

func (node *Exprs) String() string

type FamilyID

type FamilyID = catid.FamilyID

FamilyID is a custom type for column family ID.

type FamilyTableDef

type FamilyTableDef struct {
	Name    Name
	Columns NameList
}

FamilyTableDef represents a family definition within a CREATE TABLE statement.

func (*FamilyTableDef) Format

func (node *FamilyTableDef) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type FetchCursor

type FetchCursor struct {
	CursorStmt
}

FetchCursor represents a FETCH statement.

func (FetchCursor) Format

func (f FetchCursor) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*FetchCursor) StatementReturnType

func (n *FetchCursor) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*FetchCursor) StatementTag

func (*FetchCursor) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*FetchCursor) StatementType

func (*FetchCursor) StatementType() StatementType

StatementType implements the Statement interface.

func (*FetchCursor) String

func (n *FetchCursor) String() string

type FetchType

type FetchType int

FetchType represents the type of a FETCH (or MOVE) statement.

const (
	// FetchNormal represents a FETCH statement that doesn't have a special
	// qualifier. It's used for FORWARD, BACKWARD, NEXT, and PRIOR.
	FetchNormal FetchType = iota
	// FetchRelative represents a FETCH RELATIVE statement.
	FetchRelative
	// FetchAbsolute represents a FETCH ABSOLUTE statement.
	FetchAbsolute
	// FetchFirst represents a FETCH FIRST statement.
	FetchFirst
	// FetchLast represents a FETCH LAST statement.
	FetchLast
	// FetchAll represents a FETCH ALL statement.
	FetchAll
	// FetchBackwardAll represents a FETCH BACKWARD ALL statement.
	FetchBackwardAll
)

func (FetchType) HasCount

func (o FetchType) HasCount() bool

HasCount returns true if the given fetch type should be printed with an associated count.

func (FetchType) String

func (o FetchType) String() string

type FloorDivDecimalIntOp

type FloorDivDecimalIntOp struct{}

FloorDivDecimalIntOp is a BinaryEvalOp.

func (*FloorDivDecimalIntOp) Eval

func (op *FloorDivDecimalIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type FloorDivDecimalOp

type FloorDivDecimalOp struct{}

FloorDivDecimalOp is a BinaryEvalOp.

func (*FloorDivDecimalOp) Eval

func (op *FloorDivDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type FloorDivFloatOp

type FloorDivFloatOp struct{}

FloorDivFloatOp is a BinaryEvalOp.

func (*FloorDivFloatOp) Eval

func (op *FloorDivFloatOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type FloorDivIntDecimalOp

type FloorDivIntDecimalOp struct{}

FloorDivIntDecimalOp is a BinaryEvalOp.

func (*FloorDivIntDecimalOp) Eval

func (op *FloorDivIntDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type FloorDivIntOp

type FloorDivIntOp struct{}

FloorDivIntOp is a BinaryEvalOp.

func (*FloorDivIntOp) Eval

func (op *FloorDivIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type FmtCtx

type FmtCtx struct {
	bytes.Buffer
	// contains filtered or unexported fields
}

FmtCtx is suitable for passing to Format() methods. It also exposes the underlying bytes.Buffer interface for convenience.

FmtCtx cannot be copied by value.

func NewFmtCtx

func NewFmtCtx(f FmtFlags, opts ...FmtCtxOption) *FmtCtx

NewFmtCtx creates a FmtCtx; only flags that don't require Annotations can be used.

func (*FmtCtx) Close

func (ctx *FmtCtx) Close()

Close releases a FmtCtx for reuse. Closing a FmtCtx is not required, but is recommended for performance-sensitive paths.

func (*FmtCtx) CloseAndGetString

func (ctx *FmtCtx) CloseAndGetString() string

CloseAndGetString combines Close() and String().

func (*FmtCtx) FormatName

func (ctx *FmtCtx) FormatName(s string)

FormatName formats a string as a name.

Note: prefer FormatNameP below when the string is already on the heap.

func (*FmtCtx) FormatNameP

func (ctx *FmtCtx) FormatNameP(s *string)

FormatNameP formats a string reference as a name.

func (*FmtCtx) FormatNode

func (ctx *FmtCtx) FormatNode(n NodeFormatter)

FormatNode recurses into a node for pretty-printing. Flag-driven special cases can hook into this.

func (*FmtCtx) FormatNodeSummary

func (ctx *FmtCtx) FormatNodeSummary(n NodeFormatter)

FormatNodeSummary recurses into a node for pretty-printing a summarized version.

func (*FmtCtx) FormatTypeReference

func (ctx *FmtCtx) FormatTypeReference(ref ResolvableTypeReference)

FormatTypeReference formats a ResolvableTypeReference.

func (*FmtCtx) HasFlags

func (ctx *FmtCtx) HasFlags(f FmtFlags) bool

HasFlags returns true iff the given flags are set in the formatter context.

func (*FmtCtx) Printf

func (ctx *FmtCtx) Printf(f string, args ...interface{})

Printf calls fmt.Fprintf on the linked bytes.Buffer. It is provided for convenience, to avoid having to call fmt.Fprintf(&ctx.Buffer, ...).

Note: DO NOT USE THIS TO INTERPOLATE %s ON NodeFormatter OBJECTS. This would call the String() method on them and would fail to reuse the same bytes buffer (and waste allocations). Instead use ctx.FormatNode().

func (*FmtCtx) SetDataConversionConfig

func (ctx *FmtCtx) SetDataConversionConfig(
	dcc sessiondatapb.DataConversionConfig,
) sessiondatapb.DataConversionConfig

SetDataConversionConfig sets the DataConversionConfig on ctx and returns the old one.

func (*FmtCtx) SetLocation

func (ctx *FmtCtx) SetLocation(loc *time.Location) *time.Location

SetLocation sets the location on ctx and returns the old one.

func (*FmtCtx) WithFlags

func (ctx *FmtCtx) WithFlags(flags FmtFlags, fn func())

WithFlags changes the flags in the FmtCtx, runs the given function, then restores the old flags.

func (*FmtCtx) WithReformatTableNames

func (ctx *FmtCtx) WithReformatTableNames(tableNameFmt func(*FmtCtx, *TableName), fn func())

WithReformatTableNames modifies FmtCtx to to substitute the printing of table names using the provided function, calls fn, then restores the original table formatting.

type FmtCtxOption

type FmtCtxOption func(*FmtCtx)

FmtCtxOption is an option to pass into NewFmtCtx.

func FmtAnnotations

func FmtAnnotations(ann *Annotations) FmtCtxOption

FmtAnnotations adds annotations to the FmtCtx.

func FmtDataConversionConfig

func FmtDataConversionConfig(dcc sessiondatapb.DataConversionConfig) FmtCtxOption

FmtDataConversionConfig modifies FmtCtx to contain items relevant for the given DataConversionConfig.

func FmtIndexedTypeFormat

func FmtIndexedTypeFormat(fn func(*FmtCtx, *OIDTypeReference)) FmtCtxOption

FmtIndexedTypeFormat modifies FmtCtx to customize the printing of IDTypeReferences using the provided function.

func FmtIndexedVarFormat

func FmtIndexedVarFormat(fn func(ctx *FmtCtx, idx int)) FmtCtxOption

FmtIndexedVarFormat modifies FmtCtx to customize the printing of IndexedVars using the provided function.

func FmtLocation

func FmtLocation(loc *time.Location) FmtCtxOption

FmtLocation modifies FmtCtx to contain the correct location.

func FmtPlaceholderFormat

func FmtPlaceholderFormat(placeholderFn func(_ *FmtCtx, _ *Placeholder)) FmtCtxOption

FmtPlaceholderFormat modifies FmtCtx to customize the printing of StarDatums using the provided function.

func FmtReformatTableNames

func FmtReformatTableNames(tableNameFmt func(*FmtCtx, *TableName)) FmtCtxOption

FmtReformatTableNames modifies FmtCtx to substitute the printing of table naFmtParsable using the provided function.

type FmtFlags

type FmtFlags int

FmtFlags carries options for the pretty-printer.

func (FmtFlags) EncodeFlags

func (f FmtFlags) EncodeFlags() lexbase.EncodeFlags

EncodeFlags returns the subset of the flags that are also lex encode flags.

func (FmtFlags) HasAnyFlags

func (f FmtFlags) HasAnyFlags(subset FmtFlags) bool

HasAnyFlags tests whether any of the given flags are all set.

func (FmtFlags) HasFlags

func (f FmtFlags) HasFlags(subset FmtFlags) bool

HasFlags tests whether the given flags are all set.

type FnOverload

type FnOverload interface{}

FnOverload is an opaque type used to box an eval.FnOverload.

TODO(ajwerner): Give this a marker method and convert all usages. This is onerous at time of writing because there are so many.

type FnWithExprsOverload

type FnWithExprsOverload interface {
	FnWithExprs()
}

FnWithExprsOverload is an opaque type used to box an eval.FnWithExprsOverload.

type ForeignKeyConstraintTableDef

type ForeignKeyConstraintTableDef struct {
	Name        Name
	Table       TableName
	FromCols    NameList
	ToCols      NameList
	Actions     ReferenceActions
	Match       CompositeKeyMatchMethod
	IfNotExists bool
}

ForeignKeyConstraintTableDef represents a FOREIGN KEY constraint in the AST.

func (*ForeignKeyConstraintTableDef) Format

func (node *ForeignKeyConstraintTableDef) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ForeignKeyConstraintTableDef) SetIfNotExists

func (node *ForeignKeyConstraintTableDef) SetIfNotExists()

SetIfNotExists implements the ConstraintTableDef interface.

func (*ForeignKeyConstraintTableDef) SetName

func (node *ForeignKeyConstraintTableDef) SetName(name Name)

SetName implements the ConstraintTableDef interface.

type From

type From struct {
	Tables TableExprs
	AsOf   AsOfClause
}

From represents a FROM clause.

func (*From) Format

func (node *From) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type FullBackupClause

type FullBackupClause struct {
	AlwaysFull bool
	Recurrence Expr
}

FullBackupClause describes the frequency of full backups.

type FuncExpr

type FuncExpr struct {
	Func  ResolvableFunctionReference
	Type  funcType
	Exprs Exprs
	// Filter is used for filters on aggregates: SUM(k) FILTER (WHERE k > 0)
	Filter    Expr
	WindowDef *WindowDef

	// AggType is used to specify the type of aggregation.
	AggType AggType
	// OrderBy is used for aggregations which specify an order. This same field
	// is used for any type of aggregation.
	OrderBy OrderBy

	// InCall is true when the FuncExpr is part of a CALL statement.
	InCall bool
	// contains filtered or unexported fields
}

FuncExpr represents a function call.

func NewTypedFuncExpr

func NewTypedFuncExpr(
	ref ResolvableFunctionReference,
	aggQualifier funcType,
	exprs TypedExprs,
	filter TypedExpr,
	windowDef *WindowDef,
	typ *types.T,
	props *FunctionProperties,
	overload *Overload,
) *FuncExpr

NewTypedFuncExpr returns a FuncExpr that is already well-typed and resolved.

func (*FuncExpr) Eval

func (node *FuncExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*FuncExpr) Format

func (node *FuncExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*FuncExpr) IsDistSQLBlocklist

func (node *FuncExpr) IsDistSQLBlocklist() bool

IsDistSQLBlocklist returns whether the function is not supported by DistSQL.

func (*FuncExpr) IsGeneratorClass

func (node *FuncExpr) IsGeneratorClass() bool

IsGeneratorClass returns true if the resolved overload metadata is of the GeneratorClass.

func (*FuncExpr) IsVectorizeStreaming

func (node *FuncExpr) IsVectorizeStreaming() bool

IsVectorizeStreaming returns whether the function is of "streaming" nature from the perspective of the vectorized execution engine.

func (*FuncExpr) IsWindowFunctionApplication

func (node *FuncExpr) IsWindowFunctionApplication() bool

IsWindowFunctionApplication returns true iff the function is being applied as a window function.

func (*FuncExpr) MaybeWrapError

func (expr *FuncExpr) MaybeWrapError(err error) error

MaybeWrapError updates non-nil error depending on the FuncExpr to provide more context.

func (*FuncExpr) ResolvedOverload

func (node *FuncExpr) ResolvedOverload() *Overload

ResolvedOverload returns the builtin definition; can only be called after Resolve (which happens during TypeCheck).

func (FuncExpr) ResolvedType

func (ta FuncExpr) ResolvedType() *types.T

func (*FuncExpr) SetTypeAnnotation

func (node *FuncExpr) SetTypeAnnotation(t *types.T)

func (*FuncExpr) String

func (node *FuncExpr) String() string

func (*FuncExpr) TypeCheck

func (expr *FuncExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*FuncExpr) Walk

func (expr *FuncExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type FunctionClass

type FunctionClass int

FunctionClass specifies the class of the builtin function.

const (
	// NormalClass is a standard builtin function.
	NormalClass FunctionClass = iota
	// AggregateClass is a builtin aggregate function.
	AggregateClass
	// WindowClass is a builtin window function.
	WindowClass
	// GeneratorClass is a builtin generator function.
	GeneratorClass
	// SQLClass is a builtin function that executes a SQL statement as a side
	// effect of the function call.
	//
	// For example, AddGeometryColumn is a SQLClass function that executes an
	// ALTER TABLE ... ADD COLUMN statement to add a geometry column to an
	// existing table. It returns metadata about the column added.
	//
	// All builtin functions of this class should include a definition for
	// Overload.SQLFn, which returns the SQL statement to be executed. They
	// should also include a definition for Overload.Fn, which is executed
	// like a NormalClass function and returns a Datum.
	SQLClass
)

func (FunctionClass) String

func (c FunctionClass) String() string

String returns the string representation of the function class.

type FunctionDefinition

type FunctionDefinition struct {
	// Name is the short name of the function.
	Name string

	// Definition is the set of overloads for this function name.
	Definition []*Overload

	// FunctionProperties are the properties common to all overloads.
	FunctionProperties
}

FunctionDefinition implements a reference to the (possibly several) overloads for a built-in function. TODO(Chengxiong): Remove this struct entirely. Instead, use overloads from function resolution or use "GetBuiltinProperties" if the need is to only look at builtin functions(there are such existing use cases). Also change "Name" of ResolvedFunctionDefinition to Name type.

func NewFunctionDefinition

func NewFunctionDefinition(
	name string, props *FunctionProperties, def []Overload,
) *FunctionDefinition

NewFunctionDefinition allocates a function definition corresponding to the given built-in definition.

func (*FunctionDefinition) Format

func (fd *FunctionDefinition) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface. FunctionDefinitions should always be builtin functions, so we do not need to anonymize them, even if the flag is set.

func (*FunctionDefinition) String

func (fd *FunctionDefinition) String() string

String implements the Stringer interface.

type FunctionOID

type FunctionOID struct {
	OID oid.Oid
}

func (*FunctionOID) Format

func (o *FunctionOID) Format(ctx *FmtCtx)

func (*FunctionOID) String

func (o *FunctionOID) String() string

type FunctionProperties

type FunctionProperties struct {
	// UnsupportedWithIssue, if non-zero indicates the built-in is not
	// really supported; the name is a placeholder. Value -1 just says
	// "not supported" without an issue to link; values > 0 provide an
	// issue number to link.
	UnsupportedWithIssue int

	// Undocumented, when set to true, indicates that the built-in function is
	// hidden from documentation. This is currently used to hide experimental
	// functionality as it is being developed.
	Undocumented bool

	// Private, when set to true, indicates the built-in function is not
	// available for use by user queries. This is currently used by some
	// aggregates due to issue #10495. Private functions are implicitly
	// considered undocumented.
	Private bool

	// DistsqlBlocklist is set to true when a function depends on
	// members of the EvalContext that are not marshaled by DistSQL
	// (e.g. planner). Currently used for DistSQL to determine if
	// expressions can be evaluated on a different node without sending
	// over the EvalContext.
	//
	// TODO(andrei): Get rid of the planner from the EvalContext and then we can
	// get rid of this blocklist.
	DistsqlBlocklist bool

	// Category is used to generate documentation strings.
	Category string

	// AvailableOnPublicSchema indicates whether the function can be resolved
	// if it is found on the public schema.
	AvailableOnPublicSchema bool

	// ReturnLabels can be used to override the return column name of a
	// function in a FROM clause.
	// This satisfies a Postgres quirk where some json functions have
	// different return labels when used in SELECT or FROM clause.
	ReturnLabels []string

	// AmbiguousReturnType is true if the builtin's return type can't be
	// determined without extra context. This is used for formatting builtins
	// with the FmtParsable directive.
	AmbiguousReturnType bool

	// HasSequenceArguments is true if the builtin function takes in a sequence
	// name (string) and can be used in a scalar expression.
	// TODO(richardjcai): When implicit casting is supported, these builtins
	// should take RegClass as the arg type for the sequence name instead of
	// string, we will add a dependency on all RegClass types used in a view.
	HasSequenceArguments bool

	// CompositeInsensitive indicates that this function returns equal results
	// when evaluated on equal inputs. This is a non-trivial property for
	// composite types which can be equal but not identical
	// (e.g. decimals 1.0 and 1.00). For example, converting a decimal to string
	// is not CompositeInsensitive.
	//
	// See memo.CanBeCompositeSensitive.
	CompositeInsensitive bool

	// VectorizeStreaming indicates that the function is of "streaming" nature
	// from the perspective of the vectorized execution engine.
	VectorizeStreaming bool

	// ReturnsRecordType indicates that this function is a record-returning
	// function, which implies that it's unusable without a corresponding type
	// alias.
	//
	// For example, consider the case of json_to_record('{"a":"b", "c":"d"}').
	// This function returns an error unless it as an `AS t(a,b,c)` declaration,
	// since its definition is to pick out the JSON attributes within the input
	// that match, by name, to the columns in the aliased record type.
	ReturnsRecordType bool
}

FunctionProperties defines the properties of the built-in functions that are common across all overloads.

func (*FunctionProperties) ShouldDocument

func (fp *FunctionProperties) ShouldDocument() bool

ShouldDocument returns whether the built-in function should be included in external-facing documentation.

type FunctionReference

type FunctionReference interface {
	fmt.Stringer
	NodeFormatter
	// contains filtered or unexported methods
}

FunctionReference is the common interface to UnresolvedName and QualifiedFunctionName.

type FunctionReferenceResolver

type FunctionReferenceResolver interface {
	// ResolveFunction resolves a group of overloads with the given function name
	// within a search path. An error with ErrRoutineUndefined cause is returned
	// if function does not exist.
	//
	// TODO(Chengxiong): Consider adding an optional slice of argument types to
	// the input of this method, so that we can try to narrow down the scope of
	// overloads a bit earlier and decrease the possibility of ambiguous error
	// on function properties.
	ResolveFunction(
		ctx context.Context, name UnresolvedRoutineName, path SearchPath,
	) (*ResolvedFunctionDefinition, error)

	// ResolveFunctionByOID looks up a function overload by using a given oid.
	// Function name is returned together with the overload. Error is thrown if
	// there is no function with the same oid.
	ResolveFunctionByOID(
		ctx context.Context, oid oid.Oid,
	) (*RoutineName, *Overload, error)
}

FunctionReferenceResolver is the interface that provides the ability to resolve built-in or user-defined function definitions from unresolved names.

type GeneratedAlwaysAsIdentity

type GeneratedAlwaysAsIdentity struct {
	SeqOptions SequenceOptions
}

GeneratedAlwaysAsIdentity represents a column generated always as identity.

type GeneratedByDefAsIdentity

type GeneratedByDefAsIdentity struct {
	SeqOptions SequenceOptions
}

GeneratedByDefAsIdentity represents a column generated by default as identity.

type GeneratedIdentityType

type GeneratedIdentityType int

GeneratedIdentityType represents either GENERATED ALWAYS AS IDENTITY or GENERATED BY DEFAULT AS IDENTITY.

const (
	GeneratedAlways GeneratedIdentityType = iota
	GeneratedByDefault
)

The values of GeneratedIdentity.GeneratedAsIdentityType.

type GeneratorOverload

type GeneratorOverload interface {
	Generator()
}

GeneratorOverload is an opaque type used to box an eval.GeneratorOverload.

type GeneratorWithExprsOverload

type GeneratorWithExprsOverload interface {
	GeneratorWithExprs()
}

GeneratorWithExprsOverload is an opaque type used to box an eval.GeneratorWithExprsOverload.

type Grant

type Grant struct {
	Privileges      privilege.List
	Targets         GrantTargetList
	Grantees        RoleSpecList
	WithGrantOption bool
}

Grant represents a GRANT statement.

func (*Grant) Format

func (node *Grant) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Grant) StatementReturnType

func (*Grant) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Grant) StatementTag

func (*Grant) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Grant) StatementType

func (*Grant) StatementType() StatementType

StatementType implements the Statement interface.

func (*Grant) String

func (n *Grant) String() string

type GrantRole

type GrantRole struct {
	Roles       NameList
	Members     RoleSpecList
	AdminOption bool
}

GrantRole represents a GRANT <role> statement.

func (*GrantRole) Format

func (node *GrantRole) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*GrantRole) StatementReturnType

func (*GrantRole) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*GrantRole) StatementTag

func (*GrantRole) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*GrantRole) StatementType

func (*GrantRole) StatementType() StatementType

StatementType implements the Statement interface.

func (*GrantRole) String

func (n *GrantRole) String() string

type GrantTargetList

type GrantTargetList struct {
	Databases  NameList
	Schemas    ObjectNamePrefixList
	Tables     TableAttrs
	Types      []*UnresolvedObjectName
	Functions  RoutineObjs
	Procedures RoutineObjs
	// If the target is for all sequences in a set of schemas.
	AllSequencesInSchema bool
	// If the target is for all tables in a set of schemas.
	AllTablesInSchema bool
	// If the target is for all functions in a set of schemas.
	AllFunctionsInSchema bool
	// If the target is for all procedures in a set of schemas.
	AllProceduresInSchema bool
	// If the target is system.
	System bool
	// If the target is External Connection.
	ExternalConnections NameList

	// ForRoles and Roles are used internally in the parser and not used
	// in the AST. Therefore they do not participate in pretty-printing,
	// etc.
	ForRoles bool
	Roles    RoleSpecList
}

GrantTargetList represents a list of targets. Only one field may be non-nil.

func (*GrantTargetList) Format

func (tl *GrantTargetList) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type GroupBy

type GroupBy []Expr

GroupBy represents a GROUP BY clause.

func (*GroupBy) Format

func (node *GroupBy) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type HiddenConstraint

type HiddenConstraint struct{}

HiddenConstraint represents HIDDEN on a column.

type HiddenFromShowQueries

type HiddenFromShowQueries interface {
	// contains filtered or unexported methods
}

HiddenFromShowQueries is a pseudo-interface to be implemented by statements that should not show up in SHOW QUERIES (and are hence not cancellable using CANCEL QUERIES either). Usually implemented by statements that spawn jobs.

type HomogeneousType

type HomogeneousType struct{}

HomogeneousType is a TypeList implementation that accepts any arguments, as long as all are the same type or NULL. The homogeneous constraint is enforced in typeCheckOverloadedExprs.

func (HomogeneousType) GetAt

func (HomogeneousType) GetAt(i int) *types.T

GetAt is part of the TypeList interface.

func (HomogeneousType) Length

func (HomogeneousType) Length() int

Length is part of the TypeList interface.

func (HomogeneousType) Match

func (HomogeneousType) Match(types []*types.T) bool

Match is part of the TypeList interface.

func (HomogeneousType) MatchAt

func (HomogeneousType) MatchAt(typ *types.T, i int) bool

MatchAt is part of the TypeList interface.

func (HomogeneousType) MatchAtIdentical

func (HomogeneousType) MatchAtIdentical(typ *types.T, i int) bool

MatchAtIdentical is part of the TypeList interface.

func (HomogeneousType) MatchIdentical

func (HomogeneousType) MatchIdentical(types []*types.T) bool

MatchIdentical is part of the TypeList interface.

func (HomogeneousType) MatchLen

func (HomogeneousType) MatchLen(l int) bool

MatchLen is part of the TypeList interface.

func (HomogeneousType) String

func (HomogeneousType) String() string

func (HomogeneousType) Types

func (HomogeneousType) Types() []*types.T

Types is part of the TypeList interface.

type ID

type ID = catid.ColumnID

ID is a custom type for {Database,Table}Descriptor IDs.

type IfErrExpr

type IfErrExpr struct {
	Cond    Expr
	Else    Expr
	ErrCode Expr
	// contains filtered or unexported fields
}

IfErrExpr represents an IFERROR expression.

func NewTypedIfErrExpr

func NewTypedIfErrExpr(cond, orElse, errCode TypedExpr) *IfErrExpr

NewTypedIfErrExpr returns a new IfErrExpr that is verified to be well-typed.

func (*IfErrExpr) Eval

func (node *IfErrExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*IfErrExpr) Format

func (node *IfErrExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (IfErrExpr) ResolvedType

func (ta IfErrExpr) ResolvedType() *types.T

func (*IfErrExpr) String

func (node *IfErrExpr) String() string

func (*IfErrExpr) TypeCheck

func (expr *IfErrExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*IfErrExpr) Walk

func (expr *IfErrExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type IfExpr

type IfExpr struct {
	Cond Expr
	True Expr
	Else Expr
	// contains filtered or unexported fields
}

IfExpr represents an IF expression.

func (*IfExpr) Eval

func (node *IfExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*IfExpr) Format

func (node *IfExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (IfExpr) ResolvedType

func (ta IfExpr) ResolvedType() *types.T

func (*IfExpr) String

func (node *IfExpr) String() string

func (*IfExpr) TypeCheck

func (expr *IfExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*IfExpr) TypedCondExpr

func (node *IfExpr) TypedCondExpr() TypedExpr

TypedCondExpr returns the IfExpr's Cond expression as a TypedExpr.

func (*IfExpr) TypedElseExpr

func (node *IfExpr) TypedElseExpr() TypedExpr

TypedElseExpr returns the IfExpr's Else expression as a TypedExpr.

func (*IfExpr) TypedTrueExpr

func (node *IfExpr) TypedTrueExpr() TypedExpr

TypedTrueExpr returns the IfExpr's True expression as a TypedExpr.

func (*IfExpr) Walk

func (expr *IfExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type Import

type Import struct {
	Table      *TableName
	Into       bool
	IntoCols   NameList
	FileFormat string
	Files      Exprs
	Bundle     bool
	Options    KVOptions
}

Import represents a IMPORT statement.

func (*Import) Format

func (node *Import) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Import) StatementReturnType

func (*Import) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Import) StatementTag

func (*Import) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Import) StatementType

func (*Import) StatementType() StatementType

StatementType implements the Statement interface.

func (*Import) String

func (n *Import) String() string

type InTupleOp

type InTupleOp struct{}

InTupleOp is a BinaryEvalOp.

func (*InTupleOp) Eval

func (op *InTupleOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type IndexElem

type IndexElem struct {
	// Column is set if this is a simple column reference (the common case).
	Column Name
	// Expr is set if the index element is an expression (part of an expression
	// index). If set, Column is empty.
	Expr       Expr
	Direction  Direction
	NullsOrder NullsOrder

	// OpClass is set if an index element was created using a named opclass.
	OpClass Name
}

IndexElem represents a column with a direction in a CREATE INDEX statement.

func (*IndexElem) Format

func (node *IndexElem) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type IndexElemList

type IndexElemList []IndexElem

IndexElemList is list of IndexElem.

func (*IndexElemList) Format

func (l *IndexElemList) Format(ctx *FmtCtx)

Format pretty-prints the contained names separated by commas. Format implements the NodeFormatter interface.

type IndexFlags

type IndexFlags struct {
	Index   UnrestrictedName
	IndexID IndexID
	// Direction of the scan, if provided. Can only be set if
	// one of Index or IndexID is set.
	Direction Direction
	// NoIndexJoin cannot be specified together with an index.
	NoIndexJoin bool
	// NoZigzagJoin indicates we should not plan a zigzag join for this scan.
	NoZigzagJoin bool
	// NoFullScan indicates we should constrain this scan.
	NoFullScan bool
	// IgnoreForeignKeys disables optimizations based on outbound foreign key
	// references from this table. This is useful in particular for scrub queries
	// used to verify the consistency of foreign key relations.
	IgnoreForeignKeys bool
	// IgnoreUniqueWithoutIndexKeys disables optimizations based on unique without
	// index constraints.
	IgnoreUniqueWithoutIndexKeys bool
	// Zigzag hinting fields are distinct:
	// ForceZigzag means we saw a TABLE@{FORCE_ZIGZAG}
	// ZigzagIndexes means we saw TABLE@{FORCE_ZIGZAG=name}
	// ZigzagIndexIDs means we saw TABLE@{FORCE_ZIGZAG=[ID]}
	// The only allowable combinations are when a valid id and name are combined.
	ForceZigzag    bool
	ZigzagIndexes  []UnrestrictedName
	ZigzagIndexIDs []IndexID

	// Restrict select to the specified column family.
	// Used by changefeed.
	FamilyID *FamilyID
}

IndexFlags represents "@<index_name|index_id>" or "@{param[,param]}" where param is one of:

  • FORCE_INDEX=<index_name|index_id>
  • ASC / DESC
  • NO_INDEX_JOIN
  • NO_ZIGZAG_JOIN
  • NO_FULL_SCAN
  • IGNORE_FOREIGN_KEYS
  • FORCE_ZIGZAG
  • FORCE_ZIGZAG=<index_name|index_id>*
  • FAMILY=[family_id]

It is used optionally after a table name in SELECT statements.

func (*IndexFlags) Check

func (ih *IndexFlags) Check() error

Check verifies if the flags are valid:

  • ascending/descending is not specified without an index;
  • no_index_join isn't specified with an index.

func (*IndexFlags) CombineWith

func (ih *IndexFlags) CombineWith(other *IndexFlags) error

CombineWith combines two IndexFlags structures, returning an error if they conflict with one another.

func (*IndexFlags) ForceIndex

func (ih *IndexFlags) ForceIndex() bool

ForceIndex returns true if a forced index was specified, either using a name or an IndexID.

func (*IndexFlags) Format

func (ih *IndexFlags) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type IndexID

type IndexID = catid.IndexID

IndexID is a custom type for IndexDescriptor IDs.

type IndexInvisibility

type IndexInvisibility struct {
	Value         float64
	FloatProvided bool
}

type IndexLookupFlags

type IndexLookupFlags struct {
	// Required, if true, indicates lookup can return nil index without
	// returning an error if the index does not exist.
	Required bool
	// IncludeNonActiveIndex expands the lookup to also consider
	// non-active indexes. By default, only active indexes are
	// considered.
	IncludeNonActiveIndex bool
	// IncludeOfflineTable expands the lookup to also consider offline
	// tables. By default, only online tables are considered.
	IncludeOfflineTable bool
}

IndexLookupFlags is the flag struct used for resolver.ResolveIndex() only.

type IndexTableDef

type IndexTableDef struct {
	Name             Name
	Columns          IndexElemList
	Sharded          *ShardedIndexDef
	Storing          NameList
	Inverted         bool
	PartitionByIndex *PartitionByIndex
	StorageParams    StorageParams
	Predicate        Expr
	Invisibility     IndexInvisibility
}

IndexTableDef represents an index definition within a CREATE TABLE statement.

func (*IndexTableDef) Format

func (node *IndexTableDef) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type IndexedVar

type IndexedVar struct {
	Idx  int
	Used bool
	// contains filtered or unexported fields
}

IndexedVar is a VariableExpr that can be used as a leaf in expressions; it represents a dynamic value. It defers calls to TypeCheck, Eval, String to an IndexedVarContainer.

func NewOrdinalReference

func NewOrdinalReference(r int) *IndexedVar

NewOrdinalReference is a helper routine to create a standalone IndexedVar with the given index value. This needs to undergo BindIfUnbound() below before it can be fully used.

func NewTypedOrdinalReference

func NewTypedOrdinalReference(r int, typ *types.T) *IndexedVar

NewTypedOrdinalReference returns a new IndexedVar with the given index value that is verified to be well-typed.

func (*IndexedVar) Eval

func (node *IndexedVar) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*IndexedVar) Format

func (v *IndexedVar) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*IndexedVar) ResolvedType

func (v *IndexedVar) ResolvedType() *types.T

ResolvedType is part of the TypedExpr interface.

func (*IndexedVar) String

func (node *IndexedVar) String() string

func (*IndexedVar) TypeCheck

func (v *IndexedVar) TypeCheck(
	_ context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck is part of the Expr interface.

func (*IndexedVar) Variable

func (*IndexedVar) Variable()

Variable is a dummy function part of the VariableExpr interface.

func (*IndexedVar) Walk

func (v *IndexedVar) Walk(_ Visitor) Expr

Walk is part of the Expr interface.

type IndexedVarContainer

type IndexedVarContainer interface {
	IndexedVarResolvedType(idx int) *types.T
	// IndexedVarNodeFormatter returns a NodeFormatter; if an object that
	// wishes to implement this interface has lost the textual name that an
	// IndexedVar originates from, this function can return nil (and the
	// ordinal syntax "@1, @2, .." will be used).
	IndexedVarNodeFormatter(idx int) NodeFormatter
}

IndexedVarContainer provides the implementation of TypeCheck, Eval, and String for IndexedVars.

type IndexedVarHelper

type IndexedVarHelper struct {
	// contains filtered or unexported fields
}

IndexedVarHelper wraps an IndexedVarContainer (an interface) and creates IndexedVars bound to that container.

It also keeps track of which indexes from the container are used by expressions.

func MakeIndexedVarHelper

func MakeIndexedVarHelper(container IndexedVarContainer, numVars int) IndexedVarHelper

MakeIndexedVarHelper initializes an IndexedVarHelper structure.

func MakeTypesOnlyIndexedVarHelper

func MakeTypesOnlyIndexedVarHelper(types []*types.T) IndexedVarHelper

MakeTypesOnlyIndexedVarHelper creates an IndexedVarHelper which provides the given types for indexed vars. It does not support evaluation, unless Rebind is used with another container which supports evaluation.

func (*IndexedVarHelper) AppendSlot

func (h *IndexedVarHelper) AppendSlot() int

AppendSlot expands the capacity of this IndexedVarHelper by one and returns the index of the new slot.

func (*IndexedVarHelper) BindIfUnbound

func (h *IndexedVarHelper) BindIfUnbound(ivar *IndexedVar) (*IndexedVar, error)

BindIfUnbound ensures the IndexedVar is attached to this helper's container. - for freshly created IndexedVars (with a nil container) this will bind in-place. - for already bound IndexedVar, bound to this container, this will return the same ivar unchanged. - for ordinal references (with an explicit unboundContainer) this will return a new var. - for already bound IndexedVars, bound to another container, this will error out.

func (*IndexedVarHelper) Container

func (h *IndexedVarHelper) Container() IndexedVarContainer

Container returns the container associated with the helper.

func (*IndexedVarHelper) GetIndexedVars

func (h *IndexedVarHelper) GetIndexedVars() []IndexedVar

GetIndexedVars returns the indexed var array of this helper. IndexedVars to the caller; unused vars are guaranteed to have a false Used field.

func (*IndexedVarHelper) IndexedVar

func (h *IndexedVarHelper) IndexedVar(idx int) *IndexedVar

IndexedVar returns an IndexedVar for the given index. The index must be valid.

func (*IndexedVarHelper) IndexedVarUsed

func (h *IndexedVarHelper) IndexedVarUsed(idx int) bool

IndexedVarUsed returns true if IndexedVar() was called for the given index. The index must be valid.

func (*IndexedVarHelper) IndexedVarWithType

func (h *IndexedVarHelper) IndexedVarWithType(idx int, typ *types.T) *IndexedVar

IndexedVarWithType returns an IndexedVar for the given index, with the given type. The index must be valid. This should be used in the case where an indexed var is being added before its container has a corresponding entry for it.

func (*IndexedVarHelper) Rebind

func (h *IndexedVarHelper) Rebind(expr TypedExpr) TypedExpr

Rebind collects all the IndexedVars in the given expression and re-binds them to this helper.

func (*IndexedVarHelper) VisitPost

func (*IndexedVarHelper) VisitPost(expr Expr) Expr

VisitPost implements the Visitor interface.

func (*IndexedVarHelper) VisitPre

func (h *IndexedVarHelper) VisitPre(expr Expr) (recurse bool, newExpr Expr)

VisitPre implements the Visitor interface.

type IndirectionExpr

type IndirectionExpr struct {
	Expr        Expr
	Indirection ArraySubscripts
	// contains filtered or unexported fields
}

IndirectionExpr represents a subscript expression.

func NewTypedIndirectionExpr

func NewTypedIndirectionExpr(expr, index TypedExpr, typ *types.T) *IndirectionExpr

NewTypedIndirectionExpr returns a new IndirectionExpr that is verified to be well-typed.

func (*IndirectionExpr) Eval

func (node *IndirectionExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*IndirectionExpr) Format

func (node *IndirectionExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (IndirectionExpr) ResolvedType

func (ta IndirectionExpr) ResolvedType() *types.T

func (*IndirectionExpr) String

func (node *IndirectionExpr) String() string

func (*IndirectionExpr) TypeCheck

func (expr *IndirectionExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*IndirectionExpr) Walk

func (expr *IndirectionExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type Insert

type Insert struct {
	With       *With
	Table      TableExpr
	Columns    NameList
	Rows       *Select
	OnConflict *OnConflict
	Returning  ReturningClause
}

Insert represents an INSERT statement.

func (*Insert) DefaultValues

func (node *Insert) DefaultValues() bool

DefaultValues returns true iff only default values are being inserted.

func (*Insert) Format

func (node *Insert) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Insert) StatementReturnType

func (n *Insert) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Insert) StatementTag

func (*Insert) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Insert) StatementType

func (*Insert) StatementType() StatementType

StatementType implements the Statement interface.

func (*Insert) String

func (n *Insert) String() string

type IsNotNullExpr

type IsNotNullExpr struct {
	Expr Expr
	// contains filtered or unexported fields
}

IsNotNullExpr represents an IS NOT NULL expression. This is equivalent to IS DISTINCT FROM NULL, except when the input is a tuple.

func NewTypedIsNotNullExpr

func NewTypedIsNotNullExpr(expr TypedExpr) *IsNotNullExpr

NewTypedIsNotNullExpr returns a new IsNotNullExpr that is verified to be well-typed.

func (*IsNotNullExpr) Eval

func (node *IsNotNullExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*IsNotNullExpr) Format

func (node *IsNotNullExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (IsNotNullExpr) ResolvedType

func (ta IsNotNullExpr) ResolvedType() *types.T

func (*IsNotNullExpr) String

func (node *IsNotNullExpr) String() string

func (*IsNotNullExpr) TypeCheck

func (expr *IsNotNullExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*IsNotNullExpr) TypedInnerExpr

func (node *IsNotNullExpr) TypedInnerExpr() TypedExpr

TypedInnerExpr returns the IsNotNullExpr's inner expression as a TypedExpr.

func (*IsNotNullExpr) Walk

func (expr *IsNotNullExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type IsNullExpr

type IsNullExpr struct {
	Expr Expr
	// contains filtered or unexported fields
}

IsNullExpr represents an IS NULL expression. This is equivalent to IS NOT DISTINCT FROM NULL, except when the input is a tuple.

func NewTypedIsNullExpr

func NewTypedIsNullExpr(expr TypedExpr) *IsNullExpr

NewTypedIsNullExpr returns a new IsNullExpr that is verified to be well-typed.

func (*IsNullExpr) Eval

func (node *IsNullExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*IsNullExpr) Format

func (node *IsNullExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (IsNullExpr) ResolvedType

func (ta IsNullExpr) ResolvedType() *types.T

func (*IsNullExpr) String

func (node *IsNullExpr) String() string

func (*IsNullExpr) TypeCheck

func (expr *IsNullExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*IsNullExpr) TypedInnerExpr

func (node *IsNullExpr) TypedInnerExpr() TypedExpr

TypedInnerExpr returns the IsNullExpr's inner expression as a TypedExpr.

func (*IsNullExpr) Walk

func (expr *IsNullExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type IsOfTypeExpr

type IsOfTypeExpr struct {
	Not   bool
	Expr  Expr
	Types []ResolvableTypeReference
	// contains filtered or unexported fields
}

IsOfTypeExpr represents an IS {,NOT} OF (type_list) expression.

func (*IsOfTypeExpr) Eval

func (node *IsOfTypeExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*IsOfTypeExpr) Format

func (node *IsOfTypeExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (IsOfTypeExpr) ResolvedType

func (ta IsOfTypeExpr) ResolvedType() *types.T

func (*IsOfTypeExpr) ResolvedTypes

func (node *IsOfTypeExpr) ResolvedTypes() []*types.T

ResolvedTypes returns a slice of resolved types corresponding to the Types slice of unresolved types. It may only be accessed after typechecking.

func (*IsOfTypeExpr) String

func (node *IsOfTypeExpr) String() string

func (*IsOfTypeExpr) TypeCheck

func (expr *IsOfTypeExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*IsOfTypeExpr) Walk

func (expr *IsOfTypeExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type IsolationLevel

type IsolationLevel int

IsolationLevel holds the isolation level for a transaction.

const (
	UnspecifiedIsolation IsolationLevel = iota
	ReadUncommittedIsolation
	ReadCommittedIsolation
	RepeatableReadIsolation
	SnapshotIsolation
	SerializableIsolation
)

IsolationLevel values

func IsolationLevelFromKVTxnIsolationLevel

func IsolationLevelFromKVTxnIsolationLevel(level isolation.Level) IsolationLevel

IsolationLevelFromKVTxnIsolationLevel converts a kv level isolation.Level to its SQL semantic equivalent.

func (IsolationLevel) SafeValue

func (k IsolationLevel) SafeValue()

SafeValue makes Kind a redact.SafeValue.

func (IsolationLevel) String

func (i IsolationLevel) String() string

type JSONAllExistsOp

type JSONAllExistsOp struct{}

JSONAllExistsOp is a BinaryEvalOp.

func (*JSONAllExistsOp) Eval

func (op *JSONAllExistsOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type JSONExistsOp

type JSONExistsOp struct{}

JSONExistsOp is a BinaryEvalOp.

func (*JSONExistsOp) Eval

func (op *JSONExistsOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type JSONFetchTextIntOp

type JSONFetchTextIntOp struct{}

JSONFetchTextIntOp is a BinaryEvalOp.

func (*JSONFetchTextIntOp) Eval

func (op *JSONFetchTextIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type JSONFetchTextPathOp

type JSONFetchTextPathOp struct{}

JSONFetchTextPathOp is a BinaryEvalOp.

func (*JSONFetchTextPathOp) Eval

func (op *JSONFetchTextPathOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type JSONFetchTextStringOp

type JSONFetchTextStringOp struct{}

JSONFetchTextStringOp is a BinaryEvalOp.

func (*JSONFetchTextStringOp) Eval

func (op *JSONFetchTextStringOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type JSONFetchValIntOp

type JSONFetchValIntOp struct{}

JSONFetchValIntOp is a BinaryEvalOp.

func (*JSONFetchValIntOp) Eval

func (op *JSONFetchValIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type JSONFetchValPathOp

type JSONFetchValPathOp struct{}

JSONFetchValPathOp is a BinaryEvalOp.

func (*JSONFetchValPathOp) Eval

func (op *JSONFetchValPathOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type JSONFetchValStringOp

type JSONFetchValStringOp struct{}

JSONFetchValStringOp is a BinaryEvalOp.

func (*JSONFetchValStringOp) Eval

func (op *JSONFetchValStringOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type JSONSomeExistsOp

type JSONSomeExistsOp struct{}

JSONSomeExistsOp is a BinaryEvalOp.

func (*JSONSomeExistsOp) Eval

func (op *JSONSomeExistsOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type JobCommand

type JobCommand int

JobCommand determines which type of action to effect on the selected job(s).

const (
	PauseJob JobCommand = iota
	CancelJob
	ResumeJob
)

JobCommand values

type JoinCond

type JoinCond interface {
	NodeFormatter
	// contains filtered or unexported methods
}

JoinCond represents a join condition.

type JoinTableExpr

type JoinTableExpr struct {
	JoinType string
	Left     TableExpr
	Right    TableExpr
	Cond     JoinCond
	Hint     string
}

JoinTableExpr represents a TableExpr that's a JOIN operation.

func (*JoinTableExpr) Format

func (node *JoinTableExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*JoinTableExpr) String

func (node *JoinTableExpr) String() string

func (*JoinTableExpr) WalkTableExpr

func (expr *JoinTableExpr) WalkTableExpr(v Visitor) TableExpr

WalkTableExpr implements the TableExpr interface.

type KVOption

type KVOption struct {
	Key   Name
	Value Expr
}

KVOption is a key-value option.

type KVOptions

type KVOptions []KVOption

KVOptions is a list of KVOptions.

func (*KVOptions) Format

func (o *KVOptions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*KVOptions) HasKey

func (o *KVOptions) HasKey(key Name) bool

HasKey searches the set of options to discover if it has key.

type LShiftINetOp

type LShiftINetOp struct{}

LShiftINetOp is a BinaryEvalOp.

func (*LShiftINetOp) Eval

func (op *LShiftINetOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type LShiftIntOp

type LShiftIntOp struct{}

LShiftIntOp is a BinaryEvalOp.

func (*LShiftIntOp) Eval

func (op *LShiftIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type LShiftVarBitIntOp

type LShiftVarBitIntOp struct{}

LShiftVarBitIntOp is a BinaryEvalOp.

func (*LShiftVarBitIntOp) Eval

func (op *LShiftVarBitIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type LabelSpec

type LabelSpec struct {
	IfNotExists bool
	Label       Expr
}

LabelSpec describes the labeling specification for an object.

func (*LabelSpec) Format

func (l *LabelSpec) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type LikeTableDef

type LikeTableDef struct {
	Name    TableName
	Options []LikeTableOption
}

LikeTableDef represents a LIKE table declaration on a CREATE TABLE statement.

func (*LikeTableDef) Format

func (def *LikeTableDef) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type LikeTableOpt

type LikeTableOpt int

LikeTableOpt represents one of the types of things that can be included or excluded in a LIKE table declaration. It's a bitmap, where each of the Opt values is a single enabled bit in the map.

const (
	LikeTableOptConstraints LikeTableOpt = 1 << iota
	LikeTableOptDefaults
	LikeTableOptGenerated
	LikeTableOptIndexes
)

The values for LikeTableOpt.

func (LikeTableOpt) Has

func (o LikeTableOpt) Has(other LikeTableOpt) bool

Has returns true if the receiver has the other options bits set.

func (LikeTableOpt) String

func (o LikeTableOpt) String() string

type LikeTableOption

type LikeTableOption struct {
	Excluded bool
	Opt      LikeTableOpt
}

LikeTableOption represents an individual INCLUDING / EXCLUDING statement on a LIKE table declaration.

func (LikeTableOption) Format

func (l LikeTableOption) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type LikeTenantSpec

type LikeTenantSpec struct {
	OtherTenant *TenantSpec
}

LikeTenantSpec represents a LIKE clause in CREATE VIRTUAL CLUSTER.

func (*LikeTenantSpec) Format

func (node *LikeTenantSpec) Format(ctx *FmtCtx)

type Limit

type Limit struct {
	Offset, Count Expr
	LimitAll      bool
}

Limit represents a LIMIT clause.

func (*Limit) Format

func (node *Limit) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type LineWidthMode

type LineWidthMode int

LineWidthMode directs which mode of line width to use.

type ListPartition

type ListPartition struct {
	Name         Name
	Exprs        Exprs
	Subpartition *PartitionBy
}

ListPartition represents a PARTITION definition within a PARTITION BY LIST.

func (*ListPartition) Format

func (node *ListPartition) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type LiteralValuesClause

type LiteralValuesClause struct {
	Rows ExprContainer
}

LiteralValuesClause is like ValuesClause but values have been typed checked and evaluated and are assumed to be ready to use Datums.

func (*LiteralValuesClause) Format

func (node *LiteralValuesClause) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*LiteralValuesClause) StatementReturnType

func (*LiteralValuesClause) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*LiteralValuesClause) StatementTag

func (*LiteralValuesClause) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*LiteralValuesClause) StatementType

func (*LiteralValuesClause) StatementType() StatementType

StatementType implements the Statement interface.

func (*LiteralValuesClause) String

func (n *LiteralValuesClause) String() string

type Locality

type Locality struct {
	LocalityLevel LocalityLevel
	// TableRegion is set if is LocalityLevelTable and a non-primary region is set.
	TableRegion Name
	// RegionalByRowColumn is set if col_name on REGIONAL BY ROW ON <col_name> is
	// set.
	RegionalByRowColumn Name
}

Locality defines the locality for a given table.

func (*Locality) Format

func (node *Locality) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type LocalityLevel

type LocalityLevel int

LocalityLevel is a defined locality.

const (
	// LocalityLevelGlobal distributes a table across
	// a global cluster.
	LocalityLevelGlobal LocalityLevel = iota
	// LocalityLevelTable implies a table is homed
	// in a fixed region.
	LocalityLevelTable
	// LocalityLevelRow implies a table's rows are
	// homed depending on values within the row.
	LocalityLevelRow
)

type LockingClause

type LockingClause []*LockingItem

LockingClause represents a locking clause, like FOR UPDATE.

func (*LockingClause) Format

func (node *LockingClause) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type LockingDurability

type LockingDurability byte

LockingDurability represents the durability of a lock. It is not exposed through SQL, but is instead set by the system according to statement type and isolation level. It is included here for completeness.

const (
	// LockDurabilityBestEffort represents the default: make a best-effort attempt
	// to hold the lock until commit while keeping it unreplicated and in-memory
	// on the leaseholder of the locked row. Best-effort locks do not propagate
	// via Raft to other nodes, and are therefore much faster to acquire than
	// guaranteed-durable locks. For this reason we prefer to use best-effort
	// locks when possible (i.e. whenever locking is used as an optimization
	// rather than as a guarantor of exclusion).
	LockDurabilityBestEffort LockingDurability = iota

	// LockDurabilityGuaranteed guarantees that if the transaction commits, the
	// lock was held until commit, even in the face of lease transfers, range
	// splits, range merges, node failures, memory limits, etc. Guaranteed-durable
	// locks *must* be used whenever correctness depends on locking.
	LockDurabilityGuaranteed
)

The ordering of the variants is important, because the highest numerical value takes precedence when row-level locking is specified multiple ways.

func (LockingDurability) Max

Max returns the most durable of the two locking durabilities.

func (LockingDurability) String

func (d LockingDurability) String() string

type LockingForm

type LockingForm byte

LockingForm represents the form of locking to use, record locking or predicate locking. It is not currently exposed through SQL, but could be once more fully supported.

const (
	// LockRecord represents the default: lock existing rows within the specified
	// span(s), which prevents modification of those rows but does not prevent
	// insertion of new rows (phantoms) into the span(s).
	LockRecord LockingForm = iota
	// LockPredicate represents locking the logical predicate defined by the
	// span(s), preventing modification of existing rows as well as insertion of
	// new rows (phantoms). This is similar to the behavior of "next-key locks" in
	// InnoDB, "key-range locks" in SQL Server, "phantom locks" in Sybase, etc.
	// (Postgres also has predicate locks, which it uses under serializable
	// isolation, but these are used to detect serializable violations rather than
	// for mutual exclusion.)
	//
	// We currently only use predicate locks for uniqueness checks under snapshot
	// and read committed isolation, and only support predicate locks on
	// single-key spans.
	LockPredicate
)

The ordering of the variants is important, because the highest numerical value takes precedence when row-level locking is specified multiple ways.

func (LockingForm) Max

Max returns the maximum of the two locking forms.

func (LockingForm) String

func (p LockingForm) String() string

type LockingItem

type LockingItem struct {
	Strength   LockingStrength
	Targets    TableNames
	WaitPolicy LockingWaitPolicy
	Form       LockingForm
}

LockingItem represents a single locking item in a locking clause.

func (*LockingItem) Format

func (f *LockingItem) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type LockingStrength

type LockingStrength byte

LockingStrength represents the possible row-level lock modes for a SELECT statement.

const (
	// ForNone represents the default - no for statement at all.
	// LockingItem AST nodes are never created with this strength.
	ForNone LockingStrength = iota
	// ForKeyShare represents FOR KEY SHARE.
	ForKeyShare
	// ForShare represents FOR SHARE.
	ForShare
	// ForNoKeyUpdate represents FOR NO KEY UPDATE.
	ForNoKeyUpdate
	// ForUpdate represents FOR UPDATE.
	ForUpdate
)

The ordering of the variants is important, because the highest numerical value takes precedence when row-level locking is specified multiple ways.

func (LockingStrength) Format

func (s LockingStrength) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (LockingStrength) Max

Max returns the maximum of the two locking strengths.

func (LockingStrength) String

func (s LockingStrength) String() string

type LockingWaitPolicy

type LockingWaitPolicy byte

LockingWaitPolicy represents the possible policies for handling conflicting locks held by other active transactions when attempting to lock rows due to FOR UPDATE/SHARE clauses (i.e. it represents the NOWAIT and SKIP LOCKED options).

const (
	// LockWaitBlock represents the default - wait for the lock to become
	// available.
	LockWaitBlock LockingWaitPolicy = iota
	// LockWaitSkipLocked represents SKIP LOCKED - skip rows that can't be locked.
	LockWaitSkipLocked
	// LockWaitError represents NOWAIT - raise an error if a row cannot be
	// locked.
	LockWaitError
)

The ordering of the variants is important, because the highest numerical value takes precedence when row-level locking is specified multiple ways.

func (LockingWaitPolicy) Format

func (p LockingWaitPolicy) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (LockingWaitPolicy) Max

Max returns the maximum of the two locking wait policies.

func (LockingWaitPolicy) String

func (p LockingWaitPolicy) String() string

type MatchLikeOp

type MatchLikeOp struct {
	CaseInsensitive bool
}

MatchLikeOp is a BinaryEvalOp.

func (*MatchLikeOp) Eval

func (op *MatchLikeOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MatchRegexpOp

type MatchRegexpOp struct {
	Escape          rune
	CaseInsensitive bool
}

MatchRegexpOp is a BinaryEvalOp.

func (*MatchRegexpOp) Eval

func (op *MatchRegexpOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusDateIntOp

type MinusDateIntOp struct{}

MinusDateIntOp is a BinaryEvalOp.

func (*MinusDateIntOp) Eval

func (op *MinusDateIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusDateIntervalOp

type MinusDateIntervalOp struct{}

MinusDateIntervalOp is a BinaryEvalOp.

func (*MinusDateIntervalOp) Eval

func (op *MinusDateIntervalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusDateOp

type MinusDateOp struct{}

MinusDateOp is a BinaryEvalOp.

func (*MinusDateOp) Eval

func (op *MinusDateOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusDateTimeOp

type MinusDateTimeOp struct{}

MinusDateTimeOp is a BinaryEvalOp.

func (*MinusDateTimeOp) Eval

func (op *MinusDateTimeOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusDecimalIntOp

type MinusDecimalIntOp struct{}

MinusDecimalIntOp is a BinaryEvalOp.

func (*MinusDecimalIntOp) Eval

func (op *MinusDecimalIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusDecimalOp

type MinusDecimalOp struct{}

MinusDecimalOp is a BinaryEvalOp.

func (*MinusDecimalOp) Eval

func (op *MinusDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusFloatOp

type MinusFloatOp struct{}

MinusFloatOp is a BinaryEvalOp.

func (*MinusFloatOp) Eval

func (op *MinusFloatOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusINetIntOp

type MinusINetIntOp struct{}

MinusINetIntOp is a BinaryEvalOp.

func (*MinusINetIntOp) Eval

func (op *MinusINetIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusINetOp

type MinusINetOp struct{}

MinusINetOp is a BinaryEvalOp.

func (*MinusINetOp) Eval

func (op *MinusINetOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusIntDecimalOp

type MinusIntDecimalOp struct{}

MinusIntDecimalOp is a BinaryEvalOp.

func (*MinusIntDecimalOp) Eval

func (op *MinusIntDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusIntOp

type MinusIntOp struct{}

MinusIntOp is a BinaryEvalOp.

func (*MinusIntOp) Eval

func (op *MinusIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusIntervalOp

type MinusIntervalOp struct{}

MinusIntervalOp is a BinaryEvalOp.

func (*MinusIntervalOp) Eval

func (op *MinusIntervalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusJsonbIntOp

type MinusJsonbIntOp struct{}

MinusJsonbIntOp is a BinaryEvalOp.

func (*MinusJsonbIntOp) Eval

func (op *MinusJsonbIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusJsonbStringArrayOp

type MinusJsonbStringArrayOp struct{}

MinusJsonbStringArrayOp is a BinaryEvalOp.

func (*MinusJsonbStringArrayOp) Eval

Eval is part of the BinaryEvalOp interface.

type MinusJsonbStringOp

type MinusJsonbStringOp struct{}

MinusJsonbStringOp is a BinaryEvalOp.

func (*MinusJsonbStringOp) Eval

func (op *MinusJsonbStringOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusPGLSNDecimalOp

type MinusPGLSNDecimalOp struct{}

MinusPGLSNDecimalOp is a BinaryEvalOp.

func (*MinusPGLSNDecimalOp) Eval

func (op *MinusPGLSNDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusPGLSNOp

type MinusPGLSNOp struct{}

MinusPGLSNOp is a BinaryEvalOp.

func (*MinusPGLSNOp) Eval

func (op *MinusPGLSNOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusTimeIntervalOp

type MinusTimeIntervalOp struct{}

MinusTimeIntervalOp is a BinaryEvalOp.

func (*MinusTimeIntervalOp) Eval

func (op *MinusTimeIntervalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusTimeOp

type MinusTimeOp struct{}

MinusTimeOp is a BinaryEvalOp.

func (*MinusTimeOp) Eval

func (op *MinusTimeOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusTimeTZIntervalOp

type MinusTimeTZIntervalOp struct{}

MinusTimeTZIntervalOp is a BinaryEvalOp.

func (*MinusTimeTZIntervalOp) Eval

func (op *MinusTimeTZIntervalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusTimestampIntervalOp

type MinusTimestampIntervalOp struct{}

MinusTimestampIntervalOp is a BinaryEvalOp.

func (*MinusTimestampIntervalOp) Eval

Eval is part of the BinaryEvalOp interface.

type MinusTimestampOp

type MinusTimestampOp struct{}

MinusTimestampOp is a BinaryEvalOp.

func (*MinusTimestampOp) Eval

func (op *MinusTimestampOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusTimestampTZIntervalOp

type MinusTimestampTZIntervalOp struct{}

MinusTimestampTZIntervalOp is a BinaryEvalOp.

func (*MinusTimestampTZIntervalOp) Eval

Eval is part of the BinaryEvalOp interface.

type MinusTimestampTZOp

type MinusTimestampTZOp struct{}

MinusTimestampTZOp is a BinaryEvalOp.

func (*MinusTimestampTZOp) Eval

func (op *MinusTimestampTZOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MinusTimestampTZTimestampOp

type MinusTimestampTZTimestampOp struct{}

MinusTimestampTZTimestampOp is a BinaryEvalOp.

func (*MinusTimestampTZTimestampOp) Eval

Eval is part of the BinaryEvalOp interface.

type MinusTimestampTimestampTZOp

type MinusTimestampTimestampTZOp struct{}

MinusTimestampTimestampTZOp is a BinaryEvalOp.

func (*MinusTimestampTimestampTZOp) Eval

Eval is part of the BinaryEvalOp interface.

type ModDecimalIntOp

type ModDecimalIntOp struct{}

ModDecimalIntOp is a BinaryEvalOp.

func (*ModDecimalIntOp) Eval

func (op *ModDecimalIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type ModDecimalOp

type ModDecimalOp struct{}

ModDecimalOp is a BinaryEvalOp.

func (*ModDecimalOp) Eval

func (op *ModDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type ModFloatOp

type ModFloatOp struct{}

ModFloatOp is a BinaryEvalOp.

func (*ModFloatOp) Eval

func (op *ModFloatOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type ModIntDecimalOp

type ModIntDecimalOp struct{}

ModIntDecimalOp is a BinaryEvalOp.

func (*ModIntDecimalOp) Eval

func (op *ModIntDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type ModIntOp

type ModIntOp struct{}

ModIntOp is a BinaryEvalOp.

func (*ModIntOp) Eval

func (op *ModIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type ModStringOp

type ModStringOp struct{}

ModStringOp is a BinaryEvalOp.

func (*ModStringOp) Eval

func (op *ModStringOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MoveCursor

type MoveCursor struct {
	CursorStmt
}

MoveCursor represents a MOVE statement.

func (MoveCursor) Format

func (m MoveCursor) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*MoveCursor) StatementReturnType

func (n *MoveCursor) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*MoveCursor) StatementTag

func (*MoveCursor) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*MoveCursor) StatementType

func (*MoveCursor) StatementType() StatementType

StatementType implements the Statement interface.

func (*MoveCursor) String

func (n *MoveCursor) String() string

type MultDecimalIntOp

type MultDecimalIntOp struct{}

MultDecimalIntOp is a BinaryEvalOp.

func (*MultDecimalIntOp) Eval

func (op *MultDecimalIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MultDecimalIntervalOp

type MultDecimalIntervalOp struct{}

MultDecimalIntervalOp is a BinaryEvalOp.

func (*MultDecimalIntervalOp) Eval

func (op *MultDecimalIntervalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MultDecimalOp

type MultDecimalOp struct{}

MultDecimalOp is a BinaryEvalOp.

func (*MultDecimalOp) Eval

func (op *MultDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MultFloatIntervalOp

type MultFloatIntervalOp struct{}

MultFloatIntervalOp is a BinaryEvalOp.

func (*MultFloatIntervalOp) Eval

func (op *MultFloatIntervalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MultFloatOp

type MultFloatOp struct{}

MultFloatOp is a BinaryEvalOp.

func (*MultFloatOp) Eval

func (op *MultFloatOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MultIntDecimalOp

type MultIntDecimalOp struct{}

MultIntDecimalOp is a BinaryEvalOp.

func (*MultIntDecimalOp) Eval

func (op *MultIntDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MultIntIntervalOp

type MultIntIntervalOp struct{}

MultIntIntervalOp is a BinaryEvalOp.

func (*MultIntIntervalOp) Eval

func (op *MultIntIntervalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MultIntOp

type MultIntOp struct{}

MultIntOp is a BinaryEvalOp.

func (*MultIntOp) Eval

func (op *MultIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MultIntervalDecimalOp

type MultIntervalDecimalOp struct{}

MultIntervalDecimalOp is a BinaryEvalOp.

func (*MultIntervalDecimalOp) Eval

func (op *MultIntervalDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MultIntervalFloatOp

type MultIntervalFloatOp struct{}

MultIntervalFloatOp is a BinaryEvalOp.

func (*MultIntervalFloatOp) Eval

func (op *MultIntervalFloatOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MultIntervalIntOp

type MultIntervalIntOp struct{}

MultIntervalIntOp is a BinaryEvalOp.

func (*MultIntervalIntOp) Eval

func (op *MultIntervalIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type MultipleResultsError

type MultipleResultsError struct {
	SQL string // the query that produced this error
}

MultipleResultsError is returned by QueryRow when more than one result is encountered.

func (*MultipleResultsError) Error

func (e *MultipleResultsError) Error() string

type Name

type Name string

A Name is an SQL identifier.

In general, a Name is the result of parsing a name nonterminal, which is used in the grammar where reserved keywords cannot be distinguished from identifiers. A Name that matches a reserved keyword must thus be quoted when formatted. (Names also need quoting for a variety of other reasons; see isBareIdentifier.)

For historical reasons, some Names are instead the result of parsing `unrestricted_name` nonterminals. See UnrestrictedName for details.

func (*Name) Format

func (n *Name) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (Name) Normalize

func (n Name) Normalize() string

Normalize normalizes to lowercase and Unicode Normalization Form C (NFC).

func (*Name) String

func (node *Name) String() string

type NameList

type NameList []Name

A NameList is a list of identifiers.

func (NameList) Contains

func (l NameList) Contains(name Name) bool

Contains returns true if the NameList contains the name.

func (*NameList) Format

func (l *NameList) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*NameList) String

func (list *NameList) String() string

func (NameList) ToStrings

func (l NameList) ToStrings() []string

ToStrings converts the name list to an array of regular strings.

type NameParts

type NameParts = [4]string

NameParts is the array of strings that composes the path in an UnresolvedName.

type NamedColumnQualification

type NamedColumnQualification struct {
	Name          Name
	Qualification ColumnQualification
}

NamedColumnQualification wraps a NamedColumnQualification with a name.

type NaturalJoinCond

type NaturalJoinCond struct{}

NaturalJoinCond represents a NATURAL join condition

func (NaturalJoinCond) Format

func (NaturalJoinCond) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type NewParseContextOption

type NewParseContextOption func(ret *simpleParseContext)

NewParseContextOption is an option to NewParseContext.

func NewParseContextOptionDateStyle

func NewParseContextOptionDateStyle(dateStyle pgdate.DateStyle) NewParseContextOption

NewParseContextOptionDateStyle sets the DateStyle for the context.

type NoReturningClause

type NoReturningClause struct{}

NoReturningClause represents the absence of a RETURNING clause.

func (*NoReturningClause) Format

func (*NoReturningClause) Format(_ *FmtCtx)

Format implements the NodeFormatter interface.

type NodeFormatter

type NodeFormatter interface {
	// Format performs pretty-printing towards a bytes buffer. The flags member
	// of ctx influences the results. Most callers should use FormatNode instead.
	Format(ctx *FmtCtx)
}

NodeFormatter is implemented by nodes that can be pretty-printed.

type NotExpr

type NotExpr struct {
	Expr Expr
	// contains filtered or unexported fields
}

NotExpr represents a NOT expression.

func NewTypedNotExpr

func NewTypedNotExpr(expr TypedExpr) *NotExpr

NewTypedNotExpr returns a new NotExpr that is verified to be well-typed.

func (*NotExpr) Eval

func (node *NotExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*NotExpr) Format

func (node *NotExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (NotExpr) ResolvedType

func (ta NotExpr) ResolvedType() *types.T

func (*NotExpr) String

func (node *NotExpr) String() string

func (*NotExpr) TypeCheck

func (expr *NotExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*NotExpr) TypedInnerExpr

func (node *NotExpr) TypedInnerExpr() TypedExpr

TypedInnerExpr returns the NotExpr's inner expression as a TypedExpr.

func (*NotExpr) Walk

func (expr *NotExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type NotNullConstraint

type NotNullConstraint struct{}

NotNullConstraint represents NOT NULL on a column.

type NullConstraint

type NullConstraint struct{}

NullConstraint represents NULL on a column.

type NullIfExpr

type NullIfExpr struct {
	Expr1 Expr
	Expr2 Expr
	// contains filtered or unexported fields
}

NullIfExpr represents a NULLIF expression.

func (*NullIfExpr) Eval

func (node *NullIfExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*NullIfExpr) Format

func (node *NullIfExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (NullIfExpr) ResolvedType

func (ta NullIfExpr) ResolvedType() *types.T

func (*NullIfExpr) String

func (node *NullIfExpr) String() string

func (*NullIfExpr) TypeCheck

func (expr *NullIfExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*NullIfExpr) Walk

func (expr *NullIfExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type Nullability

type Nullability int

Nullability represents either NULL, NOT NULL or an unspecified value (silent NULL).

const (
	NotNull Nullability = iota
	Null
	SilentNull
)

The values for NullType.

func RandomNullability

func RandomNullability(rand *rand.Rand, nullableOnly bool) Nullability

RandomNullability returns a random valid Nullability, given a random number generator, `rand`. If nullableOnly is true, the random Nullability will not be `NotNull`.

type NullsOrder

type NullsOrder int8

NullsOrder for specifying ordering of NULLs.

const (
	DefaultNullsOrder NullsOrder = iota
	NullsFirst
	NullsLast
)

Null order values.

func (NullsOrder) String

func (n NullsOrder) String() string

type NumVal

type NumVal struct {
	// contains filtered or unexported fields
}

NumVal represents a constant numeric value.

func NewNumVal

func NewNumVal(value constant.Value, origString string, negative bool) *NumVal

NewNumVal constructs a new NumVal instance. This is used during parsing and in tests.

func (*NumVal) AsConstantInt

func (expr *NumVal) AsConstantInt() (constant.Value, bool)

AsConstantInt returns the value as an constant.Int if possible, along with a flag indicating whether the conversion was possible. The result contains the proper sign as per expr.negative.

func (*NumVal) AsConstantValue

func (expr *NumVal) AsConstantValue() constant.Value

AsConstantValue returns the value as a constant numerical value, with the proper sign as given by expr.negative.

func (*NumVal) AsInt32

func (expr *NumVal) AsInt32() (int32, error)

AsInt32 returns the value as 32-bit integer if possible, or returns an error if not possible. The method will set expr.resInt32 to the value of this int32 if it is successful, avoiding the need to call the method again.

func (*NumVal) AsInt64

func (expr *NumVal) AsInt64() (int64, error)

AsInt64 returns the value as a 64-bit integer if possible, or returns an error if not possible. The method will set expr.resInt64 to the value of this int64 if it is successful, avoiding the need to call the method again.

func (*NumVal) AvailableTypes

func (expr *NumVal) AvailableTypes() []*types.T

AvailableTypes implements the Constant interface.

func (*NumVal) DesirableTypes

func (expr *NumVal) DesirableTypes() []*types.T

DesirableTypes implements the Constant interface.

func (*NumVal) ExactString

func (expr *NumVal) ExactString() string

ExactString implements the constant.Value interface.

func (*NumVal) Format

func (expr *NumVal) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*NumVal) Kind

func (expr *NumVal) Kind() constant.Kind

Kind implements the constant.Value interface.

func (*NumVal) Negate

func (expr *NumVal) Negate()

Negate sets the negative field to the opposite of its current value. The parser calls this to simplify unary negation expressions.

func (*NumVal) OrigString

func (expr *NumVal) OrigString() string

OrigString returns the origString field.

func (*NumVal) ResolveAsType

func (expr *NumVal) ResolveAsType(
	ctx context.Context, semaCtx *SemaContext, typ *types.T,
) (TypedExpr, error)

ResolveAsType implements the Constant interface.

func (*NumVal) SetNegative

func (expr *NumVal) SetNegative()

SetNegative sets the negative field to true. The parser calls this when it identifies a negative constant.

func (*NumVal) ShouldBeInt64

func (expr *NumVal) ShouldBeInt64() bool

ShouldBeInt64 checks if the value naturally is an int64:

1   = yes
1.0 = no
1.1 = no
123...overflow...456 = no

func (*NumVal) String

func (node *NumVal) String() string

func (*NumVal) TypeCheck

func (expr *NumVal) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*NumVal) Walk

func (expr *NumVal) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type OIDTypeReference

type OIDTypeReference struct {
	OID oid.Oid
}

OIDTypeReference is a reference to a type directly by its stable ID.

func (*OIDTypeReference) SQLString

func (node *OIDTypeReference) SQLString() string

SQLString implements the ResolvableTypeReference interface.

type ObjectLookupFlags

type ObjectLookupFlags struct {
	// Required specifies that the lookup will return an error if the item is
	// not found.
	Required bool
	// RequireMutable specifies whether to return a mutable descriptor.
	RequireMutable bool
	// AssertNotLeased, if set, avoid the leased (possibly stale) version of the
	// descriptor. It must be set when callers want consistent reads.
	AssertNotLeased bool
	// IncludeOffline specifies if offline descriptors should be visible.
	IncludeOffline bool
	// AllowWithoutPrimaryKey specifies if tables without PKs can be resolved.
	AllowWithoutPrimaryKey bool
	// Control what type of object is being requested.
	DesiredObjectKind DesiredObjectKind
	// Control what kind of table object is being requested. This field is
	// only respected when DesiredObjectKind is TableObject.
	DesiredTableDescKind RequiredTableKind
}

ObjectLookupFlags is the flag struct suitable for GetObjectByName().

type ObjectName

type ObjectName interface {
	NodeFormatter
	Object() string
	Schema() string
	Catalog() string
	FQString() string
	// contains filtered or unexported methods
}

ObjectName is a common interface for qualified object names.

type ObjectNamePrefix

type ObjectNamePrefix struct {
	CatalogName Name
	SchemaName  Name

	// ExplicitCatalog is true iff the catalog was explicitly specified
	// or it needs to be rendered during pretty-printing.
	ExplicitCatalog bool
	// ExplicitSchema is true iff the schema was explicitly specified
	// or it needs to be rendered during pretty-printing.
	ExplicitSchema bool
}

ObjectNamePrefix corresponds to the path prefix of an object name.

func (*ObjectNamePrefix) Catalog

func (tp *ObjectNamePrefix) Catalog() string

Catalog retrieves the unqualified catalog name.

func (*ObjectNamePrefix) Format

func (tp *ObjectNamePrefix) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ObjectNamePrefix) Schema

func (tp *ObjectNamePrefix) Schema() string

Schema retrieves the unqualified schema name.

func (*ObjectNamePrefix) String

func (tp *ObjectNamePrefix) String() string

type ObjectNamePrefixList

type ObjectNamePrefixList []ObjectNamePrefix

ObjectNamePrefixList is a list of ObjectNamePrefix

func (ObjectNamePrefixList) Format

func (tp ObjectNamePrefixList) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type ObserverStatement

type ObserverStatement interface {
	// contains filtered or unexported methods
}

ObserverStatement is a marker interface for statements which are allowed to run regardless of the current transaction state: statements other than rollback are generally rejected if the session is in a failed transaction state, but it's convenient to allow some statements (e.g. "show syntax; set tracing"). Such statements are not expected to modify the database, the transaction or session state (other than special cases such as enabling/disabling tracing).

These statements short-circuit the regular execution - they don't get planned (there are no corresponding planNodes). The connExecutor recognizes them and handles them.

type OnConflict

type OnConflict struct {
	// At most one of Columns and Constraint will be set at once.
	// Columns is the list of arbiter columns, if set, that the user specified
	// in the ON CONFLICT (columns) list.
	Columns NameList
	// Constraint is the name of a table constraint that the user specified to
	// get the list of arbiter columns from, in the ON CONFLICT ON CONSTRAINT
	// form.
	Constraint       Name
	ArbiterPredicate Expr
	Exprs            UpdateExprs
	Where            *Where
	DoNothing        bool
}

OnConflict represents an `ON CONFLICT (columns) WHERE arbiter DO UPDATE SET exprs WHERE where` clause.

The zero value for OnConflict is used to signal the UPSERT short form, which uses the primary key for as the conflict index and the values being inserted for Exprs.

func (*OnConflict) IsUpsertAlias

func (oc *OnConflict) IsUpsertAlias() bool

IsUpsertAlias returns true if the UPSERT syntactic sugar was used.

type OnJoinCond

type OnJoinCond struct {
	Expr Expr
}

OnJoinCond represents an ON join condition.

func (*OnJoinCond) Format

func (node *OnJoinCond) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type OpEvaluator

type OpEvaluator interface {
	UnaryOpEvaluator
	BinaryOpEvaluator
}

OpEvaluator is an evaluator for UnaryEvalOp and BinaryEvalOp operations.

type Operator

type Operator interface {
	Operator()
}

Operator is used to identify Operators; used in sql.y.

type OrExpr

type OrExpr struct {
	Left, Right Expr
	// contains filtered or unexported fields
}

OrExpr represents an OR expression.

func NewTypedOrExpr

func NewTypedOrExpr(left, right TypedExpr) *OrExpr

NewTypedOrExpr returns a new OrExpr that is verified to be well-typed.

func (*OrExpr) Eval

func (node *OrExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*OrExpr) Format

func (node *OrExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (OrExpr) ResolvedType

func (ta OrExpr) ResolvedType() *types.T

func (*OrExpr) String

func (node *OrExpr) String() string

func (*OrExpr) TypeCheck

func (expr *OrExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*OrExpr) TypedLeft

func (node *OrExpr) TypedLeft() TypedExpr

TypedLeft returns the OrExpr's left expression as a TypedExpr.

func (*OrExpr) TypedRight

func (node *OrExpr) TypedRight() TypedExpr

TypedRight returns the OrExpr's right expression as a TypedExpr.

func (*OrExpr) Walk

func (expr *OrExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type Order

type Order struct {
	OrderType  OrderType
	Expr       Expr
	Direction  Direction
	NullsOrder NullsOrder
	// Table/Index replaces Expr when OrderType = OrderByIndex.
	Table TableName
	// If Index is empty, then the order should use the primary key.
	Index UnrestrictedName
}

Order represents an ordering expression.

func (*Order) Equal

func (node *Order) Equal(other *Order) bool

Equal checks if the node ordering is equivalent to other.

func (*Order) Format

func (node *Order) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type OrderBy

type OrderBy []*Order

OrderBy represents an ORDER BY clause.

func (*OrderBy) Format

func (node *OrderBy) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type OrderType

type OrderType int

OrderType indicates which type of expression is used in ORDER BY.

const (
	// OrderByColumn is the regular "by expression/column" ORDER BY specification.
	OrderByColumn OrderType = iota
	// OrderByIndex enables the user to specify a given index' columns implicitly.
	OrderByIndex
)

type OverlapsArrayOp

type OverlapsArrayOp struct{}

OverlapsArrayOp is a BinaryEvalOp.

func (*OverlapsArrayOp) Eval

func (op *OverlapsArrayOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type OverlapsINetOp

type OverlapsINetOp struct{}

OverlapsINetOp is a BinaryEvalOp.

func (*OverlapsINetOp) Eval

func (op *OverlapsINetOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type Overload

type Overload struct {
	Types      TypeList
	ReturnType ReturnTyper
	Volatility volatility.V

	// PreferredOverload determines overload resolution as follows.
	// When multiple overloads are eligible based on types even after all of of
	// the heuristics to pick one have been used, if one of the overloads is a
	// Overload with the `PreferredOverload` flag set to true it can be selected
	// rather than returning a no-such-method error.
	// This should generally be avoided -- avoiding introducing ambiguous
	// overloads in the first place is a much better solution -- and only done
	// after consultation with @knz @nvanbenschoten.
	PreferredOverload bool

	// Info is a description of the function, which is surfaced on the CockroachDB
	// docs site on the "Functions and Operators" page. Descriptions typically use
	// third-person with the function as an implicit subject (e.g. "Calculates
	// infinity"), but should focus more on ease of understanding so other structures
	// might be more appropriate.
	Info string

	AggregateFunc AggregateOverload
	WindowFunc    WindowOverload

	// Class is the kind of built-in function (normal/aggregate/window/etc.)
	Class FunctionClass

	// Fn is the normal builtin implementation function. It's for functions that
	// take in Datums and return a Datum.
	//
	// The opaque wrapper needs to be type asserted into eval.FnOverload.
	Fn FnOverload

	// FnWithExprs is for builtins that need access to their arguments as Exprs
	// and not pre-evaluated Datums, but is otherwise identical to Fn.
	FnWithExprs FnWithExprsOverload

	// Generator is for SRFs. SRFs take Datums and return multiple rows of Datums.
	Generator GeneratorOverload

	// GeneratorWithExprs is for SRFs that need access to their arguments as Exprs
	// and not pre-evaluated Datums, but is otherwise identical to Generator.
	GeneratorWithExprs GeneratorWithExprsOverload

	// SQLFn must be set for overloads of type SQLClass. It should return a SQL
	// statement which will be executed as a common table expression in the query.
	SQLFn SQLFnOverload

	// OnTypeCheck is called every time this overload is type checked.
	// This is a pointer so that it can be set in a builtinsregistry hook, which
	// gets a copy of the overload struct.
	OnTypeCheck *func()

	// SpecializedVecBuiltin is used to let the vectorized engine
	// know when an Overload has a specialized vectorized operator.
	SpecializedVecBuiltin SpecializedVectorizedBuiltin

	// IgnoreVolatilityCheck ignores checking the functions overload's
	// Volatility against Postgres's Volatility at test time.
	// This should be used with caution.
	IgnoreVolatilityCheck bool

	// Oid is the cached oidHasher.BuiltinOid result for this Overload. It's
	// populated at init-time.
	Oid oid.Oid

	// DistsqlBlocklist is set to true when a function cannot be evaluated in
	// DistSQL. One example is when the type information for function arguments
	// cannot be recovered.
	DistsqlBlocklist bool

	// CalledOnNullInput is set to true when a function is called when any of
	// its inputs are NULL. When true, the function implementation must be able
	// to handle NULL arguments.
	//
	// When set to false, the function will directly result in NULL in the
	// presence of any NULL arguments without evaluating the function's
	// implementation. Therefore, if the function is expected to produce
	// side-effects with a NULL argument, CalledOnNullInput must be true. Note
	// that if this behavior changes so that CalledOnNullInput=false functions
	// can produce side-effects, the FoldFunctionWithNullArg optimizer rule must
	// be changed to avoid folding those functions.
	//
	// NOTE: when set, a function should be prepared for any of its arguments to
	// be NULL and should act accordingly.
	CalledOnNullInput bool

	// FunctionProperties are the properties of this overload.
	FunctionProperties

	// Type indicates if the overload represents a built-in function, a
	// user-defined function, or a user-define procedure.
	Type RoutineType
	// Body is the SQL string body of a function. It can be set even if Type is
	// BuiltinRoutine if a builtin function is defined using a SQL string.
	Body string
	// UDFContainsOnlySignature is only set to true for Overload signatures cached
	// in a Schema descriptor, which means that the full UDF descriptor need to be
	// fetched to get more info, e.g. function Body.
	UDFContainsOnlySignature bool
	// ReturnSet is set to true when a user-defined function is defined to return
	// a set of values.
	ReturnSet bool
	// Version is the descriptor version of the descriptor used to construct
	// this version of the function overload. Only used for UDFs.
	Version uint64
	// Language is the function language that was used to define the UDF.
	// This is currently either SQL or PL/pgSQL.
	Language RoutineLanguage
}

Overload is one of the overloads of a built-in function. Each FunctionDefinition may contain one or more overloads.

func (Overload) FixedReturnType

func (b Overload) FixedReturnType() *types.T

FixedReturnType returns a fixed type that the function returns, returning Any if the return type is based on the function's arguments.

func (Overload) HasSQLBody

func (b Overload) HasSQLBody() bool

HasSQLBody returns true if the function was defined using a SQL string body. This is the case for user-defined functions and some builtins.

func (Overload) InferReturnTypeFromInputArgTypes

func (b Overload) InferReturnTypeFromInputArgTypes(inputTypes []*types.T) *types.T

InferReturnTypeFromInputArgTypes returns the type that the function returns, inferring the type based on the function's inputTypes if necessary.

func (Overload) IsGenerator

func (b Overload) IsGenerator() bool

IsGenerator returns true if the function is a set returning function (SRF).

func (Overload) Signature

func (b Overload) Signature(simplify bool) string

Signature returns a human-readable signature. If simplify is bool, tuple-returning functions with just 1 tuple element unwrap the return type in the signature.

type ParamType

type ParamType struct {
	Name string
	Typ  *types.T
}

ParamType encapsulate a function parameter name and type.

type ParamTypes

type ParamTypes []ParamType

ParamTypes is a list of function parameter names and their types.

func (ParamTypes) GetAt

func (p ParamTypes) GetAt(i int) *types.T

GetAt is part of the TypeList interface.

func (ParamTypes) Length

func (p ParamTypes) Length() int

Length is part of the TypeList interface.

func (ParamTypes) Match

func (p ParamTypes) Match(types []*types.T) bool

Match is part of the TypeList interface.

func (ParamTypes) MatchAt

func (p ParamTypes) MatchAt(typ *types.T, i int) bool

MatchAt is part of the TypeList interface.

func (ParamTypes) MatchAtIdentical

func (p ParamTypes) MatchAtIdentical(typ *types.T, i int) bool

MatchAtIdentical is part of the TypeList interface.

func (ParamTypes) MatchIdentical

func (p ParamTypes) MatchIdentical(types []*types.T) bool

MatchIdentical is part of the TypeList interface.

func (ParamTypes) MatchLen

func (p ParamTypes) MatchLen(l int) bool

MatchLen is part of the TypeList interface.

func (ParamTypes) SetAt

func (p ParamTypes) SetAt(i int, name string, t *types.T)

SetAt is part of the TypeList interface.

func (ParamTypes) String

func (p ParamTypes) String() string

func (ParamTypes) Types

func (p ParamTypes) Types() []*types.T

Types is part of the TypeList interface.

type ParenExpr

type ParenExpr struct {
	Expr Expr
	// contains filtered or unexported fields
}

ParenExpr represents a parenthesized expression.

func (*ParenExpr) Eval

func (node *ParenExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*ParenExpr) Format

func (node *ParenExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (ParenExpr) ResolvedType

func (ta ParenExpr) ResolvedType() *types.T

func (*ParenExpr) String

func (node *ParenExpr) String() string

func (*ParenExpr) TypeCheck

func (expr *ParenExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*ParenExpr) TypedInnerExpr

func (node *ParenExpr) TypedInnerExpr() TypedExpr

TypedInnerExpr returns the ParenExpr's inner expression as a TypedExpr.

func (*ParenExpr) Walk

func (expr *ParenExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type ParenSelect

type ParenSelect struct {
	Select *Select
}

ParenSelect represents a parenthesized SELECT/UNION/VALUES statement.

func (*ParenSelect) Format

func (node *ParenSelect) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ParenSelect) StatementReturnType

func (*ParenSelect) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ParenSelect) StatementTag

func (*ParenSelect) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ParenSelect) StatementType

func (*ParenSelect) StatementType() StatementType

StatementType implements the Statement interface.

func (*ParenSelect) String

func (n *ParenSelect) String() string

type ParenTableExpr

type ParenTableExpr struct {
	Expr TableExpr
}

ParenTableExpr represents a parenthesized TableExpr.

func (*ParenTableExpr) Format

func (node *ParenTableExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ParenTableExpr) String

func (node *ParenTableExpr) String() string

func (*ParenTableExpr) WalkTableExpr

func (expr *ParenTableExpr) WalkTableExpr(v Visitor) TableExpr

WalkTableExpr implements the TableExpr interface.

type ParseContext

type ParseContext interface {
	// GetRelativeParseTime returns the transaction time in the session's
	// timezone (i.e. now()). This is used to calculate relative dates,
	// like "tomorrow", and also provides a default time.Location for
	// parsed times.
	GetRelativeParseTime() time.Time
	// GetCollationEnv returns the collation environment.
	GetCollationEnv() *CollationEnvironment
	// GetIntervalStyle returns the interval style in the session.
	GetIntervalStyle() duration.IntervalStyle
	// GetDateStyle returns the date style in the session.
	GetDateStyle() pgdate.DateStyle
	// GetParseHelper returns a helper to optmize date parsing.
	GetDateHelper() *pgdate.ParseHelper
}

ParseContext provides the information necessary for parsing dates. A nil value is generally acceptable and will result in reasonable defaults being applied.

func NewParseContext

func NewParseContext(relativeParseTime time.Time, opts ...NewParseContextOption) ParseContext

NewParseContext constructs a ParseContext that returns the given values.

type PartitionBy

type PartitionBy struct {
	Fields NameList
	// Exactly one of List or Range is required to be non-empty.
	List  []ListPartition
	Range []RangePartition
}

PartitionBy represents an PARTITION BY definition within a CREATE/ALTER TABLE/INDEX statement or within a subpartition statement. This is wrapped by top level PartitionByTable/PartitionByIndex structs for table and index definitions respectively.

func (*PartitionBy) Format

func (node *PartitionBy) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type PartitionByIndex

type PartitionByIndex struct {
	*PartitionBy
}

PartitionByIndex represents a PARTITION BY definition within a CREATE/ALTER INDEX statement.

func (*PartitionByIndex) ContainsPartitioningClause

func (node *PartitionByIndex) ContainsPartitioningClause() bool

ContainsPartitioningClause determines if the partition by table contains a partitioning clause, including PARTITION BY NOTHING.

func (*PartitionByIndex) ContainsPartitions

func (node *PartitionByIndex) ContainsPartitions() bool

ContainsPartitions determines if the partition by table contains a partition clause which is not PARTITION BY NOTHING.

type PartitionByTable

type PartitionByTable struct {
	// All denotes PARTITION ALL BY.
	All bool

	*PartitionBy
}

PartitionByTable represents a PARTITION [ALL] BY definition within a CREATE/ALTER TABLE statement.

func (*PartitionByTable) ContainsPartitioningClause

func (node *PartitionByTable) ContainsPartitioningClause() bool

ContainsPartitioningClause determines if the partition by table contains a partitioning clause, including PARTITION BY NOTHING.

func (*PartitionByTable) ContainsPartitions

func (node *PartitionByTable) ContainsPartitions() bool

ContainsPartitions determines if the partition by table contains a partition clause which is not PARTITION BY NOTHING.

func (*PartitionByTable) Format

func (node *PartitionByTable) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type PartitionByType

type PartitionByType string

PartitionByType is an enum of each type of partitioning (LIST/RANGE).

const (
	// PartitionByList indicates a PARTITION BY LIST clause.
	PartitionByList PartitionByType = "LIST"
	// PartitionByRange indicates a PARTITION BY LIST clause.
	PartitionByRange PartitionByType = "RANGE"
)

type PartitionMaxVal

type PartitionMaxVal struct{}

PartitionMaxVal represents the MAXVALUE expression.

func (PartitionMaxVal) Format

func (node PartitionMaxVal) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (PartitionMaxVal) String

func (node PartitionMaxVal) String() string

func (PartitionMaxVal) TypeCheck

func (expr PartitionMaxVal) TypeCheck(
	_ context.Context, _ *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (PartitionMaxVal) Walk

func (expr PartitionMaxVal) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type PartitionMinVal

type PartitionMinVal struct{}

PartitionMinVal represents the MINVALUE expression.

func (PartitionMinVal) Format

func (node PartitionMinVal) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (PartitionMinVal) String

func (node PartitionMinVal) String() string

func (PartitionMinVal) TypeCheck

func (expr PartitionMinVal) TypeCheck(
	_ context.Context, _ *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (PartitionMinVal) Walk

func (expr PartitionMinVal) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type Persistence

type Persistence int

Persistence defines the persistence strategy for a given table.

const (
	// PersistencePermanent indicates a permanent table.
	PersistencePermanent Persistence = iota
	// PersistenceTemporary indicates a temporary table.
	PersistenceTemporary
	// PersistenceUnlogged indicates an unlogged table.
	// Note this state is not persisted on disk and is used at parse time only.
	PersistenceUnlogged
)

func (Persistence) IsTemporary

func (p Persistence) IsTemporary() bool

IsTemporary returns whether the Persistence value is Temporary.

func (Persistence) IsUnlogged

func (p Persistence) IsUnlogged() bool

IsUnlogged returns whether the Persistence value is Unlogged.

type Placeholder

type Placeholder struct {
	Idx PlaceholderIdx
	// contains filtered or unexported fields
}

Placeholder represents a named placeholder.

func NewPlaceholder

func NewPlaceholder(name string) (*Placeholder, error)

NewPlaceholder allocates a Placeholder.

func (*Placeholder) AmbiguousFormat

func (d *Placeholder) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*Placeholder) Compare

func (d *Placeholder) Compare(ctx CompareContext, other Datum) int

Compare implements the Datum interface.

func (*Placeholder) CompareError

func (d *Placeholder) CompareError(ctx CompareContext, other Datum) (int, error)

CompareError implements the Datum interface.

func (*Placeholder) Eval

func (node *Placeholder) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*Placeholder) Format

func (node *Placeholder) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Placeholder) IsMax

func (d *Placeholder) IsMax(ctx CompareContext) bool

IsMax implements the Datum interface.

func (*Placeholder) IsMin

func (d *Placeholder) IsMin(ctx CompareContext) bool

IsMin implements the Datum interface.

func (*Placeholder) Max

func (d *Placeholder) Max(ctx CompareContext) (Datum, bool)

Max implements the Datum interface.

func (*Placeholder) Min

func (d *Placeholder) Min(ctx CompareContext) (Datum, bool)

Min implements the Datum interface.

func (*Placeholder) Next

func (d *Placeholder) Next(ctx CompareContext) (Datum, bool)

Next implements the Datum interface.

func (*Placeholder) Prev

func (d *Placeholder) Prev(ctx CompareContext) (Datum, bool)

Prev implements the Datum interface.

func (*Placeholder) ResolvedType

func (node *Placeholder) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*Placeholder) Size

func (d *Placeholder) Size() uintptr

Size implements the Datum interface.

func (*Placeholder) String

func (node *Placeholder) String() string

func (*Placeholder) TypeCheck

func (expr *Placeholder) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*Placeholder) Walk

func (expr *Placeholder) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type PlaceholderIdx

type PlaceholderIdx uint16

PlaceholderIdx is the 0-based index of a placeholder. Placeholder "$1" has PlaceholderIdx=0.

func (PlaceholderIdx) String

func (idx PlaceholderIdx) String() string

String returns the index as a placeholder string representation ($1, $2 etc).

type PlaceholderInfo

type PlaceholderInfo struct {
	PlaceholderTypesInfo

	Values QueryArguments
}

PlaceholderInfo defines the interface to SQL placeholders.

func (*PlaceholderInfo) Assign

func (p *PlaceholderInfo) Assign(src *PlaceholderInfo, numPlaceholders int) error

Assign resets the PlaceholderInfo to the contents of src. If src is nil, a new structure is initialized.

func (*PlaceholderInfo) Init

func (p *PlaceholderInfo) Init(numPlaceholders int, typeHints PlaceholderTypes) error

Init initializes a PlaceholderInfo structure appropriate for the given number of placeholders, and with the given (optional) type hints.

func (*PlaceholderInfo) IsUnresolvedPlaceholder

func (p *PlaceholderInfo) IsUnresolvedPlaceholder(expr Expr) bool

IsUnresolvedPlaceholder returns whether expr is an unresolved placeholder. In other words, it returns whether the provided expression is a placeholder expression or a placeholder expression within nested parentheses, and if so, whether the placeholder's type remains unset in the PlaceholderInfo.

func (*PlaceholderInfo) MaybeExtendTypes

func (p *PlaceholderInfo) MaybeExtendTypes()

MaybeExtendTypes is to fill the nil types with the type hints, if exists.

func (*PlaceholderInfo) Value

func (p *PlaceholderInfo) Value(idx PlaceholderIdx) (TypedExpr, bool)

Value returns the known value of a placeholder. Returns false in the 2nd value if the placeholder does not have a value.

type PlaceholderTypes

type PlaceholderTypes []*types.T

PlaceholderTypes stores placeholder types (or type hints), one per PlaceholderIdx. The slice is always pre-allocated to the number of placeholders in the statement. Entries that don't yet have a type are nil.

func (PlaceholderTypes) AssertAllSet

func (pt PlaceholderTypes) AssertAllSet() error

AssertAllSet verifies that all types have been set and returns an error otherwise.

func (PlaceholderTypes) Identical

func (pt PlaceholderTypes) Identical(other PlaceholderTypes) bool

Identical returns true if two PlaceholderTypes contain the same types.

type PlaceholderTypesInfo

type PlaceholderTypesInfo struct {
	// TypeHints contains the initially set type hints for each placeholder if
	// present. It is not changed during query type checking.
	TypeHints PlaceholderTypes
	// Types contains the final types set for each placeholder after type
	// checking.
	Types PlaceholderTypes
}

PlaceholderTypesInfo encapsulates typing information for placeholders.

func (*PlaceholderTypesInfo) SetType

func (p *PlaceholderTypesInfo) SetType(idx PlaceholderIdx, typ *types.T) error

SetType assigns a known type to a placeholder. Reports an error if another type was previously assigned.

func (*PlaceholderTypesInfo) Type

func (p *PlaceholderTypesInfo) Type(idx PlaceholderIdx) (_ *types.T, ok bool, _ error)

Type returns the known type of a placeholder. If there is no known type yet but there is a type hint, returns the type hint.

func (*PlaceholderTypesInfo) ValueType

func (p *PlaceholderTypesInfo) ValueType(idx PlaceholderIdx) (_ *types.T, ok bool)

ValueType returns the type of the value that must be supplied for a placeholder. This is the type hint given by the client if there is one, or the placeholder type if there isn't one. This can differ from Type(idx) when a client hint is overridden (see Placeholder.Eval).

type PlusDateIntOp

type PlusDateIntOp struct{}

PlusDateIntOp is a BinaryEvalOp.

func (*PlusDateIntOp) Eval

func (op *PlusDateIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusDateIntervalOp

type PlusDateIntervalOp struct{}

PlusDateIntervalOp is a BinaryEvalOp.

func (*PlusDateIntervalOp) Eval

func (op *PlusDateIntervalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusDateTimeOp

type PlusDateTimeOp struct{}

PlusDateTimeOp is a BinaryEvalOp.

func (*PlusDateTimeOp) Eval

func (op *PlusDateTimeOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusDateTimeTZOp

type PlusDateTimeTZOp struct{}

PlusDateTimeTZOp is a BinaryEvalOp.

func (*PlusDateTimeTZOp) Eval

func (op *PlusDateTimeTZOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusDecimalIntOp

type PlusDecimalIntOp struct{}

PlusDecimalIntOp is a BinaryEvalOp.

func (*PlusDecimalIntOp) Eval

func (op *PlusDecimalIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusDecimalOp

type PlusDecimalOp struct{}

PlusDecimalOp is a BinaryEvalOp.

func (*PlusDecimalOp) Eval

func (op *PlusDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusDecimalPGLSNOp

type PlusDecimalPGLSNOp struct{}

PlusDecimalPGLSNOp is a BinaryEvalOp.

func (*PlusDecimalPGLSNOp) Eval

func (op *PlusDecimalPGLSNOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusFloatOp

type PlusFloatOp struct{}

PlusFloatOp is a BinaryEvalOp.

func (*PlusFloatOp) Eval

func (op *PlusFloatOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusINetIntOp

type PlusINetIntOp struct{}

PlusINetIntOp is a BinaryEvalOp.

func (*PlusINetIntOp) Eval

func (op *PlusINetIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusIntDateOp

type PlusIntDateOp struct{}

PlusIntDateOp is a BinaryEvalOp.

func (*PlusIntDateOp) Eval

func (op *PlusIntDateOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusIntDecimalOp

type PlusIntDecimalOp struct{}

PlusIntDecimalOp is a BinaryEvalOp.

func (*PlusIntDecimalOp) Eval

func (op *PlusIntDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusIntINetOp

type PlusIntINetOp struct{}

PlusIntINetOp is a BinaryEvalOp.

func (*PlusIntINetOp) Eval

func (op *PlusIntINetOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusIntOp

type PlusIntOp struct{}

PlusIntOp is a BinaryEvalOp.

func (*PlusIntOp) Eval

func (op *PlusIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusIntervalDateOp

type PlusIntervalDateOp struct{}

PlusIntervalDateOp is a BinaryEvalOp.

func (*PlusIntervalDateOp) Eval

func (op *PlusIntervalDateOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusIntervalOp

type PlusIntervalOp struct{}

PlusIntervalOp is a BinaryEvalOp.

func (*PlusIntervalOp) Eval

func (op *PlusIntervalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusIntervalTimeOp

type PlusIntervalTimeOp struct{}

PlusIntervalTimeOp is a BinaryEvalOp.

func (*PlusIntervalTimeOp) Eval

func (op *PlusIntervalTimeOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusIntervalTimeTZOp

type PlusIntervalTimeTZOp struct{}

PlusIntervalTimeTZOp is a BinaryEvalOp.

func (*PlusIntervalTimeTZOp) Eval

func (op *PlusIntervalTimeTZOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusIntervalTimestampOp

type PlusIntervalTimestampOp struct{}

PlusIntervalTimestampOp is a BinaryEvalOp.

func (*PlusIntervalTimestampOp) Eval

Eval is part of the BinaryEvalOp interface.

type PlusIntervalTimestampTZOp

type PlusIntervalTimestampTZOp struct{}

PlusIntervalTimestampTZOp is a BinaryEvalOp.

func (*PlusIntervalTimestampTZOp) Eval

Eval is part of the BinaryEvalOp interface.

type PlusPGLSNDecimalOp

type PlusPGLSNDecimalOp struct{}

PlusPGLSNDecimalOp is a BinaryEvalOp.

func (*PlusPGLSNDecimalOp) Eval

func (op *PlusPGLSNDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusTimeDateOp

type PlusTimeDateOp struct{}

PlusTimeDateOp is a BinaryEvalOp.

func (*PlusTimeDateOp) Eval

func (op *PlusTimeDateOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusTimeIntervalOp

type PlusTimeIntervalOp struct{}

PlusTimeIntervalOp is a BinaryEvalOp.

func (*PlusTimeIntervalOp) Eval

func (op *PlusTimeIntervalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusTimeTZDateOp

type PlusTimeTZDateOp struct{}

PlusTimeTZDateOp is a BinaryEvalOp.

func (*PlusTimeTZDateOp) Eval

func (op *PlusTimeTZDateOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusTimeTZIntervalOp

type PlusTimeTZIntervalOp struct{}

PlusTimeTZIntervalOp is a BinaryEvalOp.

func (*PlusTimeTZIntervalOp) Eval

func (op *PlusTimeTZIntervalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PlusTimestampIntervalOp

type PlusTimestampIntervalOp struct{}

PlusTimestampIntervalOp is a BinaryEvalOp.

func (*PlusTimestampIntervalOp) Eval

Eval is part of the BinaryEvalOp interface.

type PlusTimestampTZIntervalOp

type PlusTimestampTZIntervalOp struct{}

PlusTimestampTZIntervalOp is a BinaryEvalOp.

func (*PlusTimestampTZIntervalOp) Eval

Eval is part of the BinaryEvalOp interface.

type PowDecimalIntOp

type PowDecimalIntOp struct{}

PowDecimalIntOp is a BinaryEvalOp.

func (*PowDecimalIntOp) Eval

func (op *PowDecimalIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PowDecimalOp

type PowDecimalOp struct{}

PowDecimalOp is a BinaryEvalOp.

func (*PowDecimalOp) Eval

func (op *PowDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PowFloatOp

type PowFloatOp struct{}

PowFloatOp is a BinaryEvalOp.

func (*PowFloatOp) Eval

func (op *PowFloatOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PowIntDecimalOp

type PowIntDecimalOp struct{}

PowIntDecimalOp is a BinaryEvalOp.

func (*PowIntDecimalOp) Eval

func (op *PowIntDecimalOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type PowIntOp

type PowIntOp struct{}

PowIntOp is a BinaryEvalOp.

func (*PowIntOp) Eval

func (op *PowIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type Prepare

type Prepare struct {
	Name      Name
	Types     []ResolvableTypeReference
	Statement Statement
}

Prepare represents a PREPARE statement.

func (*Prepare) Format

func (node *Prepare) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Prepare) StatementReturnType

func (*Prepare) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Prepare) StatementTag

func (*Prepare) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Prepare) StatementType

func (*Prepare) StatementType() StatementType

StatementType implements the Statement interface.

func (*Prepare) String

func (n *Prepare) String() string

type PrependToMaybeNullArrayOp

type PrependToMaybeNullArrayOp struct {
	Typ *types.T
}

PrependToMaybeNullArrayOp is a BinaryEvalOp.

func (*PrependToMaybeNullArrayOp) Eval

Eval is part of the BinaryEvalOp interface.

type PrettyAlignMode

type PrettyAlignMode int

PrettyAlignMode directs which alignment mode to use.

TODO(knz/mjibson): this variety of options currently exists so as to enable comparisons and gauging individual preferences. We should aim to remove some or all of these options in the future.

type PrettyCfg

type PrettyCfg struct {
	// LineWidth is the desired maximum line width.
	LineWidth int
	// TabWidth is the amount of spaces to use for tabs when UseTabs is
	// false.
	TabWidth int
	// DoNotNewLineAfterColName is true if we do not new line after table column names.
	DoNotNewLineAfterColName bool
	// Align, when set to another value than PrettyNoAlign, uses
	// alignment for some constructs as a first choice. If not set or if
	// the line width is insufficient, nesting is used instead.
	Align PrettyAlignMode
	// UseTabs indicates whether to use tab chars to signal indentation.
	UseTabs bool
	// Simplify, when set, removes extraneous parentheses.
	Simplify bool
	// Case, if set, transforms case-insensitive strings (like SQL keywords).
	Case func(string) string
	// JSONFmt, when set, pretty-prints strings that are asserted or cast
	// to JSON.
	JSONFmt bool
	// ValueRedaction, when set, surrounds literal values with redaction markers.
	ValueRedaction bool
}

PrettyCfg holds configuration for pretty printing statements.

func DefaultPrettyCfg

func DefaultPrettyCfg() PrettyCfg

DefaultPrettyCfg returns a PrettyCfg with the default configuration.

func (*PrettyCfg) Doc

func (p *PrettyCfg) Doc(f NodeFormatter) pretty.Doc

Doc converts f (generally a Statement) to a pretty.Doc. If f does not have a native conversion, its .Format representation is used as a simple Text Doc.

func (*PrettyCfg) Pretty

func (p *PrettyCfg) Pretty(stmt NodeFormatter) (string, error)

Pretty pretty prints stmt with specified options.

type PrimaryKeyConstraint

type PrimaryKeyConstraint struct {
	StorageParams StorageParams
}

PrimaryKeyConstraint represents PRIMARY KEY on a column.

type QualifiedNameResolver

type QualifiedNameResolver interface {
	GetQualifiedTableNameByID(ctx context.Context, id int64, requiredType RequiredTableKind) (*TableName, error)
	GetQualifiedFunctionNameByID(ctx context.Context, id int64) (*RoutineName, error)
	CurrentDatabase() string
}

QualifiedNameResolver is the helper interface to resolve qualified table names given an ID and the required table kind, as well as the current database to determine whether or not to include the database in the qualification.

type QualifiedOverload

type QualifiedOverload struct {
	Schema string
	*Overload
}

QualifiedOverload is a wrapper of Overload prefixed with a schema name. It indicates that the overload is defined with the specified schema.

func MakeQualifiedOverload

func MakeQualifiedOverload(schema string, overload *Overload) QualifiedOverload

MakeQualifiedOverload creates a new QualifiedOverload.

type QueryArguments

type QueryArguments []TypedExpr

QueryArguments stores query arguments, one per PlaceholderIdx.

A nil value represents a NULL argument.

func (QueryArguments) String

func (qa QueryArguments) String() string

type RShiftINetOp

type RShiftINetOp struct{}

RShiftINetOp is a BinaryEvalOp.

func (*RShiftINetOp) Eval

func (op *RShiftINetOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type RShiftIntOp

type RShiftIntOp struct{}

RShiftIntOp is a BinaryEvalOp.

func (*RShiftIntOp) Eval

func (op *RShiftIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type RShiftVarBitIntOp

type RShiftVarBitIntOp struct{}

RShiftVarBitIntOp is a BinaryEvalOp.

func (*RShiftVarBitIntOp) Eval

func (op *RShiftVarBitIntOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type RangeCond

type RangeCond struct {
	Not       bool
	Symmetric bool
	Left      Expr
	From, To  Expr
	// contains filtered or unexported fields
}

RangeCond represents a BETWEEN [SYMMETRIC] or a NOT BETWEEN [SYMMETRIC] expression.

func (*RangeCond) Eval

func (node *RangeCond) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*RangeCond) Format

func (node *RangeCond) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (RangeCond) ResolvedType

func (ta RangeCond) ResolvedType() *types.T

func (*RangeCond) String

func (node *RangeCond) String() string

func (*RangeCond) TypeCheck

func (expr *RangeCond) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*RangeCond) TypedFrom

func (node *RangeCond) TypedFrom() TypedExpr

TypedFrom returns the RangeCond's from expression as a TypedExpr.

func (*RangeCond) TypedLeftFrom

func (node *RangeCond) TypedLeftFrom() TypedExpr

TypedLeftFrom returns the RangeCond's left expression as a TypedExpr, in the context of a comparison with TypedFrom().

func (*RangeCond) TypedLeftTo

func (node *RangeCond) TypedLeftTo() TypedExpr

TypedLeftTo returns the RangeCond's left expression as a TypedExpr, in the context of a comparison with TypedTo().

func (*RangeCond) TypedTo

func (node *RangeCond) TypedTo() TypedExpr

TypedTo returns the RangeCond's to expression as a TypedExpr.

func (*RangeCond) Walk

func (expr *RangeCond) Walk(v Visitor) Expr

Walk implements the Expr interface.

type RangePartition

type RangePartition struct {
	Name         Name
	From         Exprs
	To           Exprs
	Subpartition *PartitionBy
}

RangePartition represents a PARTITION definition within a PARTITION BY RANGE.

func (*RangePartition) Format

func (node *RangePartition) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type RawRows

type RawRows [][]TypedExpr

RawRows exposes a [][]TypedExpr as an ExprContainer.

func (RawRows) Get

func (r RawRows) Get(i, j int) Expr

Get implements the ExprContainer interface.

func (RawRows) NumCols

func (r RawRows) NumCols() int

NumCols implements the ExprContainer interface.

func (RawRows) NumRows

func (r RawRows) NumRows() int

NumRows implements the ExprContainer interface.

type ReadWriteMode

type ReadWriteMode int

ReadWriteMode holds the read write mode for a transaction.

const (
	UnspecifiedReadWriteMode ReadWriteMode = iota
	ReadOnly
	ReadWrite
)

ReadWriteMode values

func (ReadWriteMode) String

func (ro ReadWriteMode) String() string

type ReassignOwnedBy

type ReassignOwnedBy struct {
	OldRoles RoleSpecList
	NewRole  RoleSpec
}

ReassignOwnedBy represents a REASSIGN OWNED BY <name> TO <name> statement.

func (*ReassignOwnedBy) Format

func (node *ReassignOwnedBy) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ReassignOwnedBy) StatementReturnType

func (*ReassignOwnedBy) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ReassignOwnedBy) StatementTag

func (*ReassignOwnedBy) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ReassignOwnedBy) StatementType

func (*ReassignOwnedBy) StatementType() StatementType

StatementType implements the Statement interface.

func (*ReassignOwnedBy) String

func (n *ReassignOwnedBy) String() string

type ReferenceAction

type ReferenceAction semenumpb.ForeignKeyAction

ReferenceAction is the method used to maintain referential integrity through foreign keys.

const (
	NoAction ReferenceAction = iota
	Restrict
	SetNull
	SetDefault
	Cascade
)

The values for ReferenceAction. It has a one-to-one mapping to semenumpb.ForeignKeyAction.

func (ReferenceAction) String

func (x ReferenceAction) String() string

String implements the fmt.Stringer interface.

type ReferenceActions

type ReferenceActions struct {
	Delete ReferenceAction
	Update ReferenceAction
}

ReferenceActions contains the actions specified to maintain referential integrity through foreign keys for different operations.

func (*ReferenceActions) Format

func (node *ReferenceActions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type RefreshDataOption

type RefreshDataOption int

RefreshDataOption corresponds to arguments for the REFRESH MATERIALIZED VIEW statement.

const (
	// RefreshDataDefault refers to no option provided to the REFRESH MATERIALIZED
	// VIEW statement.
	RefreshDataDefault RefreshDataOption = iota
	// RefreshDataWithData refers to the WITH DATA option provided to the REFRESH
	// MATERIALIZED VIEW statement.
	RefreshDataWithData
	// RefreshDataClear refers to the WITH NO DATA option provided to the REFRESH
	// MATERIALIZED VIEW statement.
	RefreshDataClear
)

type RefreshMaterializedView

type RefreshMaterializedView struct {
	Name              *UnresolvedObjectName
	Concurrently      bool
	RefreshDataOption RefreshDataOption
}

RefreshMaterializedView represents a REFRESH MATERIALIZED VIEW statement.

func (*RefreshMaterializedView) Format

func (node *RefreshMaterializedView) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*RefreshMaterializedView) StatementReturnType

func (*RefreshMaterializedView) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*RefreshMaterializedView) StatementTag

func (*RefreshMaterializedView) StatementTag() string

StatementTag implements the Statement interface.

func (*RefreshMaterializedView) StatementType

func (*RefreshMaterializedView) StatementType() StatementType

StatementType implements the Statement interface.

func (*RefreshMaterializedView) String

func (n *RefreshMaterializedView) String() string

type RegexpCache

type RegexpCache struct {
	// contains filtered or unexported fields
}

A RegexpCache is a cache used to store compiled regular expressions. The cache is safe for concurrent use by multiple goroutines. It is also safe to use the cache through a nil reference, where it will act like a valid cache with no capacity.

func NewRegexpCache

func NewRegexpCache(size int) *RegexpCache

NewRegexpCache creates a new RegexpCache of the given size. The underlying cache internally uses a hash map, so lookups are cheap.

func (*RegexpCache) GetRegexp

func (rc *RegexpCache) GetRegexp(key RegexpCacheKey) (*regexp.Regexp, error)

GetRegexp consults the cache for the regular expressions stored for the given key, compiling the key's pattern if it is not already in the cache.

func (*RegexpCache) Len

func (rc *RegexpCache) Len() int

Len returns the number of compiled regular expressions in the cache.

type RegexpCacheKey

type RegexpCacheKey interface {
	Pattern() (string, error)
}

RegexpCacheKey allows cache keys to take the form of different types, as long as they are comparable and can produce a pattern when needed for regexp compilation. The pattern method will not be called until after a cache lookup is performed and the result is a miss.

type ReleaseSavepoint

type ReleaseSavepoint struct {
	Savepoint Name
}

ReleaseSavepoint represents a RELEASE SAVEPOINT <name> statement.

func (*ReleaseSavepoint) Format

func (node *ReleaseSavepoint) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ReleaseSavepoint) StatementReturnType

func (*ReleaseSavepoint) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ReleaseSavepoint) StatementTag

func (*ReleaseSavepoint) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ReleaseSavepoint) StatementType

func (*ReleaseSavepoint) StatementType() StatementType

StatementType implements the Statement interface.

func (*ReleaseSavepoint) String

func (n *ReleaseSavepoint) String() string

type Relocate

type Relocate struct {
	// TODO(a-robinson): It's not great that this can only work on ranges that
	// are part of a currently valid table or index.
	TableOrIndex TableIndexName
	// Each row contains an array with store ids and values for the columns in the
	// PK or index (or a prefix of the columns).
	// See docs/RFCS/sql_split_syntax.md.
	Rows            *Select
	SubjectReplicas RelocateSubject
}

Relocate represents an `ALTER TABLE/INDEX .. EXPERIMENTAL_RELOCATE ..` statement.

func (*Relocate) Format

func (node *Relocate) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Relocate) StatementReturnType

func (*Relocate) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Relocate) StatementTag

func (n *Relocate) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Relocate) StatementType

func (*Relocate) StatementType() StatementType

StatementType implements the Statement interface.

func (*Relocate) String

func (n *Relocate) String() string

type RelocateRange

type RelocateRange struct {
	Rows            *Select
	ToStoreID       Expr
	FromStoreID     Expr
	SubjectReplicas RelocateSubject
}

RelocateRange represents an `ALTER RANGE .. RELOCATE ..` statement.

func (*RelocateRange) Format

func (n *RelocateRange) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*RelocateRange) StatementReturnType

func (*RelocateRange) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*RelocateRange) StatementTag

func (n *RelocateRange) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*RelocateRange) StatementType

func (*RelocateRange) StatementType() StatementType

StatementType implements the Statement interface.

func (*RelocateRange) String

func (n *RelocateRange) String() string

type RelocateSubject

type RelocateSubject int8

RelocateSubject indicates what replicas of a range should be relocated.

const (
	// RelocateLease indicates that leases should be relocated.
	RelocateLease RelocateSubject = iota
	// RelocateVoters indicates what voter replicas should be relocated.
	RelocateVoters
	// RelocateNonVoters indicates that non-voter replicas should be relocated.
	RelocateNonVoters
)

func (*RelocateSubject) Format

func (n *RelocateSubject) Format(ctx *FmtCtx)

Format implementsthe NodeFormatter interface.

func (RelocateSubject) String

func (n RelocateSubject) String() string

type RenameColumn

type RenameColumn struct {
	Table   TableName
	Name    Name
	NewName Name
	// IfExists refers to the table, not the column.
	IfExists bool
}

RenameColumn represents a RENAME COLUMN statement.

func (*RenameColumn) Format

func (node *RenameColumn) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*RenameColumn) StatementReturnType

func (*RenameColumn) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*RenameColumn) StatementTag

func (*RenameColumn) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*RenameColumn) StatementType

func (*RenameColumn) StatementType() StatementType

StatementType implements the Statement interface.

func (*RenameColumn) String

func (n *RenameColumn) String() string

type RenameDatabase

type RenameDatabase struct {
	Name    Name
	NewName Name
}

RenameDatabase represents a RENAME DATABASE statement.

func (*RenameDatabase) Format

func (node *RenameDatabase) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*RenameDatabase) StatementReturnType

func (*RenameDatabase) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*RenameDatabase) StatementTag

func (*RenameDatabase) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*RenameDatabase) StatementType

func (*RenameDatabase) StatementType() StatementType

StatementType implements the Statement interface.

func (*RenameDatabase) String

func (n *RenameDatabase) String() string

type RenameIndex

type RenameIndex struct {
	Index    *TableIndexName
	NewName  UnrestrictedName
	IfExists bool
}

RenameIndex represents a RENAME INDEX statement.

func (*RenameIndex) Format

func (node *RenameIndex) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*RenameIndex) StatementReturnType

func (*RenameIndex) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*RenameIndex) StatementTag

func (*RenameIndex) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*RenameIndex) StatementType

func (*RenameIndex) StatementType() StatementType

StatementType implements the Statement interface.

func (*RenameIndex) String

func (n *RenameIndex) String() string

type RenameTable

type RenameTable struct {
	Name           *UnresolvedObjectName
	NewName        *UnresolvedObjectName
	IfExists       bool
	IsView         bool
	IsMaterialized bool
	IsSequence     bool
}

RenameTable represents a RENAME TABLE or RENAME VIEW or RENAME SEQUENCE statement. Whether the user has asked to rename a view or a sequence is indicated by the IsView and IsSequence fields.

func (*RenameTable) Format

func (node *RenameTable) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*RenameTable) StatementReturnType

func (*RenameTable) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*RenameTable) StatementTag

func (n *RenameTable) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*RenameTable) StatementType

func (*RenameTable) StatementType() StatementType

StatementType implements the Statement interface.

func (*RenameTable) String

func (n *RenameTable) String() string

type ReparentDatabase

type ReparentDatabase struct {
	Name   Name
	Parent Name
}

ReparentDatabase represents a database reparenting as a schema operation.

func (*ReparentDatabase) Format

func (node *ReparentDatabase) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ReparentDatabase) StatementReturnType

func (*ReparentDatabase) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ReparentDatabase) StatementTag

func (*ReparentDatabase) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ReparentDatabase) StatementType

func (*ReparentDatabase) StatementType() StatementType

StatementType implements the Statement interface.

func (*ReparentDatabase) String

func (n *ReparentDatabase) String() string

type ReplicationCutoverTime

type ReplicationCutoverTime struct {
	Timestamp Expr
	Latest    bool
}

ReplicationCutoverTime represent the user-specified cutover time

type RequiredTableKind

type RequiredTableKind byte

RequiredTableKind controls what kind of TableDescriptor backed object is requested to be resolved.

const (
	ResolveAnyTableKind RequiredTableKind = iota
	ResolveRequireTableDesc
	ResolveRequireViewDesc
	ResolveRequireTableOrViewDesc
	ResolveRequireSequenceDesc
)

RequiredTableKind options have descriptive names.

func (RequiredTableKind) String

func (r RequiredTableKind) String() string

type ResolvableFunctionReference

type ResolvableFunctionReference struct {
	// ReferenceByName keeps track of the name that was used to resolve the
	// function, if one was used. This is used for metadata dependency tracking.
	ReferenceByName *UnresolvedObjectName
	FunctionReference
}

ResolvableFunctionReference implements the editable reference call of a FuncExpr.

func WrapFunction

func WrapFunction(n string) ResolvableFunctionReference

WrapFunction creates a new ResolvableFunctionReference holding a pre-resolved function from a built-in function name. Helper for grammar rules and execbuilder.

TODO(Chengxiong): get rid of FunctionDefinition entirely and use ResolvedFunctionDefinition instead.

func (*ResolvableFunctionReference) Resolve

Resolve converts a ResolvableFunctionReference into a *FunctionDefinition. If the reference has already been resolved, it simply returns the definition. If a FunctionReferenceResolver is provided, it will be used to resolve the function definition. Otherwise, the default resolution of UnresolvedName.ResolveFunction is used.

type ResolvableTypeReference

type ResolvableTypeReference interface {
	SQLString() string
}

ResolvableTypeReference represents a type that is possibly unknown until type-checking/type name resolution is performed. N.B. ResolvableTypeReferences in expressions must be formatted with FormatTypeReference instead of SQLString.

type ResolvedFunctionDefinition

type ResolvedFunctionDefinition struct {
	// Name is the name of the function and not the name of the schema. And, it's
	// not qualified.
	Name string

	Overloads []QualifiedOverload
}

ResolvedFunctionDefinition is similar to FunctionDefinition but with all the overloads qualified with schema name.

func GetBuiltinFuncDefinition

func GetBuiltinFuncDefinition(
	fName RoutineName, searchPath SearchPath,
) (*ResolvedFunctionDefinition, error)

GetBuiltinFuncDefinition search for a builtin function given a function name and a search path. If function name is prefixed, only the builtin functions in the specific schema are searched. Otherwise, all schemas on the given searchPath are searched. A nil is returned if no function is found. It's caller's choice to error out if function not found.

In theory, this function returns an error only when the search path iterator errors which won't happen since the iterating function never errors out. But error is still checked and return from the function signature just in case we change the iterating function in the future.

func GetBuiltinFuncDefinitionOrFail

func GetBuiltinFuncDefinitionOrFail(
	fName RoutineName, searchPath SearchPath,
) (*ResolvedFunctionDefinition, error)

GetBuiltinFuncDefinitionOrFail is similar to GetBuiltinFuncDefinition but returns an error if function is not found.

func GetBuiltinFunctionByOIDOrFail

func GetBuiltinFunctionByOIDOrFail(oid oid.Oid) (*ResolvedFunctionDefinition, error)

GetBuiltinFunctionByOIDOrFail retrieves a builtin function by OID.

func QualifyBuiltinFunctionDefinition

func QualifyBuiltinFunctionDefinition(
	def *FunctionDefinition, schema string,
) *ResolvedFunctionDefinition

QualifyBuiltinFunctionDefinition qualified all overloads in a function definition with a schema name. Note that this function can only be used for builtin function.

func (*ResolvedFunctionDefinition) Format

func (fd *ResolvedFunctionDefinition) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface. ResolvedFunctionDefinitions should always be builtin functions, so we do not need to anonymize them, even if the flag is set.

func (*ResolvedFunctionDefinition) GetClass

GetClass returns function class by checking each overload's Class and returns the homogeneous Class value if all overloads are the same Class. Ambiguous error is returned if there is any overload with different Class.

TODO(chengxiong,mgartner): make sure that, at places of the use cases of this method, function is resolved to one overload, so that we can get rid of this function and similar methods below.

func (*ResolvedFunctionDefinition) GetHasSequenceArguments

func (fd *ResolvedFunctionDefinition) GetHasSequenceArguments() (bool, error)

GetHasSequenceArguments returns function's HasSequenceArguments flag by checking each overload's HasSequenceArguments flag. Ambiguous error is returned if there is any overload has a different flag.

func (*ResolvedFunctionDefinition) GetReturnLabel

func (fd *ResolvedFunctionDefinition) GetReturnLabel() ([]string, error)

GetReturnLabel returns function ReturnLabel by checking each overload and returns a ReturnLabel if all overloads have a ReturnLabel of the same length. Ambiguous error is returned if there is any overload has ReturnLabel of a different length. This is good enough since we don't create UDF with ReturnLabel.

func (*ResolvedFunctionDefinition) MatchOverload

func (fd *ResolvedFunctionDefinition) MatchOverload(
	paramTypes []*types.T, explicitSchema string, searchPath SearchPath, routineType RoutineType,
) (QualifiedOverload, error)

MatchOverload searches an overload which has exactly the same parameter types. The overload from the most significant schema is returned. If paramTypes==nil, an error is returned if the function name is not unique in the most significant schema. If paramTypes is not nil, an error with ErrRoutineUndefined cause is returned if not matched found. Overloads that don't match the types in routineType are ignored.

func (*ResolvedFunctionDefinition) MergeWith

MergeWith is used to merge two UDF definitions with same name.

func (*ResolvedFunctionDefinition) String

func (fd *ResolvedFunctionDefinition) String() string

String implements the Stringer interface.

type Restore

type Restore struct {
	Targets            BackupTargetList
	DescriptorCoverage DescriptorCoverage

	// From contains the URIs for the backup(s) we seek to restore.
	//   - len(From)>1 implies the user explicitly passed incremental backup paths,
	//     which is only allowed using the old syntax, `RESTORE <targets> FROM <destination>.
	//     In this case, From[0] contains the URI(s) for the full backup.
	//   - len(From)==1 implies we'll have to look for incremental backups in planning
	//   - len(From[0]) > 1 implies the backups are locality aware
	//   - From[i][0] must be the default locality.
	From    []StringOrPlaceholderOptList
	AsOf    AsOfClause
	Options RestoreOptions

	// Subdir may be set by the parser when the SQL query is of the form `RESTORE
	// ... FROM 'from' IN 'subdir'...`. Alternatively, restore_planning.go will set
	// it for the query `RESTORE ... FROM 'from' IN LATEST...`
	Subdir Expr
}

Restore represents a RESTORE statement.

func (*Restore) Format

func (node *Restore) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Restore) StatementReturnType

func (*Restore) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Restore) StatementTag

func (*Restore) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Restore) StatementType

func (*Restore) StatementType() StatementType

StatementType implements the Statement interface.

func (*Restore) String

func (n *Restore) String() string

type RestoreOptions

type RestoreOptions struct {
	EncryptionPassphrase             Expr
	DecryptionKMSURI                 StringOrPlaceholderOptList
	IntoDB                           Expr
	SkipMissingFKs                   bool
	SkipMissingSequences             bool
	SkipMissingSequenceOwners        bool
	SkipMissingViews                 bool
	SkipMissingUDFs                  bool
	Detached                         bool
	SkipLocalitiesCheck              bool
	DebugPauseOn                     Expr
	NewDBName                        Expr
	IncludeAllSecondaryTenants       Expr
	IncrementalStorage               StringOrPlaceholderOptList
	AsTenant                         Expr
	ForceTenantID                    Expr
	SchemaOnly                       bool
	VerifyData                       bool
	UnsafeRestoreIncompatibleVersion bool
	ExecutionLocality                Expr
	ExperimentalOnline               bool
	RemoveRegions                    bool
}

RestoreOptions describes options for the RESTORE execution.

func (*RestoreOptions) CombineWith

func (o *RestoreOptions) CombineWith(other *RestoreOptions) error

CombineWith merges other backup options into this backup options struct. An error is returned if the same option merged multiple times.

func (*RestoreOptions) Format

func (o *RestoreOptions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (RestoreOptions) IsDefault

func (o RestoreOptions) IsDefault() bool

IsDefault returns true if this backup options struct has default value.

type ReturnTyper

type ReturnTyper func(args []TypedExpr) *types.T

ReturnTyper defines the type-level function in which a builtin function's return type is determined. ReturnTypers should make sure to return unknownReturnType when necessary.

func ArrayOfFirstNonNullReturnType

func ArrayOfFirstNonNullReturnType() ReturnTyper

ArrayOfFirstNonNullReturnType returns an array type from the first non-null type in the argument list.

func FirstNonNullReturnType

func FirstNonNullReturnType() ReturnTyper

FirstNonNullReturnType returns the type of the first non-null argument, or types.Unknown if all arguments are null. There must be at least one argument, or else FirstNonNullReturnType returns UnknownReturnType. This method is used with HomogeneousType functions, in which all arguments have been checked to have the same type (or be null).

func FixedReturnType

func FixedReturnType(typ *types.T) ReturnTyper

FixedReturnType functions simply return a fixed type, independent of argument types.

func IdentityReturnType

func IdentityReturnType(idx int) ReturnTyper

IdentityReturnType creates a returnType that is a projection of the idx'th argument type.

type ReturningClause

type ReturningClause interface {
	NodeFormatter
	// contains filtered or unexported methods
}

ReturningClause represents the returning clause on a statement.

type ReturningExprs

type ReturningExprs SelectExprs

ReturningExprs represents RETURNING expressions.

func (*ReturningExprs) Format

func (r *ReturningExprs) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type ReturningNothing

type ReturningNothing struct{}

ReturningNothing represents RETURNING NOTHING.

func (*ReturningNothing) Format

func (*ReturningNothing) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type Revoke

type Revoke struct {
	Privileges     privilege.List
	Targets        GrantTargetList
	Grantees       RoleSpecList
	GrantOptionFor bool
}

Revoke represents a REVOKE statement. PrivilegeList and TargetList are defined in grant.go

func (*Revoke) Format

func (node *Revoke) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Revoke) StatementReturnType

func (*Revoke) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Revoke) StatementTag

func (*Revoke) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Revoke) StatementType

func (*Revoke) StatementType() StatementType

StatementType implements the Statement interface.

func (*Revoke) String

func (n *Revoke) String() string

type RevokeRole

type RevokeRole struct {
	Roles       NameList
	Members     RoleSpecList
	AdminOption bool
}

RevokeRole represents a REVOKE <role> statement.

func (*RevokeRole) Format

func (node *RevokeRole) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*RevokeRole) StatementReturnType

func (*RevokeRole) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*RevokeRole) StatementTag

func (*RevokeRole) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*RevokeRole) StatementType

func (*RevokeRole) StatementType() StatementType

StatementType implements the Statement interface.

func (*RevokeRole) String

func (n *RevokeRole) String() string

type RoleSpec

type RoleSpec struct {
	RoleSpecType RoleSpecType
	Name         string
}

RoleSpec represents a role. Name should only be populated if RoleSpecType is RoleName.

func MakeRoleSpecWithRoleName

func MakeRoleSpecWithRoleName(name string) RoleSpec

MakeRoleSpecWithRoleName creates a RoleSpec using a RoleName.

func (*RoleSpec) Format

func (r *RoleSpec) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (RoleSpec) Undefined

func (r RoleSpec) Undefined() bool

Undefined returns if RoleSpec is undefined.

type RoleSpecList

type RoleSpecList []RoleSpec

RoleSpecList is a list of RoleSpec.

func (*RoleSpecList) Format

func (l *RoleSpecList) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type RoleSpecType

type RoleSpecType int

RoleSpecType represents whether the RoleSpec is represented by string name or if the spec is CURRENT_USER or SESSION_USER.

const (
	// RoleName represents if a RoleSpec is defined using an IDENT or
	// unreserved_keyword in the grammar.
	RoleName RoleSpecType = iota
	// CurrentUser represents if a RoleSpec is defined using CURRENT_USER.
	CurrentUser
	// SessionUser represents if a RoleSpec is defined using SESSION_USER.
	SessionUser
)

func (RoleSpecType) String

func (r RoleSpecType) String() string

type RollbackToSavepoint

type RollbackToSavepoint struct {
	Savepoint Name
}

RollbackToSavepoint represents a ROLLBACK TO SAVEPOINT <name> statement.

func (*RollbackToSavepoint) Format

func (node *RollbackToSavepoint) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*RollbackToSavepoint) StatementReturnType

func (*RollbackToSavepoint) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*RollbackToSavepoint) StatementTag

func (*RollbackToSavepoint) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*RollbackToSavepoint) StatementType

func (*RollbackToSavepoint) StatementType() StatementType

StatementType implements the Statement interface.

func (*RollbackToSavepoint) String

func (n *RollbackToSavepoint) String() string

type RollbackTransaction

type RollbackTransaction struct{}

RollbackTransaction represents a ROLLBACK statement.

func (*RollbackTransaction) Format

func (node *RollbackTransaction) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*RollbackTransaction) StatementReturnType

func (*RollbackTransaction) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*RollbackTransaction) StatementTag

func (*RollbackTransaction) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*RollbackTransaction) StatementType

func (*RollbackTransaction) StatementType() StatementType

StatementType implements the Statement interface.

func (*RollbackTransaction) String

func (n *RollbackTransaction) String() string

type RoutineBody

type RoutineBody struct {
	// Stmts is populated during parsing. Unlike BodyStatements, we don't need
	// to create separate Annotations for each statement.
	Stmts Statements
}

RoutineBody represent a list of statements in a UDF body.

type RoutineBodyStr

type RoutineBodyStr string

RoutineBodyStr is a string containing all statements in a UDF body.

func (RoutineBodyStr) Format

func (node RoutineBodyStr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type RoutineExceptionHandler

type RoutineExceptionHandler struct {
	// Codes is a list of pgcode strings used to match exceptions. Note that as a
	// special case, the code may be "OTHERS", which matches most error codes.
	Codes []pgcode.Code

	// Actions contains a routine to handle each error code.
	Actions []*RoutineExpr
}

RoutineExceptionHandler encapsulates the information needed to match and handle errors for the exception block of a routine defined with PLpgSQL.

type RoutineExecFactory

type RoutineExecFactory interface{}

RoutineExecFactory is a factory used to build optimizer expressions into execution plans for statements within a RoutineExpr. It currently maps to exec.Factory. We use the empty interface here rather than exec.Factory to avoid import cycles.

type RoutineExpr

type RoutineExpr struct {
	// Name is a string name that describes the RoutineExpr, e.g., the name of
	// the UDF that the RoutineExpr is built from.
	Name string

	// Args contains the argument expressions to the routine.
	Args TypedExprs

	// ForEachPlan generates a plan for each statement in the routine.
	ForEachPlan RoutinePlanGenerator

	// Typ is the type of the routine's result.
	Typ *types.T

	// EnableStepping configures step-wise execution for the statements in the
	// routine. When true, statements within the routine will see mutations made
	// by the statement invoking the routine. They will also see changes made by
	// previous statements in the routine. When false, statements within the
	// routine will see a snapshot of the data as of the start of the statement
	// invoking the routine.
	EnableStepping bool

	// CachedResult stores the datum that the routine evaluates to, if the
	// routine is nullary (i.e., it has zero arguments) and stepping is
	// disabled. It is populated during the first execution of the routine.
	// Subsequent invocations of the routine return Result directly, rather than
	// being executed.
	//
	// The cache is never cleared - it lives for the entire lifetime of the
	// routine. Therefore, to "invalidate" the cache, a new routine must be
	// created. For example, consider:
	//
	//   CREATE TABLE t (i INT);
	//   CREATE FUNCTION f() RETURNS INT VOLATILE LANGUAGE SQL AS $$
	//     SELECT i FROM (VALUES (1), (2)) v(i) WHERE i = (SELECT max(i) FROM t)
	//   $$;
	//   SELECT f() FROM (VALUES (3), (4));
	//
	// The optimizer query plan for the SELECT contains two expressions that are
	// built as routines, the UDF and the subquery within it. Each invocation of
	// the UDF's routine will re-plan the body of the function, creating a new
	// routine for the subquery. This effectively "invalidates" the cached
	// result in the subquery routines each time the UDF is invoked. Within a
	// single invocation of the UDF, however, the subquery will only be executed
	// once and the cached result will be returned if the subquery is evaluated
	// multiple times (e.g., for each value of i in v).
	CachedResult Datum

	// CalledOnNullInput is true if the function should be called when any of
	// its inputs are NULL. If false, the function will not be evaluated in the
	// presence of null inputs, and will instead evaluate directly to NULL.
	//
	// NOTE: This boolean only affects evaluation of Routines within project-set
	// operators. This can apply to scalar routines if they are used as data
	// source (e.g. SELECT * FROM scalar_udf()), and always applies to
	// set-returning routines.
	// Strict non-set-returning routines are not invoked when their arguments
	// are NULL because optbuilder wraps them in a CASE expressions.
	CalledOnNullInput bool

	// MultiColOutput is true if the function may return multiple columns.
	MultiColOutput bool

	// Generator is true if the function may output a set of rows.
	Generator bool

	// TailCall is true if the routine is in a tail-call position in a parent
	// routine. This means that once execution reaches this routine, the parent
	// routine will return the result of evaluating this routine with no further
	// changes. For routines in a tail-call position we implement an optimization
	// to avoid nesting execution. This is necessary for performant PLpgSQL loops.
	TailCall bool

	// Procedure is true if the routine is a procedure being invoked by CALL.
	Procedure bool

	// BlockState holds the information needed to coordinate error-handling
	// between the sub-routines that make up a PLpgSQL exception block.
	BlockState *BlockState

	// CursorDeclaration contains the information needed to open a SQL cursor with
	// the result of the *first* body statement. It may be unset.
	CursorDeclaration *RoutineOpenCursor
}

RoutineExpr represents sequential execution of multiple statements. For example, it is used to represent execution of statements in the body of a user-defined function. It is only created by execbuilder - it is never constructed during parsing.

func NewTypedRoutineExpr

func NewTypedRoutineExpr(
	name string,
	args TypedExprs,
	gen RoutinePlanGenerator,
	typ *types.T,
	enableStepping bool,
	calledOnNullInput bool,
	multiColOutput bool,
	generator bool,
	tailCall bool,
	procedure bool,
	blockState *BlockState,
	cursorDeclaration *RoutineOpenCursor,
) *RoutineExpr

NewTypedRoutineExpr returns a new RoutineExpr that is well-typed.

func (*RoutineExpr) Eval

func (node *RoutineExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*RoutineExpr) Format

func (node *RoutineExpr) Format(ctx *FmtCtx)

Format is part of the Expr interface.

func (*RoutineExpr) ResolvedType

func (node *RoutineExpr) ResolvedType() *types.T

ResolvedType is part of the TypedExpr interface.

func (*RoutineExpr) String

func (node *RoutineExpr) String() string

func (*RoutineExpr) TypeCheck

func (node *RoutineExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck is part of the Expr interface.

func (*RoutineExpr) Walk

func (node *RoutineExpr) Walk(v Visitor) Expr

Walk is part of the Expr interface.

type RoutineLanguage

type RoutineLanguage string

RoutineLanguage indicates the language of the statements in the routine body.

const (
	// RoutineLangUnknown represents an unknown language.
	RoutineLangUnknown RoutineLanguage = "unknown"
	// RoutineLangSQL represents SQL language.
	RoutineLangSQL RoutineLanguage = "SQL"
	// RoutineLangPLpgSQL represents the PL/pgSQL procedural language.
	RoutineLangPLpgSQL RoutineLanguage = "plpgsql"
	// RoutineLangC represents the C language.
	RoutineLangC RoutineLanguage = "C"
)

func AsRoutineLanguage

func AsRoutineLanguage(lang string) (RoutineLanguage, error)

AsRoutineLanguage converts a string to a RoutineLanguage if applicable. No error is returned if string does not represent a valid UDF language; unknown languages result in an error later.

func (RoutineLanguage) Format

func (node RoutineLanguage) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type RoutineLeakproof

type RoutineLeakproof bool

RoutineLeakproof indicates whether a function is leakproof or not. The default is NOT LEAKPROOF if no leakproof option is provided. LEAKPROOF can only be used with the IMMUTABLE volatility because we currently conflated LEAKPROOF as a volatility equal to IMMUTABLE+LEAKPROOF. Postgres allows STABLE+LEAKPROOF functions.

func (RoutineLeakproof) Format

func (node RoutineLeakproof) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type RoutineName

type RoutineName struct {
	// contains filtered or unexported fields
}

RoutineName represent a function name in a UDF relevant statement, either DDL or DML statement. Similar to TableName, it is constructed for incoming SQL queries from an UnresolvedObjectName.

func MakeQualifiedRoutineName

func MakeQualifiedRoutineName(db string, sc string, fn string) RoutineName

MakeQualifiedRoutineName constructs a RoutineName with the given db and schema name as prefix.

func MakeRoutineNameFromPrefix

func MakeRoutineNameFromPrefix(prefix ObjectNamePrefix, object Name) RoutineName

MakeRoutineNameFromPrefix returns a RoutineName with the given prefix and function name.

func (*RoutineName) FQString

func (f *RoutineName) FQString() string

FQString renders the function name in full, not omitting the prefix schema and catalog names. Suitable for logging, etc.

func (*RoutineName) Format

func (f *RoutineName) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*RoutineName) Object

func (o *RoutineName) Object() string

func (*RoutineName) String

func (f *RoutineName) String() string

func (*RoutineName) ToUnresolvedObjectName

func (o *RoutineName) ToUnresolvedObjectName() *UnresolvedObjectName

ToUnresolvedObjectName converts the type name to an unresolved object name. Schema and catalog are included if indicated by the ExplicitSchema and ExplicitCatalog flags.

type RoutineNullInputBehavior

type RoutineNullInputBehavior int

RoutineNullInputBehavior represent the UDF property on null parameters.

const (
	// RoutineCalledOnNullInput indicates that the routine will be given the
	// chance to execute when presented with NULL input. This is the default if
	// no null input behavior is specified.
	RoutineCalledOnNullInput RoutineNullInputBehavior = iota
	// RoutineReturnsNullOnNullInput indicates that the routine will result in
	// NULL given any NULL parameter.
	RoutineReturnsNullOnNullInput
	// RoutineStrict is the same as RoutineReturnsNullOnNullInput
	RoutineStrict
)

func (RoutineNullInputBehavior) Format

func (node RoutineNullInputBehavior) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type RoutineObj

type RoutineObj struct {
	FuncName RoutineName
	Params   RoutineParams
}

RoutineObj represents a routine (function or procedure) object in DROP, GRANT, and REVOKE statements.

func (*RoutineObj) Format

func (node *RoutineObj) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (RoutineObj) ParamTypes

func (node RoutineObj) ParamTypes(
	ctx context.Context, res TypeReferenceResolver,
) ([]*types.T, error)

ParamTypes returns a slice of parameter types of the routine.

type RoutineObjs

type RoutineObjs []RoutineObj

RoutineObjs is a slice of RoutineObj.

func (RoutineObjs) Format

func (node RoutineObjs) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type RoutineOpenCursor

type RoutineOpenCursor struct {
	// NameArgIdx is the index of the routine argument that contains the name of
	// the cursor that will be created.
	NameArgIdx int

	// Scroll is the scroll option for the cursor, if one was specified. The other
	// cursor options are not valid in PLpgSQL.
	Scroll CursorScrollOption

	// CursorSQL is a formatted string used to associate the original SQL
	// statement with the cursor.
	CursorSQL string
}

RoutineOpenCursor stores the information needed to correctly open a cursor with the output of a routine.

type RoutineOption

type RoutineOption interface {
	NodeFormatter
	// contains filtered or unexported methods
}

RoutineOption is an interface representing UDF properties.

type RoutineOptions

type RoutineOptions []RoutineOption

RoutineOptions represent a list of routine options.

type RoutineParam

type RoutineParam struct {
	Name       Name
	Type       ResolvableTypeReference
	Class      RoutineParamClass
	DefaultVal Expr
}

RoutineParam represents a parameter in a UDF signature.

func (*RoutineParam) Format

func (node *RoutineParam) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type RoutineParamClass

type RoutineParamClass int

RoutineParamClass indicates what type of argument an arg is.

const (
	// RoutineParamIn args can only be used as input.
	RoutineParamIn RoutineParamClass = iota
	// RoutineParamOut args can only be used as output.
	RoutineParamOut
	// RoutineParamInOut args can be used as both input and output.
	RoutineParamInOut
	// RoutineParamVariadic args are variadic.
	RoutineParamVariadic
)

type RoutineParams

type RoutineParams []RoutineParam

RoutineParams represents a list of RoutineParam.

func (RoutineParams) Format

func (node RoutineParams) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type RoutinePlan

type RoutinePlan interface{}

RoutinePlan represents a plan for a statement in a routine. It currently maps to exec.Plan. We use the empty interface here rather than exec.Plan to avoid import cycles.

type RoutinePlanGeneratedFunc

type RoutinePlanGeneratedFunc func(plan RoutinePlan, isFinalPlan bool) error

RoutinePlanGeneratedFunc is the function type that is called for each plan enumerated by a RoutinePlanGenerator. isFinalPlan is true if no more plans will be generated after the current plan.

type RoutinePlanGenerator

type RoutinePlanGenerator func(
	_ context.Context, _ RoutineExecFactory, args Datums, fn RoutinePlanGeneratedFunc,
) error

RoutinePlanGenerator generates a plan for the execution of each statement within a routine. The given RoutinePlanGeneratedFunc is called for each plan generated.

A RoutinePlanGenerator must return an error if the RoutinePlanGeneratedFunc returns an error.

type RoutineReturn

type RoutineReturn struct {
	ReturnVal Expr
}

RoutineReturn represent a RETURN statement in a UDF body.

func (*RoutineReturn) Format

func (node *RoutineReturn) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*RoutineReturn) StatementReturnType

func (*RoutineReturn) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*RoutineReturn) StatementTag

func (*RoutineReturn) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*RoutineReturn) StatementType

func (*RoutineReturn) StatementType() StatementType

StatementType implements the Statement interface.

func (*RoutineReturn) String

func (n *RoutineReturn) String() string

type RoutineReturnType

type RoutineReturnType struct {
	Type  ResolvableTypeReference
	SetOf bool
}

RoutineReturnType represent the return type of UDF.

type RoutineType

type RoutineType uint8

RoutineType specifies the type of routine represented by an overload.

const (
	// BuiltinRoutine is a builtin function.
	BuiltinRoutine RoutineType = 1 << iota
	// UDFRoutine is a user-defined function.
	UDFRoutine
	// ProcedureRoutine is a user-defined procedure.
	ProcedureRoutine
)

func (RoutineType) String

func (t RoutineType) String() string

String returns the string representation of the routine type.

type RoutineVolatility

type RoutineVolatility int

RoutineVolatility represent UDF volatility property.

const (
	// RoutineVolatile represents volatility.Volatile. This is the default
	// volatility if none is provided.
	RoutineVolatile RoutineVolatility = iota
	// RoutineImmutable represents volatility.Immutable.
	RoutineImmutable
	// RoutineStable represents volatility.Stable.
	RoutineStable
)

func GetRoutineVolatility

func GetRoutineVolatility(options RoutineOptions) RoutineVolatility

GetRoutineVolatility tries to find a function volatility from the given list of function options. If there is no volatility found, RoutineVolatile is returned as the default.

func (RoutineVolatility) Format

func (node RoutineVolatility) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type RowsFromExpr

type RowsFromExpr struct {
	Items Exprs
}

RowsFromExpr represents a ROWS FROM(...) expression.

func (*RowsFromExpr) Format

func (node *RowsFromExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*RowsFromExpr) WalkTableExpr

func (expr *RowsFromExpr) WalkTableExpr(v Visitor) TableExpr

WalkTableExpr implements the TableExpr interface.

type SQLFnOverload

type SQLFnOverload interface {
	SQLFn()
}

SQLFnOverload is an opaque type used to box an eval.SQLFnOverload.

type Savepoint

type Savepoint struct {
	Name Name
}

Savepoint represents a SAVEPOINT <name> statement.

func (*Savepoint) Format

func (node *Savepoint) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Savepoint) StatementReturnType

func (*Savepoint) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Savepoint) StatementTag

func (*Savepoint) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Savepoint) StatementType

func (*Savepoint) StatementType() StatementType

StatementType implements the Statement interface.

func (*Savepoint) String

func (n *Savepoint) String() string

type ScalarAncestors

type ScalarAncestors byte

ScalarAncestors provides context for the current scalar expression during semantic analysis. Ancestors are temporarily modified by expressions so that their descendent expressions can be analyzed with respect to their ancestors.

const (
	// FuncExprAncestor is temporarily added to ScalarAncestors while type
	// checking the parameters of a function. Used to process
	// RejectNestedGenerators properly.
	FuncExprAncestor ScalarAncestors = 1 << iota

	// WindowFuncAncestor is temporarily added to ScalarAncestors while type
	// checking the parameters of a window function in order to reject nested
	// window functions.
	WindowFuncAncestor

	// ConditionalAncestor is temporarily added to ScalarAncestors while type
	// checking condition expressions CASE, COALESCE, and IF. Used to reject
	// set-returning functions within conditional expressions.
	ConditionalAncestor

	// CallAncestor is added to ScalarAncestors while type checking children of
	// a CALL statement. Used to print sensible error messages for procedures.
	CallAncestor
)

func (ScalarAncestors) Has

func (s ScalarAncestors) Has(other ScalarAncestors) bool

Has returns true if s has the given ancestor.

func (*ScalarAncestors) PopTo

func (s *ScalarAncestors) PopTo(orig ScalarAncestors)

PopTo returns s to the given set of ancestors. Use with:

defer semaCtx.Properties.Ancestors.PopTo(semaCtx.Properties.Ancestors)

func (*ScalarAncestors) Push

func (s *ScalarAncestors) Push(other ScalarAncestors)

Push adds the given ancestor to s.

type ScalarProperties

type ScalarProperties struct {
	// SeenAggregate is set to true if the expression originally
	// contained an aggregation.
	SeenAggregate bool

	// SeenWindowApplication is set to true if the expression originally
	// contained a window function.
	SeenWindowApplication bool

	// SeenGenerator is set to true if the expression originally
	// contained a SRF.
	SeenGenerator bool
}

ScalarProperties contains the properties of the current scalar expression discovered during semantic analysis. The properties are collected prior to simplification, so some of the properties may not hold anymore by the time semantic analysis completes.

func (*ScalarProperties) Clear

func (sp *ScalarProperties) Clear()

Clear resets the scalar properties to defaults.

type Scatter

type Scatter struct {
	TableOrIndex TableIndexName
	// Optional from and to values for the columns in the PK or index (or a prefix
	// of the columns).
	// See docs/RFCS/sql_split_syntax.md.
	From, To Exprs
}

Scatter represents an `ALTER TABLE/INDEX .. SCATTER ..` statement.

func (*Scatter) Format

func (node *Scatter) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Scatter) StatementReturnType

func (*Scatter) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Scatter) StatementTag

func (*Scatter) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Scatter) StatementType

func (*Scatter) StatementType() StatementType

StatementType implements the Statement interface.

func (*Scatter) String

func (n *Scatter) String() string

type ScheduleCommand

type ScheduleCommand int

ScheduleCommand determines which type of action to effect on the selected job(s).

const (
	PauseSchedule ScheduleCommand = iota
	ResumeSchedule
	DropSchedule
)

ScheduleCommand values

func (ScheduleCommand) String

func (c ScheduleCommand) String() string

type ScheduleState

type ScheduleState int

ScheduleState describes what kind of schedules to display

const (
	// SpecifiedSchedules indicates that show schedules should
	// only show subset of schedules.
	SpecifiedSchedules ScheduleState = iota

	// ActiveSchedules indicates that show schedules should
	// only show those schedules that are currently active.
	ActiveSchedules

	// PausedSchedules indicates that show schedules should
	// only show those schedules that are currently paused.
	PausedSchedules
)

func (ScheduleState) Format

func (s ScheduleState) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type ScheduledBackup

type ScheduledBackup struct {
	ScheduleLabelSpec LabelSpec
	Recurrence        Expr
	FullBackup        *FullBackupClause /* nil implies choose default */
	Targets           *BackupTargetList /* nil implies tree.AllDescriptors coverage */
	To                StringOrPlaceholderOptList
	BackupOptions     BackupOptions
	ScheduleOptions   KVOptions
}

ScheduledBackup represents scheduled backup job.

func (ScheduledBackup) Coverage

func (node ScheduledBackup) Coverage() DescriptorCoverage

Coverage return the coverage (all vs requested).

func (*ScheduledBackup) Format

func (node *ScheduledBackup) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ScheduledBackup) StatementReturnType

func (*ScheduledBackup) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ScheduledBackup) StatementTag

func (*ScheduledBackup) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ScheduledBackup) StatementType

func (*ScheduledBackup) StatementType() StatementType

StatementType implements the Statement interface.

func (*ScheduledBackup) String

func (n *ScheduledBackup) String() string

type ScheduledChangefeed

type ScheduledChangefeed struct {
	*CreateChangefeed
	ScheduleLabelSpec LabelSpec
	Recurrence        Expr
	ScheduleOptions   KVOptions
}

ScheduledChangefeed represents scheduled changefeed job.

func (*ScheduledChangefeed) Format

func (node *ScheduledChangefeed) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ScheduledChangefeed) StatementReturnType

func (*ScheduledChangefeed) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ScheduledChangefeed) StatementTag

func (n *ScheduledChangefeed) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ScheduledChangefeed) StatementType

func (*ScheduledChangefeed) StatementType() StatementType

StatementType implements the Statement interface.

type ScheduledJobExecutorType

type ScheduledJobExecutorType int

ScheduledJobExecutorType is a type identifying the names of the supported scheduled job executors.

const (
	// InvalidExecutor is a placeholder for an invalid executor type.
	InvalidExecutor ScheduledJobExecutorType = iota

	// ScheduledBackupExecutor is an executor responsible for
	// the execution of the scheduled backups.
	ScheduledBackupExecutor

	// ScheduledSQLStatsCompactionExecutor is an executor responsible for the
	// execution of the scheduled SQL Stats compaction.
	ScheduledSQLStatsCompactionExecutor

	// ScheduledRowLevelTTLExecutor is an executor responsible for the cleanup
	// of rows on row level TTL tables.
	ScheduledRowLevelTTLExecutor

	// ScheduledSchemaTelemetryExecutor is an executor responsible for the logging
	// of schema telemetry.
	ScheduledSchemaTelemetryExecutor

	// ScheduledChangefeedExecutor is an executor responsible for
	// the execution of the scheduled changefeeds.
	ScheduledChangefeedExecutor
)

func (ScheduledJobExecutorType) InternalName

func (t ScheduledJobExecutorType) InternalName() string

InternalName returns an internal executor name. This name can be used to filter matching schedules.

func (ScheduledJobExecutorType) UserName

func (t ScheduledJobExecutorType) UserName() string

UserName returns a user friendly executor name.

type SchemaExprContext

type SchemaExprContext string

SchemaExprContext indicates in which schema change context an expression is being used in. For example, DEFAULT VALUE of a column, CHECK CONSTRAINT's expression, etc.

const (
	AlterColumnTypeUsingExpr        SchemaExprContext = "ALTER COLUMN TYPE USING EXPRESSION"
	StoredComputedColumnExpr        SchemaExprContext = "STORED COMPUTED COLUMN"
	VirtualComputedColumnExpr       SchemaExprContext = "VIRTUAL COMPUTED COLUMN"
	ColumnOnUpdateExpr              SchemaExprContext = "ON UPDATE"
	ColumnDefaultExprInAddColumn    SchemaExprContext = "DEFAULT (in ADD COLUMN)"
	ColumnDefaultExprInNewTable     SchemaExprContext = "DEFAULT (in CREATE TABLE)"
	ColumnDefaultExprInNewView      SchemaExprContext = "DEFAULT (in CREATE VIEW)"
	ColumnDefaultExprInSetDefault   SchemaExprContext = "DEFAULT (in SET DEFAULT)"
	CheckConstraintExpr             SchemaExprContext = "CHECK"
	UniqueWithoutIndexPredicateExpr SchemaExprContext = "UNIQUE WITHOUT INDEX PREDICATE"
	IndexPredicateExpr              SchemaExprContext = "INDEX PREDICATE"
	ExpressionIndexElementExpr      SchemaExprContext = "EXPRESSION INDEX ELEMENT"
	TTLExpirationExpr               SchemaExprContext = "TTL EXPIRATION EXPRESSION"
	TTLDefaultExpr                  SchemaExprContext = "TTL DEFAULT"
	TTLUpdateExpr                   SchemaExprContext = "TTL UPDATE"
)

func ComputedColumnExprContext

func ComputedColumnExprContext(isVirtual bool) SchemaExprContext

type SchemaFeatureName

type SchemaFeatureName string

SchemaFeatureName feature name for a given statement, which can be used to detect via the feature check functions if the schema change is allowed.

func GetSchemaFeatureNameFromStmt

func GetSchemaFeatureNameFromStmt(stmt Statement) SchemaFeatureName

GetSchemaFeatureNameFromStmt takes a statement and converts it to a schema feature name, which can be enabled or disabled via a feature flag.

type Scrub

type Scrub struct {
	Typ     ScrubType
	Options ScrubOptions
	// Table is only set during SCRUB TABLE statements.
	Table *UnresolvedObjectName
	// Database is only set during SCRUB DATABASE statements.
	Database Name
	AsOf     AsOfClause
}

Scrub represents a SCRUB statement.

func (*Scrub) Format

func (n *Scrub) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Scrub) StatementReturnType

func (*Scrub) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Scrub) StatementTag

func (n *Scrub) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Scrub) StatementType

func (*Scrub) StatementType() StatementType

StatementType implements the Statement interface.

func (*Scrub) String

func (n *Scrub) String() string

type ScrubOption

type ScrubOption interface {
	fmt.Stringer
	NodeFormatter
	// contains filtered or unexported methods
}

ScrubOption represents a scrub option.

type ScrubOptionConstraint

type ScrubOptionConstraint struct {
	ConstraintNames NameList
}

ScrubOptionConstraint represents a CONSTRAINT scrub check.

func (*ScrubOptionConstraint) Format

func (n *ScrubOptionConstraint) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ScrubOptionConstraint) String

func (n *ScrubOptionConstraint) String() string

type ScrubOptionIndex

type ScrubOptionIndex struct {
	IndexNames NameList
}

ScrubOptionIndex represents an INDEX scrub check.

func (*ScrubOptionIndex) Format

func (n *ScrubOptionIndex) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ScrubOptionIndex) String

func (n *ScrubOptionIndex) String() string

type ScrubOptionPhysical

type ScrubOptionPhysical struct{}

ScrubOptionPhysical represents a PHYSICAL scrub check.

func (*ScrubOptionPhysical) Format

func (n *ScrubOptionPhysical) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ScrubOptionPhysical) String

func (n *ScrubOptionPhysical) String() string

type ScrubOptions

type ScrubOptions []ScrubOption

ScrubOptions corresponds to a comma-delimited list of scrub options.

func (*ScrubOptions) Format

func (n *ScrubOptions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ScrubOptions) String

func (n *ScrubOptions) String() string

type ScrubType

type ScrubType int

ScrubType describes the SCRUB statement operation.

type SearchPath

type SearchPath interface {
	// NumElements returns the number of elements in the SearchPath.
	NumElements() int

	// GetSchema returns the schema at the ord offset in the SearchPath.
	// Note that it will return the empty string if the ordinal is out of range.
	GetSchema(ord int) string
}

SearchPath encapsulates the ordered list of schemas in the current database to search during name resolution.

var EmptySearchPath SearchPath = emptySearchPath{}

EmptySearchPath is a SearchPath with no members.

type Select

type Select struct {
	With    *With
	Select  SelectStatement
	OrderBy OrderBy
	Limit   *Limit
	Locking LockingClause
}

Select represents a SelectStatement with an ORDER and/or LIMIT.

func (*Select) Format

func (node *Select) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Select) StatementReturnType

func (*Select) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Select) StatementTag

func (*Select) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Select) StatementType

func (*Select) StatementType() StatementType

StatementType implements the Statement interface.

func (*Select) String

func (n *Select) String() string

type SelectClause

type SelectClause struct {
	From        From
	DistinctOn  DistinctOn
	Exprs       SelectExprs
	GroupBy     GroupBy
	Window      Window
	Having      *Where
	Where       *Where
	Distinct    bool
	TableSelect bool
}

SelectClause represents a SELECT statement.

func (*SelectClause) Format

func (node *SelectClause) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*SelectClause) StatementReturnType

func (*SelectClause) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*SelectClause) StatementTag

func (*SelectClause) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*SelectClause) StatementType

func (*SelectClause) StatementType() StatementType

StatementType implements the Statement interface.

func (*SelectClause) String

func (n *SelectClause) String() string

type SelectExpr

type SelectExpr struct {
	Expr Expr
	As   UnrestrictedName
}

SelectExpr represents a SELECT expression.

func StarSelectExpr

func StarSelectExpr() SelectExpr

StarSelectExpr is a convenience function that represents an unqualified "*" in a select expression.

func (*SelectExpr) Format

func (node *SelectExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*SelectExpr) NormalizeTopLevelVarName

func (node *SelectExpr) NormalizeTopLevelVarName() error

NormalizeTopLevelVarName preemptively expands any UnresolvedName at the top level of the expression into a VarName. This is meant to catch stars so that sql.checkRenderStar() can see it prior to other expression transformations.

type SelectExprs

type SelectExprs []SelectExpr

SelectExprs represents SELECT expressions.

func (*SelectExprs) Format

func (node *SelectExprs) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type SelectStatement

type SelectStatement interface {
	Statement
	// contains filtered or unexported methods
}

SelectStatement represents any SELECT statement.

type SemaContext

type SemaContext struct {
	// Annotations augments the AST with extra information.
	Annotations Annotations

	// Placeholders relates placeholder names to their type and, later, value.
	Placeholders PlaceholderInfo

	// IVarContainer is used to resolve the types of IndexedVars.
	IVarContainer IndexedVarContainer

	// SearchPath indicates where to search for unqualified function
	// names. The path elements must be normalized via Name.Normalize()
	// already.
	SearchPath SearchPath

	// TypeResolver manages resolving type names into *types.T's.
	TypeResolver TypeReferenceResolver

	// FunctionResolver manages resolving functions names into
	// *FunctionDefinitons.
	FunctionResolver FunctionReferenceResolver

	// NameResolver is used to resolve the fully qualified
	// name of a table given its ID.
	NameResolver QualifiedNameResolver

	Properties SemaProperties

	// DateStyle refers to the DateStyle to parse as.
	DateStyle pgdate.DateStyle
	// IntervalStyle refers to the IntervalStyle to parse as.
	IntervalStyle duration.IntervalStyle

	// UnsupportedTypeChecker is used to determine whether a builtin data type is
	// supported by the current cluster version. It may be unset.
	UnsupportedTypeChecker UnsupportedTypeChecker
}

SemaContext defines the context in which to perform semantic analysis on an expression syntax tree.

func MakeSemaContext

func MakeSemaContext() SemaContext

MakeSemaContext initializes a simple SemaContext suitable for "lightweight" type checking such as the one performed for default expressions. Note: if queries with placeholders are going to be used, SemaContext.Placeholders.Init must be called separately.

func (*SemaContext) GetTypeResolver

func (sc *SemaContext) GetTypeResolver() TypeReferenceResolver

GetTypeResolver returns the TypeReferenceResolver.

func (*SemaContext) TypeCheckContext

func (sc *SemaContext) TypeCheckContext() string

TypeCheckContext returns the semantic analysis context, for use in creating error messages.

type SemaProperties

type SemaProperties struct {

	// Derived is populated during semantic analysis with properties
	// from the expression being analyzed.  The caller is responsible
	// for re-initializing this when needed.
	Derived ScalarProperties

	// Ancestors is mutated during semantic analysis to provide contextual
	// information for each descendent during traversal of sub-expressions.
	Ancestors ScalarAncestors
	// contains filtered or unexported fields
}

SemaProperties is a holder for required and derived properties during semantic analysis. It provides scoping semantics via its Restore() method, see below.

func (*SemaProperties) IsSet

func (s *SemaProperties) IsSet(rejectFlags SemaRejectFlags) bool

IsSet checks if the given rejectFlag is set as a required property.

func (*SemaProperties) Reject

func (s *SemaProperties) Reject(rejectFlags SemaRejectFlags)

Reject adds the given flags to the set of required constraints of s.

func (*SemaProperties) Require

func (s *SemaProperties) Require(context string, rejectFlags SemaRejectFlags)

Require resets the derived properties and the scalar ancestors, and sets required constraints. It must only be called before starting semantic analysis and during traversal by semantic analysis itself.

func (*SemaProperties) Restore

func (s *SemaProperties) Restore(orig SemaProperties)

Restore restores a copy of a SemaProperties. Use with: defer semaCtx.Properties.Restore(semaCtx.Properties)

type SemaRejectFlags

type SemaRejectFlags int

SemaRejectFlags contains flags to filter out certain kinds of expressions.

const (
	// RejectAggregates rejects min(), max(), etc.
	RejectAggregates SemaRejectFlags = 1 << iota

	// RejectNestedAggregates rejects any use of aggregates inside the
	// argument list of another function call, which can itself be an aggregate
	// (RejectAggregates notwithstanding).
	RejectNestedAggregates

	// RejectNestedWindowFunctions rejects any use of window functions inside the
	// argument list of another window function.
	RejectNestedWindowFunctions

	// RejectWindowApplications rejects "x() over y", etc.
	RejectWindowApplications

	// RejectGenerators rejects any use of SRFs, e.g "generate_series()".
	RejectGenerators

	// RejectNestedGenerators rejects any use of SRFs inside the
	// argument list of another function call, which can itself be a SRF
	// (RejectGenerators notwithstanding).
	// This is used e.g. when processing the calls inside ROWS FROM.
	RejectNestedGenerators

	// RejectStableOperators rejects any stable functions or operators (including
	// casts).
	RejectStableOperators

	// RejectVolatileFunctions rejects any volatile functions.
	RejectVolatileFunctions

	// RejectSubqueries rejects subqueries in scalar contexts.
	RejectSubqueries

	// RejectProcedures rejects procedures in scalar contexts.
	RejectProcedures

	// RejectSpecial is used in common places like the LIMIT clause.
	RejectSpecial = RejectAggregates |
		RejectGenerators |
		RejectWindowApplications |
		RejectProcedures
)

Valid values for SemaRejectFlags.

type SequenceOption

type SequenceOption struct {
	Name string

	// AsIntegerType specifies default min and max values of a sequence.
	AsIntegerType *types.T

	IntVal *int64

	OptionalWord bool

	ColumnItemVal *ColumnItem
}

SequenceOption represents an option on a CREATE SEQUENCE statement.

type SequenceOptions

type SequenceOptions []SequenceOption

SequenceOptions represents a list of sequence options.

func (*SequenceOptions) Format

func (node *SequenceOptions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type SetClusterSetting

type SetClusterSetting struct {
	Name  string
	Value Expr
}

SetClusterSetting represents a SET CLUSTER SETTING statement.

func (*SetClusterSetting) Format

func (node *SetClusterSetting) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*SetClusterSetting) StatementReturnType

func (*SetClusterSetting) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*SetClusterSetting) StatementTag

func (*SetClusterSetting) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*SetClusterSetting) StatementType

func (*SetClusterSetting) StatementType() StatementType

StatementType implements the Statement interface.

func (*SetClusterSetting) String

func (n *SetClusterSetting) String() string

type SetSessionAuthorizationDefault

type SetSessionAuthorizationDefault struct{}

SetSessionAuthorizationDefault represents a SET SESSION AUTHORIZATION DEFAULT statement. This can be extended (and renamed) if we ever support names in the last position.

func (*SetSessionAuthorizationDefault) Format

func (node *SetSessionAuthorizationDefault) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*SetSessionAuthorizationDefault) StatementReturnType

func (*SetSessionAuthorizationDefault) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*SetSessionAuthorizationDefault) StatementTag

func (*SetSessionAuthorizationDefault) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*SetSessionAuthorizationDefault) StatementType

StatementType implements the Statement interface.

func (*SetSessionAuthorizationDefault) String

type SetSessionCharacteristics

type SetSessionCharacteristics struct {
	Modes TransactionModes
}

SetSessionCharacteristics represents a SET SESSION CHARACTERISTICS AS TRANSACTION statement.

func (*SetSessionCharacteristics) Format

func (node *SetSessionCharacteristics) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*SetSessionCharacteristics) StatementReturnType

func (*SetSessionCharacteristics) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*SetSessionCharacteristics) StatementTag

func (*SetSessionCharacteristics) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*SetSessionCharacteristics) StatementType

func (*SetSessionCharacteristics) StatementType() StatementType

StatementType implements the Statement interface.

func (*SetSessionCharacteristics) String

func (n *SetSessionCharacteristics) String() string

type SetTracing

type SetTracing struct {
	Values Exprs
}

SetTracing represents a SET TRACING statement.

func (*SetTracing) Format

func (node *SetTracing) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*SetTracing) StatementReturnType

func (*SetTracing) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*SetTracing) StatementTag

func (*SetTracing) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*SetTracing) StatementType

func (*SetTracing) StatementType() StatementType

StatementType implements the Statement interface.

func (*SetTracing) String

func (n *SetTracing) String() string

type SetTransaction

type SetTransaction struct {
	Modes TransactionModes
}

SetTransaction represents a SET TRANSACTION statement.

func (*SetTransaction) Format

func (node *SetTransaction) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*SetTransaction) StatementReturnType

func (*SetTransaction) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*SetTransaction) StatementTag

func (*SetTransaction) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*SetTransaction) StatementType

func (*SetTransaction) StatementType() StatementType

StatementType implements the Statement interface.

func (*SetTransaction) String

func (n *SetTransaction) String() string

type SetVar

type SetVar struct {
	Name     string
	Local    bool
	Values   Exprs
	Reset    bool
	ResetAll bool
	SetRow   bool
}

SetVar represents a SET or RESET statement.

func (*SetVar) Format

func (node *SetVar) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*SetVar) StatementReturnType

func (*SetVar) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*SetVar) StatementTag

func (n *SetVar) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*SetVar) StatementType

func (*SetVar) StatementType() StatementType

StatementType implements the Statement interface.

func (*SetVar) String

func (n *SetVar) String() string

type SetZoneConfig

type SetZoneConfig struct {
	ZoneSpecifier
	// AllIndexes indicates that the zone configuration should be applied across
	// all of a tables indexes. (ALTER PARTITION ... OF INDEX <tablename>@*)
	AllIndexes bool
	ZoneConfigSettings
}

SetZoneConfig represents an ALTER DATABASE/TABLE... CONFIGURE ZONE statement.

func (*SetZoneConfig) Format

func (node *SetZoneConfig) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*SetZoneConfig) StatementReturnType

func (*SetZoneConfig) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*SetZoneConfig) StatementTag

func (*SetZoneConfig) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*SetZoneConfig) StatementType

func (*SetZoneConfig) StatementType() StatementType

StatementType implements the Statement interface.

func (*SetZoneConfig) String

func (n *SetZoneConfig) String() string

type ShardedIndexDef

type ShardedIndexDef struct {
	ShardBuckets Expr
}

ShardedIndexDef represents a hash sharded secondary index definition within a CREATE TABLE or CREATE INDEX statement.

func (*ShardedIndexDef) Format

func (node *ShardedIndexDef) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type ShardedPrimaryKeyConstraint

type ShardedPrimaryKeyConstraint struct {
	Sharded       bool
	ShardBuckets  Expr
	StorageParams StorageParams
}

ShardedPrimaryKeyConstraint represents `PRIMARY KEY .. USING HASH..` on a column.

type ShowBackup

type ShowBackup struct {
	Path         Expr
	InCollection StringOrPlaceholderOptList
	From         bool
	Details      ShowBackupDetails
	Options      ShowBackupOptions
}

ShowBackup represents a SHOW BACKUP statement.

TODO(msbutler): implement a walkableStmt for ShowBackup.

func (*ShowBackup) Format

func (node *ShowBackup) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowBackup) StatementReturnType

func (*ShowBackup) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowBackup) StatementTag

func (*ShowBackup) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowBackup) StatementType

func (*ShowBackup) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowBackup) String

func (n *ShowBackup) String() string

type ShowBackupDetails

type ShowBackupDetails int

ShowBackupDetails represents the type of details to display for a SHOW BACKUP statement.

const (
	// BackupDefaultDetails identifies a bare SHOW BACKUP statement.
	BackupDefaultDetails ShowBackupDetails = iota
	// BackupRangeDetails identifies a SHOW BACKUP RANGES statement.
	BackupRangeDetails
	// BackupFileDetails identifies a SHOW BACKUP FILES statement.
	BackupFileDetails
	// BackupSchemaDetails identifies a SHOW BACKUP SCHEMAS statement.
	BackupSchemaDetails
	// BackupValidateDetails identifies a SHOW BACKUP VALIDATION
	// statement.
	BackupValidateDetails
	// BackupConnectionTest identifies a SHOW BACKUP CONNECTION statement
	BackupConnectionTest
)

type ShowBackupOptions

type ShowBackupOptions struct {
	AsJson               bool
	CheckFiles           bool
	DebugIDs             bool
	IncrementalStorage   StringOrPlaceholderOptList
	DecryptionKMSURI     StringOrPlaceholderOptList
	EncryptionPassphrase Expr
	Privileges           bool
	SkipSize             bool

	// EncryptionInfoDir is a hidden option used when the user wants to run the deprecated
	//
	// SHOW BACKUP <incremental_dir>
	//
	// on an encrypted incremental backup will need to pass their full backup's
	// directory to the encryption_info_dir parameter because the
	// `ENCRYPTION-INFO` file necessary to decode the incremental backup lives in
	// the full backup dir.
	EncryptionInfoDir Expr
	DebugMetadataSST  bool

	CheckConnectionTransferSize Expr
	CheckConnectionDuration     Expr
	CheckConnectionConcurrency  Expr
}

func (*ShowBackupOptions) CombineWith

func (o *ShowBackupOptions) CombineWith(other *ShowBackupOptions) error

CombineWith merges other backup options into this backup options struct. An error is returned if the same option merged multiple times.

func (*ShowBackupOptions) Format

func (o *ShowBackupOptions) Format(ctx *FmtCtx)

func (ShowBackupOptions) IsDefault

func (o ShowBackupOptions) IsDefault() bool

type ShowChangefeedJobs

type ShowChangefeedJobs struct {
	// If non-nil, a select statement that provides the job ids to be shown.
	Jobs *Select
}

ShowChangefeedJobs represents a SHOW CHANGEFEED JOBS statement

func (*ShowChangefeedJobs) Format

func (node *ShowChangefeedJobs) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowChangefeedJobs) StatementReturnType

func (*ShowChangefeedJobs) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowChangefeedJobs) StatementTag

func (*ShowChangefeedJobs) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowChangefeedJobs) StatementType

func (*ShowChangefeedJobs) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowChangefeedJobs) String

func (n *ShowChangefeedJobs) String() string

type ShowClusterSetting

type ShowClusterSetting struct {
	Name string
}

ShowClusterSetting represents a SHOW CLUSTER SETTING statement.

func (*ShowClusterSetting) Format

func (node *ShowClusterSetting) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowClusterSetting) StatementReturnType

func (*ShowClusterSetting) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowClusterSetting) StatementTag

func (*ShowClusterSetting) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowClusterSetting) StatementType

func (*ShowClusterSetting) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowClusterSetting) String

func (n *ShowClusterSetting) String() string

type ShowClusterSettingList

type ShowClusterSettingList struct {
	// All indicates whether to include non-public settings in the output.
	All bool
}

ShowClusterSettingList represents a SHOW [ALL|PUBLIC] CLUSTER SETTINGS statement.

func (*ShowClusterSettingList) Format

func (node *ShowClusterSettingList) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowClusterSettingList) StatementReturnType

func (*ShowClusterSettingList) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowClusterSettingList) StatementTag

func (*ShowClusterSettingList) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowClusterSettingList) StatementType

func (*ShowClusterSettingList) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowClusterSettingList) String

func (n *ShowClusterSettingList) String() string

type ShowColumns

type ShowColumns struct {
	Table       *UnresolvedObjectName
	WithComment bool
}

ShowColumns represents a SHOW COLUMNS statement.

func (*ShowColumns) Format

func (node *ShowColumns) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowColumns) StatementReturnType

func (*ShowColumns) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowColumns) StatementTag

func (*ShowColumns) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowColumns) StatementType

func (*ShowColumns) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowColumns) String

func (n *ShowColumns) String() string

type ShowCommitTimestamp

type ShowCommitTimestamp struct{}

ShowCommitTimestamp represents a SHOW COMMIT TIMESTAMP statement.

If the current session is in an open transaction state, this statement will implicitly commit the underlying kv transaction and return the HLC timestamp at which it committed. The transaction state machine will be left in a state such that only COMMIT or RELEASE cockroach_savepoint; COMMIT are acceptable. The statement may also be sent after RELEASE cockroach_savepoint; and before COMMIT.

If the current session is not in an open transaction state, this statement will return the commit timestamp of the previous transaction, assuming there was one.

func (ShowCommitTimestamp) Format

func (s ShowCommitTimestamp) Format(ctx *FmtCtx)

func (*ShowCommitTimestamp) StatementReturnType

func (*ShowCommitTimestamp) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowCommitTimestamp) StatementTag

func (*ShowCommitTimestamp) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowCommitTimestamp) StatementType

func (*ShowCommitTimestamp) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowCommitTimestamp) String

func (n *ShowCommitTimestamp) String() string

type ShowCompletions

type ShowCompletions struct {
	Statement *StrVal
	Offset    *NumVal
}

ShowCompletions represents a SHOW COMPLETIONS statement.

func (ShowCompletions) Format

func (s ShowCompletions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowCompletions) StatementReturnType

func (*ShowCompletions) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowCompletions) StatementTag

func (*ShowCompletions) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowCompletions) StatementType

func (*ShowCompletions) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowCompletions) String

func (n *ShowCompletions) String() string

type ShowConstraints

type ShowConstraints struct {
	Table       *UnresolvedObjectName
	WithComment bool
}

ShowConstraints represents a SHOW CONSTRAINTS statement.

func (*ShowConstraints) Format

func (node *ShowConstraints) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowConstraints) StatementReturnType

func (*ShowConstraints) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowConstraints) StatementTag

func (*ShowConstraints) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowConstraints) StatementType

func (*ShowConstraints) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowConstraints) String

func (n *ShowConstraints) String() string

type ShowCreate

type ShowCreate struct {
	Mode   ShowCreateMode
	Name   *UnresolvedObjectName
	FmtOpt ShowCreateFormatOption
}

ShowCreate represents a SHOW CREATE statement.

func (*ShowCreate) Format

func (node *ShowCreate) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowCreate) StatementReturnType

func (*ShowCreate) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowCreate) StatementTag

func (*ShowCreate) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowCreate) StatementType

func (*ShowCreate) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowCreate) String

func (n *ShowCreate) String() string

type ShowCreateAllSchemas

type ShowCreateAllSchemas struct{}

ShowCreateAllSchemas represents a SHOW CREATE ALL SCHEMAS statement.

func (*ShowCreateAllSchemas) Format

func (node *ShowCreateAllSchemas) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowCreateAllSchemas) StatementReturnType

func (*ShowCreateAllSchemas) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowCreateAllSchemas) StatementTag

func (*ShowCreateAllSchemas) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowCreateAllSchemas) StatementType

func (*ShowCreateAllSchemas) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowCreateAllSchemas) String

func (n *ShowCreateAllSchemas) String() string

type ShowCreateAllTables

type ShowCreateAllTables struct{}

ShowCreateAllTables represents a SHOW CREATE ALL TABLES statement.

func (*ShowCreateAllTables) Format

func (node *ShowCreateAllTables) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowCreateAllTables) StatementReturnType

func (*ShowCreateAllTables) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowCreateAllTables) StatementTag

func (*ShowCreateAllTables) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowCreateAllTables) StatementType

func (*ShowCreateAllTables) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowCreateAllTables) String

func (n *ShowCreateAllTables) String() string

type ShowCreateAllTypes

type ShowCreateAllTypes struct{}

ShowCreateAllTypes represents a SHOW CREATE ALL TYPES statement.

func (*ShowCreateAllTypes) Format

func (node *ShowCreateAllTypes) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowCreateAllTypes) StatementReturnType

func (*ShowCreateAllTypes) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowCreateAllTypes) StatementTag

func (*ShowCreateAllTypes) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowCreateAllTypes) StatementType

func (*ShowCreateAllTypes) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowCreateAllTypes) String

func (n *ShowCreateAllTypes) String() string

type ShowCreateExternalConnections

type ShowCreateExternalConnections struct {
	ConnectionLabel Expr
}

ShowCreateExternalConnections represents a SHOW CREATE EXTERNAL CONNECTION statement.

func (*ShowCreateExternalConnections) Format

func (node *ShowCreateExternalConnections) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowCreateExternalConnections) StatementReturnType

func (*ShowCreateExternalConnections) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowCreateExternalConnections) StatementTag

func (*ShowCreateExternalConnections) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowCreateExternalConnections) StatementType

StatementType implements the Statement interface.

func (*ShowCreateExternalConnections) String

type ShowCreateFormatOption

type ShowCreateFormatOption int
const (
	ShowCreateFormatOptionNone ShowCreateFormatOption = iota
	ShowCreateFormatOptionRedactedValues
)

type ShowCreateMode

type ShowCreateMode int

ShowCreateMode denotes what kind of SHOW CREATE should be used

const (
	// ShowCreateModeTable represents SHOW CREATE TABLE
	ShowCreateModeTable ShowCreateMode = iota
	// ShowCreateModeView represents SHOW CREATE VIEW
	ShowCreateModeView
	// ShowCreateModeSequence represents SHOW CREATE SEQUENCE
	ShowCreateModeSequence
	// ShowCreateModeDatabase represents SHOW CREATE DATABASE
	ShowCreateModeDatabase
	// ShowCreateModeIndexes represents SHOW CREATE INDEXES FROM
	ShowCreateModeIndexes
	// ShowCreateModeSecondaryIndexes represents SHOW CREATE SECONDARY INDEXES FROM
	ShowCreateModeSecondaryIndexes
)

type ShowCreateRoutine

type ShowCreateRoutine struct {
	Name      ResolvableFunctionReference
	Procedure bool
}

ShowCreateRoutine represents a SHOW CREATE FUNCTION or SHOW CREATE PROCEDURE statement.

func (*ShowCreateRoutine) Format

func (node *ShowCreateRoutine) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowCreateRoutine) StatementReturnType

func (*ShowCreateRoutine) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowCreateRoutine) StatementTag

func (n *ShowCreateRoutine) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowCreateRoutine) StatementType

func (*ShowCreateRoutine) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowCreateRoutine) String

func (n *ShowCreateRoutine) String() string

type ShowCreateSchedules

type ShowCreateSchedules struct {
	ScheduleID Expr
}

ShowCreateSchedules represents a SHOW CREATE SCHEDULE statement.

func (*ShowCreateSchedules) Format

func (node *ShowCreateSchedules) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowCreateSchedules) StatementReturnType

func (*ShowCreateSchedules) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowCreateSchedules) StatementTag

func (*ShowCreateSchedules) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowCreateSchedules) StatementType

func (*ShowCreateSchedules) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowCreateSchedules) String

func (n *ShowCreateSchedules) String() string

type ShowDatabaseIndexes

type ShowDatabaseIndexes struct {
	Database    Name
	WithComment bool
}

ShowDatabaseIndexes represents a SHOW INDEXES FROM DATABASE statement.

func (*ShowDatabaseIndexes) Format

func (node *ShowDatabaseIndexes) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowDatabaseIndexes) StatementReturnType

func (*ShowDatabaseIndexes) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowDatabaseIndexes) StatementTag

func (*ShowDatabaseIndexes) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowDatabaseIndexes) StatementType

func (*ShowDatabaseIndexes) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowDatabaseIndexes) String

func (n *ShowDatabaseIndexes) String() string

type ShowDatabases

type ShowDatabases struct {
	WithComment bool
}

ShowDatabases represents a SHOW DATABASES statement.

func (*ShowDatabases) Format

func (node *ShowDatabases) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowDatabases) StatementReturnType

func (*ShowDatabases) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowDatabases) StatementTag

func (*ShowDatabases) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowDatabases) StatementType

func (*ShowDatabases) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowDatabases) String

func (n *ShowDatabases) String() string

type ShowDefaultPrivileges

type ShowDefaultPrivileges struct {
	Roles       RoleSpecList
	ForAllRoles bool
	ForGrantee  bool
	// If Schema is not specified, SHOW DEFAULT PRIVILEGES is being
	// run on the current database.
	Schema Name
}

ShowDefaultPrivileges represents a SHOW DEFAULT PRIVILEGES statement.

func (*ShowDefaultPrivileges) Format

func (n *ShowDefaultPrivileges) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowDefaultPrivileges) StatementReturnType

func (*ShowDefaultPrivileges) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowDefaultPrivileges) StatementTag

func (*ShowDefaultPrivileges) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowDefaultPrivileges) StatementType

func (*ShowDefaultPrivileges) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowDefaultPrivileges) String

func (n *ShowDefaultPrivileges) String() string

type ShowEnums

type ShowEnums struct {
	ObjectNamePrefix
}

ShowEnums represents a SHOW ENUMS statement.

func (*ShowEnums) Format

func (node *ShowEnums) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowEnums) StatementReturnType

func (*ShowEnums) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowEnums) StatementTag

func (*ShowEnums) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowEnums) StatementType

func (*ShowEnums) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowEnums) String

func (n *ShowEnums) String() string

type ShowFingerprints

type ShowFingerprints struct {
	TenantSpec *TenantSpec
	Table      *UnresolvedObjectName
}

ShowFingerprints represents a SHOW EXPERIMENTAL_FINGERPRINTS statement.

func (*ShowFingerprints) Format

func (node *ShowFingerprints) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowFingerprints) StatementReturnType

func (*ShowFingerprints) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowFingerprints) StatementTag

func (*ShowFingerprints) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowFingerprints) StatementType

func (*ShowFingerprints) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowFingerprints) String

func (n *ShowFingerprints) String() string

type ShowFullTableScans

type ShowFullTableScans struct {
}

ShowFullTableScans represents a SHOW FULL TABLE SCANS statement.

func (*ShowFullTableScans) Format

func (node *ShowFullTableScans) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowFullTableScans) StatementReturnType

func (*ShowFullTableScans) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowFullTableScans) StatementTag

func (*ShowFullTableScans) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowFullTableScans) StatementType

func (*ShowFullTableScans) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowFullTableScans) String

func (n *ShowFullTableScans) String() string

type ShowGrants

type ShowGrants struct {
	Targets  *GrantTargetList
	Grantees RoleSpecList
}

ShowGrants represents a SHOW GRANTS statement. GrantTargetList is defined in grant.go.

func (*ShowGrants) Format

func (node *ShowGrants) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowGrants) StatementReturnType

func (*ShowGrants) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowGrants) StatementTag

func (*ShowGrants) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowGrants) StatementType

func (*ShowGrants) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowGrants) String

func (n *ShowGrants) String() string

type ShowHistogram

type ShowHistogram struct {
	HistogramID int64
}

ShowHistogram represents a SHOW HISTOGRAM statement.

func (*ShowHistogram) Format

func (node *ShowHistogram) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowHistogram) StatementReturnType

func (*ShowHistogram) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowHistogram) StatementTag

func (*ShowHistogram) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowHistogram) StatementType

func (*ShowHistogram) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowHistogram) String

func (n *ShowHistogram) String() string

type ShowIndexes

type ShowIndexes struct {
	Table       *UnresolvedObjectName
	WithComment bool
}

ShowIndexes represents a SHOW INDEX statement.

func (*ShowIndexes) Format

func (node *ShowIndexes) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowIndexes) StatementReturnType

func (*ShowIndexes) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowIndexes) StatementTag

func (*ShowIndexes) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowIndexes) StatementType

func (*ShowIndexes) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowIndexes) String

func (n *ShowIndexes) String() string

type ShowJobOptions

type ShowJobOptions struct {
	// ExecutionDetails, if true, will render job specific details about the job's
	// execution. These details will provide improved observability into the
	// execution of the job.
	ExecutionDetails bool
}

ShowJobOptions describes options for the SHOW JOB execution.

func (*ShowJobOptions) CombineWith

func (s *ShowJobOptions) CombineWith(other *ShowJobOptions) error

func (*ShowJobOptions) Format

func (s *ShowJobOptions) Format(ctx *FmtCtx)

type ShowJobs

type ShowJobs struct {
	// If non-nil, a select statement that provides the job ids to be shown.
	Jobs *Select

	// If Automatic is true, show only automatically-generated jobs such
	// as automatic CREATE STATISTICS jobs. If Automatic is false, show
	// only non-automatically-generated jobs.
	Automatic bool

	// Whether to block and wait for completion of all running jobs to be displayed.
	Block bool

	// If non-nil, only display jobs started by the specified
	// schedules.
	Schedules *Select

	// Options contain any options that were specified in the `SHOW JOB` query.
	Options *ShowJobOptions
}

ShowJobs represents a SHOW JOBS statement

func (*ShowJobs) Format

func (node *ShowJobs) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowJobs) StatementReturnType

func (*ShowJobs) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowJobs) StatementTag

func (*ShowJobs) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowJobs) StatementType

func (*ShowJobs) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowJobs) String

func (n *ShowJobs) String() string

type ShowLastQueryStatistics

type ShowLastQueryStatistics struct {
	Columns NameList
}

ShowLastQueryStatistics represents a SHOW LAST QUERY STATS statement.

func (*ShowLastQueryStatistics) Format

func (node *ShowLastQueryStatistics) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowLastQueryStatistics) StatementReturnType

func (*ShowLastQueryStatistics) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowLastQueryStatistics) StatementTag

func (*ShowLastQueryStatistics) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowLastQueryStatistics) StatementType

func (*ShowLastQueryStatistics) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowLastQueryStatistics) String

func (n *ShowLastQueryStatistics) String() string

type ShowPartitions

type ShowPartitions struct {
	IsDB     bool
	Database Name

	IsIndex bool
	Index   TableIndexName

	IsTable bool
	Table   *UnresolvedObjectName
}

ShowPartitions represents a SHOW PARTITIONS statement.

func (*ShowPartitions) Format

func (node *ShowPartitions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowPartitions) StatementReturnType

func (*ShowPartitions) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowPartitions) StatementTag

func (*ShowPartitions) StatementTag() string

StatementTag returns a short string identifying the type of the statement.

func (*ShowPartitions) StatementType

func (*ShowPartitions) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowPartitions) String

func (n *ShowPartitions) String() string

type ShowQueries

type ShowQueries struct {
	All     bool
	Cluster bool
}

ShowQueries represents a SHOW STATEMENTS statement.

func (*ShowQueries) Format

func (node *ShowQueries) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowQueries) StatementReturnType

func (*ShowQueries) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowQueries) StatementTag

func (*ShowQueries) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowQueries) StatementType

func (*ShowQueries) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowQueries) String

func (n *ShowQueries) String() string

type ShowRangeForRow

type ShowRangeForRow struct {
	TableOrIndex TableIndexName
	Row          Exprs
}

ShowRangeForRow represents a SHOW RANGE FOR ROW statement.

func (*ShowRangeForRow) Format

func (node *ShowRangeForRow) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowRangeForRow) StatementReturnType

func (*ShowRangeForRow) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowRangeForRow) StatementTag

func (*ShowRangeForRow) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowRangeForRow) StatementType

func (*ShowRangeForRow) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowRangeForRow) String

func (n *ShowRangeForRow) String() string

type ShowRanges

type ShowRanges struct {
	DatabaseName Name
	TableOrIndex TableIndexName
	Options      *ShowRangesOptions
	Source       ShowRangesSource
}

ShowRanges represents a SHOW RANGES statement.

func (*ShowRanges) Format

func (node *ShowRanges) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowRanges) StatementReturnType

func (*ShowRanges) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowRanges) StatementTag

func (*ShowRanges) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowRanges) StatementType

func (*ShowRanges) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowRanges) String

func (n *ShowRanges) String() string

type ShowRangesMode

type ShowRangesMode int8

ShowRangesMode represents the WITH clause in SHOW RANGES.

const (
	// UniqueRanges tells to use just 1 row per range in the output.
	//
	// Note: The UniqueRanges constant must have value 0; otherwise,
	// the parsing logic would become incorrect.
	UniqueRanges ShowRangesMode = iota
	// ExpandTables requests one row per table in the output.
	ExpandTables
	// ExpandIndexes requests one row per index in the output.
	ExpandIndexes
)

type ShowRangesOptions

type ShowRangesOptions struct {
	Details bool
	Explain bool
	Keys    bool
	Mode    ShowRangesMode
}

ShowRangesOptions represents the WITH clause in SHOW RANGES.

func (*ShowRangesOptions) Format

func (node *ShowRangesOptions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type ShowRangesSource

type ShowRangesSource int8

ShowRangesSource represents the source of a SHOW RANGES statement.

const (
	// SHOW RANGES FROM CURRENT_CATALOG
	ShowRangesCurrentDatabase ShowRangesSource = iota
	// SHOW RANGES FROM DATABASE
	ShowRangesDatabase
	// SHOW RANGES FROM TABLE
	ShowRangesTable
	// SHOW RANGES FROM INDEX
	ShowRangesIndex
	// SHOW CLUSTER RANGES
	ShowRangesCluster
)

type ShowRegions

type ShowRegions struct {
	ShowRegionsFrom ShowRegionsFrom
	DatabaseName    Name
}

ShowRegions represents a SHOW REGIONS statement

func (*ShowRegions) Format

func (node *ShowRegions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowRegions) StatementReturnType

func (*ShowRegions) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowRegions) StatementTag

func (*ShowRegions) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowRegions) StatementType

func (*ShowRegions) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowRegions) String

func (n *ShowRegions) String() string

type ShowRegionsFrom

type ShowRegionsFrom int

ShowRegionsFrom denotes what kind of SHOW REGIONS command is being used.

const (
	// ShowRegionsFromCluster represents SHOW REGIONS FROM CLUSTER.
	ShowRegionsFromCluster ShowRegionsFrom = iota
	// ShowRegionsFromDatabase represents SHOW REGIONS FROM DATABASE.
	ShowRegionsFromDatabase
	// ShowRegionsFromAllDatabases represents SHOW REGIONS FROM ALL DATABASES.
	ShowRegionsFromAllDatabases
	// ShowRegionsFromDefault represents SHOW REGIONS.
	ShowRegionsFromDefault
	// ShowSuperRegionsFromDatabase represents SHOW SUPER REGIONS FROM DATABASE.
	ShowSuperRegionsFromDatabase
)

type ShowRoleGrants

type ShowRoleGrants struct {
	Roles    RoleSpecList
	Grantees RoleSpecList
}

ShowRoleGrants represents a SHOW GRANTS ON ROLE statement.

func (*ShowRoleGrants) Format

func (node *ShowRoleGrants) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowRoleGrants) StatementReturnType

func (*ShowRoleGrants) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowRoleGrants) StatementTag

func (*ShowRoleGrants) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowRoleGrants) StatementType

func (*ShowRoleGrants) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowRoleGrants) String

func (n *ShowRoleGrants) String() string

type ShowRoles

type ShowRoles struct {
}

ShowRoles represents a SHOW ROLES statement.

func (*ShowRoles) Format

func (node *ShowRoles) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowRoles) StatementReturnType

func (*ShowRoles) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowRoles) StatementTag

func (*ShowRoles) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowRoles) StatementType

func (*ShowRoles) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowRoles) String

func (n *ShowRoles) String() string

type ShowRoutines

type ShowRoutines struct {
	ObjectNamePrefix
	Procedure bool
}

ShowRoutines represents a SHOW FUNCTIONS or SHOW PROCEDURES statement.

func (*ShowRoutines) Format

func (node *ShowRoutines) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowRoutines) StatementReturnType

func (*ShowRoutines) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowRoutines) StatementTag

func (n *ShowRoutines) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowRoutines) StatementType

func (*ShowRoutines) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowRoutines) String

func (n *ShowRoutines) String() string

type ShowSavepointStatus

type ShowSavepointStatus struct {
}

ShowSavepointStatus represents a SHOW SAVEPOINT STATUS statement.

func (*ShowSavepointStatus) Format

func (node *ShowSavepointStatus) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowSavepointStatus) StatementReturnType

func (*ShowSavepointStatus) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowSavepointStatus) StatementTag

func (*ShowSavepointStatus) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowSavepointStatus) StatementType

func (*ShowSavepointStatus) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowSavepointStatus) String

func (n *ShowSavepointStatus) String() string

type ShowSchedules

type ShowSchedules struct {
	WhichSchedules ScheduleState
	ExecutorType   ScheduledJobExecutorType
	ScheduleID     Expr
}

ShowSchedules represents a SHOW SCHEDULES statement.

func (*ShowSchedules) Format

func (n *ShowSchedules) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowSchedules) StatementReturnType

func (*ShowSchedules) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowSchedules) StatementTag

func (*ShowSchedules) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowSchedules) StatementType

func (*ShowSchedules) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowSchedules) String

func (n *ShowSchedules) String() string

type ShowSchemas

type ShowSchemas struct {
	Database Name
}

ShowSchemas represents a SHOW SCHEMAS statement.

func (*ShowSchemas) Format

func (node *ShowSchemas) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowSchemas) StatementReturnType

func (*ShowSchemas) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowSchemas) StatementTag

func (*ShowSchemas) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowSchemas) StatementType

func (*ShowSchemas) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowSchemas) String

func (n *ShowSchemas) String() string

type ShowSequences

type ShowSequences struct {
	Database Name
}

ShowSequences represents a SHOW SEQUENCES statement.

func (*ShowSequences) Format

func (node *ShowSequences) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowSequences) StatementReturnType

func (*ShowSequences) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowSequences) StatementTag

func (*ShowSequences) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowSequences) StatementType

func (*ShowSequences) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowSequences) String

func (n *ShowSequences) String() string

type ShowSessions

type ShowSessions struct {
	All     bool
	Cluster bool
}

ShowSessions represents a SHOW SESSIONS statement

func (*ShowSessions) Format

func (node *ShowSessions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowSessions) StatementReturnType

func (*ShowSessions) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowSessions) StatementTag

func (*ShowSessions) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowSessions) StatementType

func (*ShowSessions) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowSessions) String

func (n *ShowSessions) String() string

type ShowSurvivalGoal

type ShowSurvivalGoal struct {
	DatabaseName Name
}

ShowSurvivalGoal represents a SHOW SURVIVAL GOAL statement

func (*ShowSurvivalGoal) Format

func (node *ShowSurvivalGoal) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowSurvivalGoal) StatementReturnType

func (*ShowSurvivalGoal) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowSurvivalGoal) StatementTag

func (*ShowSurvivalGoal) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowSurvivalGoal) StatementType

func (*ShowSurvivalGoal) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowSurvivalGoal) String

func (n *ShowSurvivalGoal) String() string

type ShowSyntax

type ShowSyntax struct {
	Statement string
}

ShowSyntax represents a SHOW SYNTAX statement. This the most lightweight thing that can be done on a statement server-side: just report the statement that was entered without any processing. Meant for use for syntax checking on clients, when the client version might differ from the server.

func (*ShowSyntax) Format

func (node *ShowSyntax) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowSyntax) StatementReturnType

func (*ShowSyntax) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowSyntax) StatementTag

func (*ShowSyntax) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowSyntax) StatementType

func (*ShowSyntax) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowSyntax) String

func (n *ShowSyntax) String() string

type ShowTableStats

type ShowTableStats struct {
	Table     *UnresolvedObjectName
	UsingJSON bool
	Options   KVOptions
}

ShowTableStats represents a SHOW STATISTICS FOR TABLE statement.

func (*ShowTableStats) Format

func (node *ShowTableStats) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowTableStats) StatementReturnType

func (*ShowTableStats) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowTableStats) StatementTag

func (*ShowTableStats) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowTableStats) StatementType

func (*ShowTableStats) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowTableStats) String

func (n *ShowTableStats) String() string

type ShowTables

type ShowTables struct {
	ObjectNamePrefix
	WithComment bool
}

ShowTables represents a SHOW TABLES statement.

func (*ShowTables) Format

func (node *ShowTables) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowTables) StatementReturnType

func (*ShowTables) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowTables) StatementTag

func (*ShowTables) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowTables) StatementType

func (*ShowTables) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowTables) String

func (n *ShowTables) String() string

type ShowTenant

type ShowTenant struct {
	TenantSpec *TenantSpec
	ShowTenantOptions
}

ShowTenant represents a SHOW VIRTUAL CLUSTER statement.

func (*ShowTenant) Format

func (node *ShowTenant) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowTenant) StatementReturnType

func (*ShowTenant) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowTenant) StatementTag

func (*ShowTenant) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowTenant) StatementType

func (*ShowTenant) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowTenant) String

func (n *ShowTenant) String() string

type ShowTenantClusterSetting

type ShowTenantClusterSetting struct {
	*ShowClusterSetting
	TenantSpec *TenantSpec
}

ShowTenantClusterSetting represents a SHOW CLUSTER SETTING ... FOR VIRTUAL CLUSTER statement.

func (*ShowTenantClusterSetting) Format

func (node *ShowTenantClusterSetting) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowTenantClusterSetting) StatementReturnType

func (*ShowTenantClusterSetting) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowTenantClusterSetting) StatementTag

func (*ShowTenantClusterSetting) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowTenantClusterSetting) StatementType

func (*ShowTenantClusterSetting) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowTenantClusterSetting) String

func (n *ShowTenantClusterSetting) String() string

type ShowTenantClusterSettingList

type ShowTenantClusterSettingList struct {
	*ShowClusterSettingList
	TenantSpec *TenantSpec
}

ShowTenantClusterSettingList represents a SHOW CLUSTER SETTINGS FOR VIRTUAL CLUSTER statement.

func (*ShowTenantClusterSettingList) Format

func (node *ShowTenantClusterSettingList) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowTenantClusterSettingList) StatementReturnType

func (*ShowTenantClusterSettingList) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowTenantClusterSettingList) StatementTag

func (*ShowTenantClusterSettingList) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowTenantClusterSettingList) StatementType

StatementType implements the Statement interface.

func (*ShowTenantClusterSettingList) String

type ShowTenantOptions

type ShowTenantOptions struct {
	WithReplication  bool
	WithCapabilities bool
}

ShowTenantOptions represents the WITH clause in SHOW VIRTUAL CLUSTER.

type ShowTraceForSession

type ShowTraceForSession struct {
	TraceType ShowTraceType
	Compact   bool
}

ShowTraceForSession represents a SHOW TRACE FOR SESSION statement.

func (*ShowTraceForSession) Format

func (node *ShowTraceForSession) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowTraceForSession) StatementReturnType

func (*ShowTraceForSession) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowTraceForSession) StatementTag

func (*ShowTraceForSession) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowTraceForSession) StatementType

func (*ShowTraceForSession) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowTraceForSession) String

func (n *ShowTraceForSession) String() string

type ShowTraceType

type ShowTraceType string

ShowTraceType is an enum of SHOW TRACE variants.

const (
	ShowTraceRaw     ShowTraceType = "TRACE"
	ShowTraceKV      ShowTraceType = "KV TRACE"
	ShowTraceReplica ShowTraceType = "EXPERIMENTAL_REPLICA TRACE"
)

A list of the SHOW TRACE variants.

type ShowTransactionStatus

type ShowTransactionStatus struct {
}

ShowTransactionStatus represents a SHOW TRANSACTION STATUS statement.

func (*ShowTransactionStatus) Format

func (node *ShowTransactionStatus) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowTransactionStatus) StatementReturnType

func (*ShowTransactionStatus) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowTransactionStatus) StatementTag

func (*ShowTransactionStatus) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowTransactionStatus) StatementType

func (*ShowTransactionStatus) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowTransactionStatus) String

func (n *ShowTransactionStatus) String() string

type ShowTransactions

type ShowTransactions struct {
	All     bool
	Cluster bool
}

ShowTransactions represents a SHOW TRANSACTIONS statement

func (*ShowTransactions) Format

func (node *ShowTransactions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowTransactions) StatementReturnType

func (*ShowTransactions) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface

func (*ShowTransactions) StatementTag

func (*ShowTransactions) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowTransactions) StatementType

func (*ShowTransactions) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowTransactions) String

func (n *ShowTransactions) String() string

type ShowTransferState

type ShowTransferState struct {
	TransferKey *StrVal
}

ShowTransferState represents a SHOW TRANSFER STATE statement.

func (*ShowTransferState) Format

func (node *ShowTransferState) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowTransferState) StatementReturnType

func (*ShowTransferState) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowTransferState) StatementTag

func (*ShowTransferState) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowTransferState) StatementType

func (*ShowTransferState) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowTransferState) String

func (n *ShowTransferState) String() string

type ShowTypes

type ShowTypes struct{}

ShowTypes represents a SHOW TYPES statement.

func (*ShowTypes) Format

func (node *ShowTypes) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowTypes) StatementReturnType

func (*ShowTypes) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowTypes) StatementTag

func (*ShowTypes) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowTypes) StatementType

func (*ShowTypes) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowTypes) String

func (n *ShowTypes) String() string

type ShowUsers

type ShowUsers struct {
}

ShowUsers represents a SHOW USERS statement.

func (*ShowUsers) Format

func (node *ShowUsers) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowUsers) StatementReturnType

func (*ShowUsers) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowUsers) StatementTag

func (*ShowUsers) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowUsers) StatementType

func (*ShowUsers) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowUsers) String

func (n *ShowUsers) String() string

type ShowVar

type ShowVar struct {
	Name string
}

ShowVar represents a SHOW statement.

func (*ShowVar) Format

func (node *ShowVar) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowVar) StatementReturnType

func (*ShowVar) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowVar) StatementTag

func (*ShowVar) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowVar) StatementType

func (*ShowVar) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowVar) String

func (n *ShowVar) String() string

type ShowZoneConfig

type ShowZoneConfig struct {
	ZoneSpecifier
}

ShowZoneConfig represents a SHOW ZONE CONFIGURATION statement.

func (*ShowZoneConfig) Format

func (node *ShowZoneConfig) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ShowZoneConfig) StatementReturnType

func (*ShowZoneConfig) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ShowZoneConfig) StatementTag

func (*ShowZoneConfig) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowZoneConfig) StatementType

func (*ShowZoneConfig) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowZoneConfig) String

func (n *ShowZoneConfig) String() string

type SimilarToOp

type SimilarToOp struct {
	Escape          rune
	CaseInsensitive bool
}

SimilarToOp is a BinaryEvalOp.

func (*SimilarToOp) Eval

func (op *SimilarToOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error)

Eval is part of the BinaryEvalOp interface.

type SimpleVisitFn

type SimpleVisitFn func(expr Expr) (recurse bool, newExpr Expr, err error)

SimpleVisitFn is a function that is run for every node in the VisitPre stage; see SimpleVisit.

type SizeBatchParam

type SizeBatchParam struct {
	// Size is the expression specified by SIZE <size>.
	// It must be positive.
	Size Expr
}

SizeBatchParam represents a BATCH (SIZE size) parameter.

func (*SizeBatchParam) Format

func (p *SizeBatchParam) Format(ctx *FmtCtx)

Format implements NodeFormatter.

type SpecializedVectorizedBuiltin

type SpecializedVectorizedBuiltin int

SpecializedVectorizedBuiltin is used to map overloads to the vectorized operator that is specific to that implementation of the builtin function.

const (
	SubstringStringIntInt SpecializedVectorizedBuiltin
	CrdbInternalRangeStats
)

Keep this list alphabetized so that it is easy to manage.

type Split

type Split struct {
	TableOrIndex TableIndexName
	// Each row contains values for the columns in the PK or index (or a prefix
	// of the columns).
	Rows *Select
	// Splits can last a specified amount of time before becoming eligible for
	// automatic merging.
	ExpireExpr Expr
}

Split represents an `ALTER TABLE/INDEX .. SPLIT AT ..` statement.

func (*Split) Format

func (node *Split) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Split) StatementReturnType

func (*Split) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Split) StatementTag

func (*Split) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Split) StatementType

func (*Split) StatementType() StatementType

StatementType implements the Statement interface.

func (*Split) String

func (n *Split) String() string

type SqrtDecimalOp

type SqrtDecimalOp struct{}

SqrtDecimalOp is a UnaryEvalOp.

func (*SqrtDecimalOp) Eval

func (op *SqrtDecimalOp) Eval(ctx context.Context, e OpEvaluator, v Datum) (Datum, error)

Eval is part of the UnaryEvalOp interface.

type SqrtFloatOp

type SqrtFloatOp struct{}

SqrtFloatOp is a UnaryEvalOp.

func (*SqrtFloatOp) Eval

func (op *SqrtFloatOp) Eval(ctx context.Context, e OpEvaluator, v Datum) (Datum, error)

Eval is part of the UnaryEvalOp interface.

type Statement

type Statement interface {
	fmt.Stringer
	NodeFormatter

	// StatementReturnType is the return styles on the wire
	// (Ack, DDL, RowsAffected, Rows, CopyIn or Unknown)
	StatementReturnType() StatementReturnType
	// StatementType identifies whether the statement is a DDL, DML, DCL, or TCL.
	StatementType() StatementType
	// StatementTag is a short string identifying the type of statement
	// (usually a single verb). This is different than the Stringer output,
	// which is the actual statement (including args).
	// TODO(dt): Currently tags are always pg-compatible in the future it
	// might make sense to pass a tag format specifier.
	StatementTag() string
}

Statement represents a statement.

func MakeExplain

func MakeExplain(options []string, stmt Statement) (Statement, error)

MakeExplain parses the EXPLAIN option strings and generates an Explain or ExplainAnalyze statement.

func SimpleStmtVisit

func SimpleStmtVisit(stmt Statement, preFn SimpleVisitFn) (Statement, error)

SimpleStmtVisit is a convenience wrapper for visitors that want to visit all part of a statement, only have VisitPre code and don't return any results except an error. The given function is called in VisitPre for every node. The visitor stops as soon as an error is returned.

type StatementReturnType

type StatementReturnType int

StatementReturnType is the enumerated type for Statement return styles on the wire.

const (
	// Ack indicates that the statement does not have a meaningful
	// return. Examples include SET, BEGIN, COMMIT.
	Ack StatementReturnType = iota
	// DDL indicates that the statement mutates the database schema.
	//
	// Note: this is the type indicated back to the client; it is not a
	// sufficient test for schema mutation for planning purposes. There
	// are schema-modifying statements (e.g. CREATE TABLE AS) which
	// report RowsAffected to the client, not DDL.
	// Use CanModifySchema() below instead.
	DDL
	// RowsAffected indicates that the statement returns the count of
	// affected rows.
	RowsAffected
	// Rows indicates that the statement returns the affected rows after
	// the statement was applied.
	Rows
	// CopyIn indicates a COPY FROM statement.
	CopyIn
	// CopyOut indicates a COPY TO statement.
	CopyOut
	// Replication indicates a replication protocol statement.
	Replication
	// Unknown indicates that the statement does not have a known
	// return style at the time of parsing. This is not first in the
	// enumeration because it is more convenient to have Ack as a zero
	// value, and because the use of Unknown should be an explicit choice.
	// The primary example of this statement type is EXECUTE, where the
	// statement type depends on the statement type of the prepared statement
	// being executed.
	Unknown
)

func (StatementReturnType) String

func (i StatementReturnType) String() string

type StatementSource

type StatementSource struct {
	Statement Statement
}

StatementSource encapsulates one of the other statements as a data source.

func (*StatementSource) Format

func (node *StatementSource) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*StatementSource) WalkTableExpr

func (expr *StatementSource) WalkTableExpr(v Visitor) TableExpr

WalkTableExpr implements the TableExpr interface.

type StatementType

type StatementType int

StatementType is the enumerated type for Statement type return

const (
	// DDL (Data Definition Language) deals with database schemas and descriptions.
	TypeDDL StatementType = iota
	// DML (Data Manipulation Language) deals with data manipulation and it is used to
	// store, modify, retrieve, delete and update data in a database.
	TypeDML
	// DCL (Data Control Language) deals with commands such as GRANT and mostly
	// concerned with rights, permissions and other controls of the database system.
	TypeDCL
	// TCL (Transaction Control Language) deals with a transaction within a database.
	TypeTCL
)

func (StatementType) String

func (i StatementType) String() string

type Statements

type Statements []Statement

Statements represent a list of statements.

type StorageParam

type StorageParam struct {
	Key   Name
	Value Expr
}

StorageParam is a key-value parameter for table storage.

type StorageParams

type StorageParams []StorageParam

StorageParams is a list of StorageParams.

func (*StorageParams) Format

func (o *StorageParams) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*StorageParams) GetVal

func (o *StorageParams) GetVal(key string) Expr

GetVal returns corresponding value if a key exists, otherwise nil is returned.

type StrVal

type StrVal struct {
	// contains filtered or unexported fields
}

StrVal represents a constant string value.

func NewBytesStrVal

func NewBytesStrVal(s string) *StrVal

NewBytesStrVal constructs a StrVal instance suitable as byte array. This is used during parsing when interpreting a token of type BCONST, i.e. using the b'...' or x'...' syntax.

func NewStrVal

func NewStrVal(s string) *StrVal

NewStrVal constructs a StrVal instance. This is used during parsing when interpreting a token of type SCONST, i.e. *not* using the b'...' or x'...' syntax.

func (*StrVal) AvailableTypes

func (expr *StrVal) AvailableTypes() []*types.T

AvailableTypes implements the Constant interface.

To fully take advantage of literal type inference, this method would determine exactly which types are available for a given string. This would entail attempting to parse the literal string as a date, a timestamp, an interval, etc. and having more fine-grained results than StrValAvailAllParsable. However, this is not feasible in practice because of the associated parsing overhead.

Conservative approaches like checking the string's length have been investigated to reduce ambiguity and improve type inference in some cases. When doing so, the length of the string literal was compared against all valid date and timestamp formats to quickly gain limited insight into whether parsing the string as the respective datum types could succeed. The hope was to eliminate impossibilities and constrain the returned type sets as much as possible. Unfortunately, two issues were found with this approach:

  • date and timestamp formats do not always imply a fixed-length valid input. For instance, timestamp formats that take fractional seconds can successfully parse inputs of varied length.
  • the set of date and timestamp formats are not disjoint, which means that ambiguity can not be eliminated when inferring the type of string literals that use these shared formats.

While these limitations still permitted improved type inference in many cases, they resulted in behavior that was ultimately incomplete, resulted in unpredictable levels of inference, and occasionally failed to eliminate ambiguity. Further heuristics could have been applied to improve the accuracy of the inference, like checking that all or some characters were digits, but it would not have circumvented the fundamental issues here. Fully parsing the literal into each type would be the only way to concretely avoid the issue of unpredictable inference behavior.

func (*StrVal) DesirableTypes

func (expr *StrVal) DesirableTypes() []*types.T

DesirableTypes implements the Constant interface.

func (*StrVal) Format

func (expr *StrVal) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*StrVal) RawString

func (expr *StrVal) RawString() string

RawString retrieves the underlying string of the StrVal.

func (*StrVal) ResolveAsType

func (expr *StrVal) ResolveAsType(
	ctx context.Context, semaCtx *SemaContext, typ *types.T,
) (TypedExpr, error)

ResolveAsType implements the Constant interface.

func (*StrVal) String

func (node *StrVal) String() string

func (*StrVal) TypeCheck

func (expr *StrVal) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*StrVal) Walk

func (expr *StrVal) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type StringOrPlaceholderOptList

type StringOrPlaceholderOptList []Expr

StringOrPlaceholderOptList is a list of strings or placeholders.

func (*StringOrPlaceholderOptList) Format

func (node *StringOrPlaceholderOptList) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type Subquery

type Subquery struct {
	Select SelectStatement
	Exists bool

	// Idx is a query-unique index for the subquery.
	// Subqueries are 1-indexed to ensure that the default
	// value 0 can be used to detect uninitialized subqueries.
	Idx int
	// contains filtered or unexported fields
}

Subquery represents a subquery.

func (*Subquery) Eval

func (node *Subquery) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*Subquery) Format

func (node *Subquery) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Subquery) ResolvedType

func (node *Subquery) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*Subquery) SetType

func (node *Subquery) SetType(t *types.T)

SetType forces the type annotation on the Subquery node.

func (*Subquery) String

func (node *Subquery) String() string

func (*Subquery) SubqueryExpr

func (*Subquery) SubqueryExpr()

SubqueryExpr implements the SubqueryExpr interface.

func (*Subquery) TypeCheck

func (expr *Subquery) TypeCheck(_ context.Context, sc *SemaContext, _ *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*Subquery) Variable

func (*Subquery) Variable()

Variable implements the VariableExpr interface.

func (*Subquery) Walk

func (expr *Subquery) Walk(v Visitor) Expr

Walk implements the Expr interface.

func (*Subquery) WalkTableExpr

func (expr *Subquery) WalkTableExpr(v Visitor) TableExpr

WalkTableExpr implements the TableExpr interface.

type SubqueryExpr

type SubqueryExpr interface {
	Expr
	SubqueryExpr()
}

SubqueryExpr is an interface used to identify an expression as a subquery. It is implemented by both tree.Subquery and optbuilder.subquery, and is used in TypeCheck.

type SuperRegion

type SuperRegion struct {
	Name    Name
	Regions NameList
}

func (*SuperRegion) Format

func (node *SuperRegion) Format(ctx *FmtCtx)

type SurvivalGoal

type SurvivalGoal uint32

SurvivalGoal represents the desired survivability level for a given database.

const (
	// SurvivalGoalDefault indicates default survive behavior.
	// This will get translated to the appropriate value when persisted.
	SurvivalGoalDefault SurvivalGoal = iota
	// SurvivalGoalRegionFailure indicates a database being able to withstand
	// an entire region failure.
	SurvivalGoalRegionFailure
	// SurvivalGoalZoneFailure indicates a database being able to
	// withstand a failure of an availibility zone.
	SurvivalGoalZoneFailure
)

func (*SurvivalGoal) Format

func (node *SurvivalGoal) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*SurvivalGoal) TelemetryName

func (node *SurvivalGoal) TelemetryName() string

TelemetryName returns a representation of SurvivalGoal suitable for telemetry

type TSMatchesQueryVectorOp

type TSMatchesQueryVectorOp struct{}

TSMatchesQueryVectorOp is a BinaryEvalOp.

func (*TSMatchesQueryVectorOp) Eval

Eval is part of the BinaryEvalOp interface.

type TSMatchesVectorQueryOp

type TSMatchesVectorQueryOp struct{}

TSMatchesVectorQueryOp is a BinaryEvalOp.

func (*TSMatchesVectorQueryOp) Eval

Eval is part of the BinaryEvalOp interface.

type TableAttrs

type TableAttrs struct {
	SequenceOnly  bool
	TablePatterns TablePatterns
}

TableAttrs saves the table petterns and a bool field SequenceOnly that shows if all tables are sequences.

type TableDef

type TableDef interface {
	NodeFormatter
	// contains filtered or unexported methods
}

TableDef represents a column, index or constraint definition within a CREATE TABLE statement.

type TableDefs

type TableDefs []TableDef

TableDefs represents a list of table definitions.

func (*TableDefs) Format

func (node *TableDefs) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type TableExpr

type TableExpr interface {
	NodeFormatter

	WalkTableExpr(Visitor) TableExpr
	// contains filtered or unexported methods
}

TableExpr represents a table expression.

func StripTableParens

func StripTableParens(expr TableExpr) TableExpr

StripTableParens strips any parentheses surrounding a selection clause.

type TableExprs

type TableExprs []TableExpr

TableExprs represents a list of table expressions.

func (*TableExprs) Format

func (node *TableExprs) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type TableIndexName

type TableIndexName struct {
	Table TableName
	Index UnrestrictedName
}

TableIndexName refers to a table index. There are a few cases:

  • if both the table name and the index name are set, refers to a specific index in a specific table.

  • if the table name is set and index name is empty, refers to the primary index of that table.

  • if the table name is empty and the index name is set, refers to an index of that name among all tables within a catalog/schema; if there is a duplicate name, that will result in an error. Note that it is possible to specify the schema or catalog without specifying a table name; in this case, Table.ObjectNamePrefix has the fields set but Table.ObjectName is empty.

func (*TableIndexName) Format

func (n *TableIndexName) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*TableIndexName) String

func (n *TableIndexName) String() string

type TableIndexNames

type TableIndexNames []*TableIndexName

TableIndexNames is a list of indexes.

func (*TableIndexNames) Format

func (n *TableIndexNames) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type TableName

type TableName struct {
	// contains filtered or unexported fields
}

TableName corresponds to the name of a table in a FROM clause, INSERT or UPDATE statement, etc.

This is constructed for incoming SQL queries from an UnresolvedObjectName,

Internal uses of this struct should not construct instances of TableName directly, and instead use the NewTableName / MakeTableName functions underneath.

TableName is a public type for objName. It exposes the fields and can be default-constructed but cannot be instantiated with a non-default value; this encourages the use of the constructors below.

func MakeTableNameFromPrefix

func MakeTableNameFromPrefix(prefix ObjectNamePrefix, object Name) TableName

MakeTableNameFromPrefix creates a table name from an unqualified name and a resolved prefix.

func MakeTableNameWithSchema

func MakeTableNameWithSchema(db, schema, tbl Name) TableName

MakeTableNameWithSchema creates a new fully qualified table name.

func MakeUnqualifiedTableName

func MakeUnqualifiedTableName(tbl Name) TableName

MakeUnqualifiedTableName creates a new base table name.

func NewTableNameWithSchema

func NewTableNameWithSchema(db, sc, tbl Name) *TableName

NewTableNameWithSchema creates a new table name qualified with a given catalog and schema.

func NewUnqualifiedTableName

func NewUnqualifiedTableName(tbl Name) *TableName

NewUnqualifiedTableName creates a new base table name.

func (*TableName) Equals

func (t *TableName) Equals(other *TableName) bool

Equals returns true if the two table names are identical (including the ExplicitSchema/ExplicitCatalog flags).

func (*TableName) FQString

func (o *TableName) FQString() string

FQString renders the table name in full, not omitting the prefix schema and catalog names. Suitable for logging, etc.

func (*TableName) Format

func (t *TableName) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*TableName) NormalizeTablePattern

func (t *TableName) NormalizeTablePattern() (TablePattern, error)

NormalizeTablePattern implements the TablePattern interface.

func (*TableName) Object

func (o *TableName) Object() string

func (*TableName) String

func (o *TableName) String() string

func (*TableName) Table

func (t *TableName) Table() string

Table retrieves the unqualified table name.

func (*TableName) ToUnresolvedObjectName

func (o *TableName) ToUnresolvedObjectName() *UnresolvedObjectName

ToUnresolvedObjectName converts the type name to an unresolved object name. Schema and catalog are included if indicated by the ExplicitSchema and ExplicitCatalog flags.

func (*TableName) WalkTableExpr

func (expr *TableName) WalkTableExpr(_ Visitor) TableExpr

WalkTableExpr implements the TableExpr interface.

type TableNames

type TableNames []TableName

TableNames represents a comma separated list (see the Format method) of table names.

func (*TableNames) Format

func (ts *TableNames) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*TableNames) String

func (ts *TableNames) String() string

type TablePattern

type TablePattern interface {
	fmt.Stringer
	NodeFormatter

	// NormalizeTablePattern() guarantees to return a pattern that is
	// not an UnresolvedName. This converts the UnresolvedName to an
	// AllTablesSelector or TableName as necessary.
	NormalizeTablePattern() (TablePattern, error)
}

TablePattern is the common interface to UnresolvedName, TableName and AllTablesSelector.

type TablePatterns

type TablePatterns []TablePattern

TablePatterns implement a comma-separated list of table patterns. Used by e.g. the GRANT statement.

func (*TablePatterns) Format

func (tt *TablePatterns) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type TableRef

type TableRef struct {
	// TableID is the descriptor ID of the requested table.
	TableID int64

	// ColumnIDs is the list of column IDs requested in the table.
	// Note that a nil array here means "unspecified" (all columns)
	// whereas an array of length 0 means "zero columns".
	// Lists of zero columns are not supported and will throw an error.
	Columns []ColumnID

	// As determines the names that can be used in the surrounding query
	// to refer to this source.
	As AliasClause
}

TableRef represents a numeric table reference. (Syntax !NNN in SQL.)

func (*TableRef) Format

func (n *TableRef) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*TableRef) String

func (n *TableRef) String() string

func (*TableRef) WalkTableExpr

func (expr *TableRef) WalkTableExpr(_ Visitor) TableExpr

WalkTableExpr implements the TableExpr interface.

type TenantCapability

type TenantCapability struct {
	Name  string
	Value Expr
}

TenantCapability is a key-value parameter representing a tenant capability.

type TenantID

type TenantID struct {
	ID uint64

	// Specified is set to true when the TENANT clause was specified in
	// the backup target input syntax. We need this, instead of relying
	// on ID != 0, because we need a special marker for
	// the case when the value was anonymized. In other places, the
	// value used for anonymized integer literals is 0, but we can't use
	// 0 for TenantID as this is refused during parsing, nor can we use
	// any other value since all non-zero integers are valid tenant IDs.
	Specified bool
}

TenantID represents a tenant ID that can be pretty-printed.

func (*TenantID) Format

func (t *TenantID) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*TenantID) IsSet

func (t *TenantID) IsSet() bool

IsSet returns whether the TenantID is set.

type TenantReplicationOptions

type TenantReplicationOptions struct {
	Retention       Expr
	ResumeTimestamp Expr
}

TenantReplicationOptions options for the CREATE VIRTUAL CLUSTER FROM REPLICATION command.

func (*TenantReplicationOptions) CombineWith

CombineWith merges other TenantReplicationOptions into this struct. An error is returned if the same option merged multiple times.

func (*TenantReplicationOptions) Format

func (o *TenantReplicationOptions) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface

func (TenantReplicationOptions) IsDefault

func (o TenantReplicationOptions) IsDefault() bool

IsDefault returns true if this backup options struct has default value.

type TenantServiceCmd

type TenantServiceCmd int8

TenantServiceCmd represents a parameter to ALTER VIRTUAL CLUSTER.

const (
	// TenantStartServiceExternal encodes START SERVICE EXTERNAL.
	TenantStartServiceExternal TenantServiceCmd = 0
	// TenantStartServiceExternal encodes START SERVICE SHARED.
	TenantStartServiceShared TenantServiceCmd = 1
	// TenantStartServiceExternal encodes STOP SERVICE.
	TenantStopService TenantServiceCmd = 2
)

type TenantSpec

type TenantSpec struct {
	Expr   Expr
	IsName bool
	All    bool
}

TenantSpec designates a tenant for the ALTER VIRTUAL CLUSTER statements.

func (*TenantSpec) Format

func (n *TenantSpec) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*TenantSpec) String

func (n *TenantSpec) String() string

type TestingMapTypeResolver

type TestingMapTypeResolver struct {
	// contains filtered or unexported fields
}

TestingMapTypeResolver is a fake type resolver for testing purposes.

func (*TestingMapTypeResolver) ResolveType

func (dtr *TestingMapTypeResolver) ResolveType(
	_ context.Context, name *UnresolvedObjectName,
) (*types.T, error)

ResolveType implements the TypeReferenceResolver interface.

func (*TestingMapTypeResolver) ResolveTypeByOID

func (dtr *TestingMapTypeResolver) ResolveTypeByOID(context.Context, oid.Oid) (*types.T, error)

ResolveTypeByOID implements the TypeReferenceResolver interface.

type TransactionModes

type TransactionModes struct {
	Isolation     IsolationLevel
	UserPriority  UserPriority
	ReadWriteMode ReadWriteMode
	AsOf          AsOfClause
	Deferrable    DeferrableMode
}

TransactionModes holds the transaction modes for a transaction.

func (*TransactionModes) Format

func (node *TransactionModes) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*TransactionModes) Merge

func (node *TransactionModes) Merge(other TransactionModes) error

Merge groups two sets of transaction modes together. Used in the parser.

type Truncate

type Truncate struct {
	Tables       TableNames
	DropBehavior DropBehavior
}

Truncate represents a TRUNCATE statement.

func (*Truncate) Format

func (node *Truncate) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Truncate) StatementReturnType

func (*Truncate) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Truncate) StatementTag

func (*Truncate) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Truncate) StatementType

func (*Truncate) StatementType() StatementType

StatementType implements the Statement interface.

func (*Truncate) String

func (n *Truncate) String() string

type Tuple

type Tuple struct {
	Exprs  Exprs
	Labels []string

	// Row indicates whether `ROW` was used in the input syntax. This is
	// used solely to generate column names automatically, see
	// col_name.go.
	Row bool
	// contains filtered or unexported fields
}

Tuple represents a parenthesized list of expressions.

func NewTypedTuple

func NewTypedTuple(typ *types.T, typedExprs Exprs) *Tuple

NewTypedTuple returns a new Tuple that is verified to be well-typed.

func (*Tuple) Eval

func (node *Tuple) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*Tuple) Format

func (node *Tuple) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Tuple) ResolvedType

func (node *Tuple) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*Tuple) String

func (node *Tuple) String() string

func (*Tuple) TypeCheck

func (expr *Tuple) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*Tuple) Walk

func (expr *Tuple) Walk(v Visitor) Expr

Walk implements the Expr interface.

type TupleStar

type TupleStar struct {
	Expr Expr
}

TupleStar represents (E).* expressions. It is meant to evaporate during star expansion.

func (*TupleStar) Eval

func (node *TupleStar) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*TupleStar) Format

func (node *TupleStar) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*TupleStar) NormalizeVarName

func (node *TupleStar) NormalizeVarName() (VarName, error)

NormalizeVarName implements the VarName interface.

func (*TupleStar) ResolvedType

func (expr *TupleStar) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*TupleStar) String

func (node *TupleStar) String() string

func (*TupleStar) TypeCheck

func (expr *TupleStar) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*TupleStar) Walk

func (expr *TupleStar) Walk(v Visitor) Expr

Walk implements the Expr interface.

type TypeCollectorVisitor

type TypeCollectorVisitor struct {
	OIDs map[oid.Oid]struct{}
}

TypeCollectorVisitor is an expression visitor that collects all explicit OID type references in an expression.

func (*TypeCollectorVisitor) VisitPost

func (v *TypeCollectorVisitor) VisitPost(e Expr) Expr

VisitPost implements the Visitor interface.

func (*TypeCollectorVisitor) VisitPre

func (v *TypeCollectorVisitor) VisitPre(expr Expr) (bool, Expr)

VisitPre implements the Visitor interface.

type TypeList

type TypeList interface {
	// Match checks if all types in the TypeList match the corresponding elements in types.
	Match(types []*types.T) bool
	// MatchIdentical is similar to match but checks that the types are identical matches,
	//instead of equivalent matches. See types.T.Equivalent and types.T.Identical.
	MatchIdentical(types []*types.T) bool
	// MatchAt checks if the parameter type at index i of the TypeList matches type typ.
	// In all implementations, types.Null will match with each parameter type, allowing
	// NULL values to be used as arguments.
	MatchAt(typ *types.T, i int) bool
	// MatchAtIdentical is similar to MatchAt but checks that the type at index i of
	// the Typelist is identical to typ.
	MatchAtIdentical(typ *types.T, i int) bool
	// MatchLen checks that the TypeList can support l parameters.
	MatchLen(l int) bool
	// GetAt returns the type at the given index in the TypeList, or nil if the TypeList
	// cannot have a parameter at index i.
	GetAt(i int) *types.T
	// Length returns the number of types in the list
	Length() int
	// Types returns a realized copy of the list. variadic lists return a list of size one.
	Types() []*types.T
	// String returns a human readable signature
	String() string
}

TypeList is a list of types representing a function parameter list.

type TypeName

type TypeName struct {
	// contains filtered or unexported fields
}

TypeName corresponds to the name of a type in a CREATE TYPE statement, in an expression, or column type etc.

Users of this struct should not construct it directly, and instead use the constructors below.

func MakeQualifiedTypeName

func MakeQualifiedTypeName(db, schema, typ string) TypeName

MakeQualifiedTypeName creates a fully qualified type name.

func MakeSchemaQualifiedTypeName

func MakeSchemaQualifiedTypeName(schema, typ string) TypeName

MakeSchemaQualifiedTypeName returns a new type name.

func MakeTypeNameWithPrefix

func MakeTypeNameWithPrefix(prefix ObjectNamePrefix, typ string) TypeName

MakeTypeNameWithPrefix creates a type name with the provided prefix.

func MakeUnqualifiedTypeName

func MakeUnqualifiedTypeName(typ string) TypeName

MakeUnqualifiedTypeName returns a new type name.

func NewQualifiedTypeName

func NewQualifiedTypeName(db, schema, typ string) *TypeName

NewQualifiedTypeName returns a fully qualified type name.

func NewUnqualifiedTypeName

func NewUnqualifiedTypeName(typ string) *TypeName

NewUnqualifiedTypeName returns a new base type name.

func (*TypeName) FQString

func (o *TypeName) FQString() string

FQString renders the table name in full, not omitting the prefix schema and catalog names. Suitable for logging, etc.

func (*TypeName) Format

func (t *TypeName) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*TypeName) Object

func (o *TypeName) Object() string

func (*TypeName) SQLString

func (t *TypeName) SQLString() string

SQLString implements the ResolvableTypeReference interface.

func (*TypeName) String

func (o *TypeName) String() string

func (*TypeName) ToUnresolvedObjectName

func (o *TypeName) ToUnresolvedObjectName() *UnresolvedObjectName

ToUnresolvedObjectName converts the type name to an unresolved object name. Schema and catalog are included if indicated by the ExplicitSchema and ExplicitCatalog flags.

func (*TypeName) Type

func (t *TypeName) Type() string

Type returns the unqualified name of this TypeName.

type TypeReferenceResolver

type TypeReferenceResolver interface {
	ResolveType(ctx context.Context, name *UnresolvedObjectName) (*types.T, error)
	ResolveTypeByOID(ctx context.Context, oid oid.Oid) (*types.T, error)
}

TypeReferenceResolver is the interface that will provide the ability to actually look up type metadata and transform references into *types.T's. Implementers of TypeReferenceResolver should also implement descpb.TypeDescriptorResolver is sqlbase.TypeDescriptorInterface is the underlying representation of a user defined type.

func MakeTestingMapTypeResolver

func MakeTestingMapTypeResolver(typeMap map[string]*types.T) TypeReferenceResolver

MakeTestingMapTypeResolver creates a TestingMapTypeResolver from a map.

type TypedDummy

type TypedDummy struct {
	Typ *types.T
}

TypedDummy is a dummy expression that represents a dummy value with a specified type. It can be used in situations where TypedExprs of a particular type are required for semantic analysis.

func (*TypedDummy) Eval

func (node *TypedDummy) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*TypedDummy) Format

func (node *TypedDummy) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*TypedDummy) ResolvedType

func (node *TypedDummy) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*TypedDummy) String

func (node *TypedDummy) String() string

func (*TypedDummy) TypeCheck

func (node *TypedDummy) TypeCheck(context.Context, *SemaContext, *types.T) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*TypedDummy) Walk

func (node *TypedDummy) Walk(Visitor) Expr

Walk implements the Expr interface.

type TypedExpr

type TypedExpr interface {
	Expr

	// ResolvedType provides the type of the TypedExpr, which is the type of Datum
	// that the TypedExpr will return when evaluated.
	ResolvedType() *types.T

	// Eval evaluates an SQL expression. Expression evaluation is a
	// mostly straightforward walk over the parse tree. The only
	// significant complexity is the handling of types and implicit
	// conversions. See binOps and cmpOps for more details. Note that
	// expression evaluation returns an error if certain node types are
	// encountered: Placeholder, VarName (and related UnqualifiedStar,
	// UnresolvedName and AllColumnsSelector) or Subquery. These nodes
	// should be replaced prior to expression evaluation by an
	// appropriate WalkExpr. For example, Placeholder should be replaced
	// by the argument passed from the client.
	Eval(context.Context, ExprEvaluator) (Datum, error)
}

TypedExpr represents a well-typed expression.

func TypeCheck

func TypeCheck(
	ctx context.Context, expr Expr, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck performs type checking on the provided expression tree, returning the new typed expression tree, which additionally permits evaluation and type introspection globally and on each sub-tree.

While doing so, it will fold numeric constants and bind placeholder names to their inferred types in the provided context. The optional desired parameter can be used to hint the desired type for the root of the resulting typed expression tree. Like with Expr.TypeCheck, it is not valid to provide a nil desired type. Instead, call it with the wildcard type types.Any if no specific type is desired.

func TypeCheckAndRequire

func TypeCheckAndRequire(
	ctx context.Context, expr Expr, semaCtx *SemaContext, required *types.T, op string,
) (TypedExpr, error)

TypeCheckAndRequire performs type checking on the provided expression tree in an identical manner to TypeCheck. It then asserts that the resulting TypedExpr has the provided return type, returning both the typed expression and an error if it does not.

type TypedExprs

type TypedExprs []TypedExpr

TypedExprs represents a list of well-typed value expressions. It's not a valid expression because it's not parenthesized.

func (*TypedExprs) Format

func (node *TypedExprs) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*TypedExprs) String

func (node *TypedExprs) String() string

type UDFDisallowanceVisitor

type UDFDisallowanceVisitor struct {
	FoundUDF bool
}

UDFDisallowanceVisitor is used to determine if a type checked expression contains any UDF function sub-expression. It's needed only temporarily to disallow any usage of UDF from relation objects.

func (*UDFDisallowanceVisitor) VisitPost

func (v *UDFDisallowanceVisitor) VisitPost(expr Expr) (newNode Expr)

VisitPost implements the Visitor interface.

func (*UDFDisallowanceVisitor) VisitPre

func (v *UDFDisallowanceVisitor) VisitPre(expr Expr) (recurse bool, newExpr Expr)

VisitPre implements the Visitor interface.

type UnaryEvalOp

type UnaryEvalOp interface {
	Eval(context.Context, OpEvaluator, Datum) (Datum, error)
}

UnaryEvalOp is a unary operation which can be evaluated.

type UnaryExpr

type UnaryExpr struct {
	Operator UnaryOperator
	Expr     Expr
	// contains filtered or unexported fields
}

UnaryExpr represents a unary value expression.

func NewTypedUnaryExpr

func NewTypedUnaryExpr(op UnaryOperator, expr TypedExpr, typ *types.T) *UnaryExpr

NewTypedUnaryExpr returns a new UnaryExpr that is well-typed.

func (*UnaryExpr) Eval

func (node *UnaryExpr) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*UnaryExpr) Format

func (node *UnaryExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*UnaryExpr) GetOp

func (node *UnaryExpr) GetOp() *UnaryOp

GetOp exposes the underlying UnaryOp.

func (UnaryExpr) ResolvedType

func (ta UnaryExpr) ResolvedType() *types.T

func (*UnaryExpr) String

func (node *UnaryExpr) String() string

func (*UnaryExpr) TypeCheck

func (expr *UnaryExpr) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*UnaryExpr) TypedInnerExpr

func (node *UnaryExpr) TypedInnerExpr() TypedExpr

TypedInnerExpr returns the UnaryExpr's inner expression as a TypedExpr.

func (*UnaryExpr) Walk

func (expr *UnaryExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type UnaryMinusDecimalOp

type UnaryMinusDecimalOp struct{}

UnaryMinusDecimalOp is a UnaryEvalOp.

func (*UnaryMinusDecimalOp) Eval

Eval is part of the UnaryEvalOp interface.

type UnaryMinusFloatOp

type UnaryMinusFloatOp struct{}

UnaryMinusFloatOp is a UnaryEvalOp.

func (*UnaryMinusFloatOp) Eval

func (op *UnaryMinusFloatOp) Eval(ctx context.Context, e OpEvaluator, v Datum) (Datum, error)

Eval is part of the UnaryEvalOp interface.

type UnaryMinusIntOp

type UnaryMinusIntOp struct{}

UnaryMinusIntOp is a UnaryEvalOp.

func (*UnaryMinusIntOp) Eval

func (op *UnaryMinusIntOp) Eval(ctx context.Context, e OpEvaluator, v Datum) (Datum, error)

Eval is part of the UnaryEvalOp interface.

type UnaryMinusIntervalOp

type UnaryMinusIntervalOp struct{}

UnaryMinusIntervalOp is a UnaryEvalOp.

func (*UnaryMinusIntervalOp) Eval

Eval is part of the UnaryEvalOp interface.

type UnaryNoop

type UnaryNoop struct{}

UnaryNoop is a UnaryEvalOp.

func (*UnaryNoop) Eval

func (v *UnaryNoop) Eval(ctx context.Context, evaluator OpEvaluator, d Datum) (Datum, error)

Eval of UnaryNoop does nothing and returns the passed Datum.

type UnaryOp

type UnaryOp struct {
	Typ        *types.T
	ReturnType *types.T
	EvalOp     UnaryEvalOp
	Volatility volatility.V

	// OnTypeCheck is called when the op is type checked.
	OnTypeCheck func()
	// contains filtered or unexported fields
}

UnaryOp is a unary operator.

type UnaryOpEvaluator

type UnaryOpEvaluator interface {
	EvalCbrtDecimalOp(context.Context, *CbrtDecimalOp, Datum) (Datum, error)
	EvalCbrtFloatOp(context.Context, *CbrtFloatOp, Datum) (Datum, error)
	EvalComplementINetOp(context.Context, *ComplementINetOp, Datum) (Datum, error)
	EvalComplementIntOp(context.Context, *ComplementIntOp, Datum) (Datum, error)
	EvalComplementVarBitOp(context.Context, *ComplementVarBitOp, Datum) (Datum, error)
	EvalSqrtDecimalOp(context.Context, *SqrtDecimalOp, Datum) (Datum, error)
	EvalSqrtFloatOp(context.Context, *SqrtFloatOp, Datum) (Datum, error)
	EvalUnaryMinusDecimalOp(context.Context, *UnaryMinusDecimalOp, Datum) (Datum, error)
	EvalUnaryMinusFloatOp(context.Context, *UnaryMinusFloatOp, Datum) (Datum, error)
	EvalUnaryMinusIntOp(context.Context, *UnaryMinusIntOp, Datum) (Datum, error)
	EvalUnaryMinusIntervalOp(context.Context, *UnaryMinusIntervalOp, Datum) (Datum, error)
}

UnaryOpEvaluator knows how to evaluate UnaryEvalOps.

type UnaryOpOverloads

type UnaryOpOverloads struct {
	// contains filtered or unexported fields
}

UnaryOpOverloads is an overloaded set of unary operator implementations. It implements overloadSet.

func (*UnaryOpOverloads) ForEachUnaryOp

func (u *UnaryOpOverloads) ForEachUnaryOp(f func(op *UnaryOp) error) error

ForEachUnaryOp iterates the set of overloads.

type UnaryOperator

type UnaryOperator struct {
	Symbol UnaryOperatorSymbol
	// IsExplicitOperator is true if OPERATOR(symbol) is used.
	IsExplicitOperator bool
}

UnaryOperator represents a unary operator used in a UnaryExpr.

func MakeUnaryOperator

func MakeUnaryOperator(symbol UnaryOperatorSymbol) UnaryOperator

MakeUnaryOperator creates a UnaryOperator given a symbol.

func (UnaryOperator) Operator

func (UnaryOperator) Operator()

Operator implements tree.Operator.

func (UnaryOperator) String

func (o UnaryOperator) String() string

type UnaryOperatorSymbol

type UnaryOperatorSymbol uint8

UnaryOperatorSymbol represents a unary operator.

const (
	UnaryMinus UnaryOperatorSymbol = iota
	UnaryComplement
	UnarySqrt
	UnaryCbrt
	UnaryPlus

	NumUnaryOperatorSymbols
)

UnaryExpr.Operator.Symbol

func (UnaryOperatorSymbol) String

func (i UnaryOperatorSymbol) String() string

type UnionClause

type UnionClause struct {
	Type        UnionType
	Left, Right *Select
	All         bool
}

UnionClause represents a UNION statement.

func (*UnionClause) Format

func (node *UnionClause) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*UnionClause) StatementReturnType

func (*UnionClause) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*UnionClause) StatementTag

func (*UnionClause) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*UnionClause) StatementType

func (*UnionClause) StatementType() StatementType

StatementType implements the Statement interface.

func (*UnionClause) String

func (n *UnionClause) String() string

type UnionType

type UnionType int

UnionType represents one of the three set operations in sql.

const (
	UnionOp UnionType = iota
	IntersectOp
	ExceptOp
)

Union.Type

func (UnionType) String

func (i UnionType) String() string

type UniqueConstraint

type UniqueConstraint struct {
	WithoutIndex bool
}

UniqueConstraint represents UNIQUE on a column.

type UniqueConstraintTableDef

type UniqueConstraintTableDef struct {
	IndexTableDef
	PrimaryKey   bool
	WithoutIndex bool
	IfNotExists  bool
}

UniqueConstraintTableDef represents a unique constraint within a CREATE TABLE statement.

func (*UniqueConstraintTableDef) Format

func (node *UniqueConstraintTableDef) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*UniqueConstraintTableDef) SetIfNotExists

func (node *UniqueConstraintTableDef) SetIfNotExists()

SetIfNotExists implements the ConstraintTableDef interface.

func (*UniqueConstraintTableDef) SetName

func (node *UniqueConstraintTableDef) SetName(name Name)

SetName implements the TableDef interface.

type Unlisten

type Unlisten struct {
	ChannelName *UnresolvedObjectName
	Star        bool
}

Unlisten represents a UNLISTEN statement.

func (*Unlisten) Format

func (node *Unlisten) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Unlisten) StatementReturnType

func (*Unlisten) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Unlisten) StatementTag

func (*Unlisten) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Unlisten) StatementType

func (*Unlisten) StatementType() StatementType

StatementType implements the Statement interface.

func (*Unlisten) String

func (node *Unlisten) String() string

String implements the Statement interface.

type UnqualifiedStar

type UnqualifiedStar struct{}

UnqualifiedStar corresponds to a standalone '*' in a scalar expression.

func (UnqualifiedStar) Eval

func (node UnqualifiedStar) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (UnqualifiedStar) Format

func (UnqualifiedStar) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (UnqualifiedStar) NormalizeVarName

func (u UnqualifiedStar) NormalizeVarName() (VarName, error)

NormalizeVarName implements the VarName interface.

func (UnqualifiedStar) ResolvedType

func (UnqualifiedStar) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (UnqualifiedStar) String

func (u UnqualifiedStar) String() string

func (UnqualifiedStar) TypeCheck

func (expr UnqualifiedStar) TypeCheck(
	_ context.Context, _ *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (UnqualifiedStar) Variable

func (UnqualifiedStar) Variable()

Variable implements the VariableExpr interface.

func (UnqualifiedStar) Walk

func (expr UnqualifiedStar) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type UnresolvedFunctionName

type UnresolvedFunctionName struct {
	// contains filtered or unexported fields
}

UnresolvedFunctionName is an unresolved function name.

func MakeUnresolvedFunctionName

func MakeUnresolvedFunctionName(u *UnresolvedName) UnresolvedFunctionName

MakeUnresolvedFunctionName returns a new UnresolvedFunctionName containing the give UnresolvedName.

func (UnresolvedFunctionName) UnresolvedName

func (u UnresolvedFunctionName) UnresolvedName() *UnresolvedName

UnresolvedName implements the UnresolvedRoutineName interface.

type UnresolvedName

type UnresolvedName struct {
	// NumParts indicates the number of name parts specified, including
	// the star. Always 1 or greater.
	NumParts int

	// Star indicates the name ends with a star.
	// In that case, Parts below is empty in the first position.
	Star bool

	// Parts are the name components, in reverse order.
	// There are at most 4: column, table, schema, catalog/db.
	//
	// Note: NameParts has a fixed size so that we avoid a heap
	// allocation for the slice every time we construct an
	// UnresolvedName. It does imply however that Parts does not have
	// a meaningful "length"; its actual length (the number of parts
	// specified) is populated in NumParts above.
	Parts NameParts
}

UnresolvedName corresponds to an unresolved qualified name.

func MakeUnresolvedName

func MakeUnresolvedName(args ...string) UnresolvedName

MakeUnresolvedName constructs an UnresolvedName from some strings.

func NewUnresolvedName

func NewUnresolvedName(args ...string) *UnresolvedName

NewUnresolvedName constructs an UnresolvedName from some strings.

func (*UnresolvedName) Eval

func (node *UnresolvedName) Eval(ctx context.Context, v ExprEvaluator) (Datum, error)

Eval is part of the TypedExpr interface.

func (*UnresolvedName) Format

func (u *UnresolvedName) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*UnresolvedName) NormalizeTablePattern

func (n *UnresolvedName) NormalizeTablePattern() (TablePattern, error)

NormalizeTablePattern resolves an UnresolvedName to either a TableName or AllTablesSelector.

func (*UnresolvedName) NormalizeVarName

func (n *UnresolvedName) NormalizeVarName() (VarName, error)

NormalizeVarName implements the VarName interface.

func (*UnresolvedName) ResolvedType

func (*UnresolvedName) ResolvedType() *types.T

ResolvedType implements the TypedExpr interface.

func (*UnresolvedName) String

func (u *UnresolvedName) String() string

func (*UnresolvedName) ToRoutineName

func (u *UnresolvedName) ToRoutineName() (RoutineName, error)

ToRoutineName converts an UnresolvedName to a RoutineName.

func (*UnresolvedName) ToUnresolvedObjectName

func (u *UnresolvedName) ToUnresolvedObjectName(idx AnnotationIdx) (UnresolvedObjectName, error)

ToUnresolvedObjectName converts an UnresolvedName to an UnresolvedObjectName.

func (*UnresolvedName) TypeCheck

func (expr *UnresolvedName) TypeCheck(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*UnresolvedName) Variable

func (*UnresolvedName) Variable()

Variable implements the VariableExpr interface. Although, the UnresolvedName ought to be replaced to an IndexedVar before the points the VariableExpr interface is used.

func (*UnresolvedName) Walk

func (expr *UnresolvedName) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type UnresolvedObjectName

type UnresolvedObjectName struct {
	// NumParts indicates the number of name parts specified; always 1 or greater.
	NumParts int

	// Parts are the name components, in reverse order.
	// There are at most 3: object name, schema, catalog/db.
	//
	// Note: Parts has a fixed size so that we avoid a heap allocation for the
	// slice every time we construct an UnresolvedObjectName. It does imply
	// however that Parts does not have a meaningful "length"; its actual length
	// (the number of parts specified) is populated in NumParts above.
	Parts [3]string

	// UnresolvedObjectName can be annotated with a *tree.TableName.
	AnnotatedNode
}

UnresolvedObjectName is an unresolved qualified name for a database object (table, view, etc). It is like UnresolvedName but more restrictive. It should only be constructed via NewUnresolvedObjectName.

func MakeUnresolvedObjectName

func MakeUnresolvedObjectName(
	numParts int, parts [3]string, annotationIdx AnnotationIdx,
) (UnresolvedObjectName, error)

MakeUnresolvedObjectName creates an unresolved object name, verifying that it is well-formed.

func NewUnresolvedObjectName

func NewUnresolvedObjectName(
	numParts int, parts [3]string, annotationIdx AnnotationIdx,
) (*UnresolvedObjectName, error)

NewUnresolvedObjectName creates an unresolved object name, verifying that it is well-formed.

func (*UnresolvedObjectName) Catalog

func (u *UnresolvedObjectName) Catalog() string

Catalog returns the catalog of the object.

func (*UnresolvedObjectName) Format

func (u *UnresolvedObjectName) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*UnresolvedObjectName) HasExplicitCatalog

func (u *UnresolvedObjectName) HasExplicitCatalog() bool

HasExplicitCatalog returns whether a catalog is specified on the object.

func (*UnresolvedObjectName) HasExplicitSchema

func (u *UnresolvedObjectName) HasExplicitSchema() bool

HasExplicitSchema returns whether a schema is specified on the object.

func (*UnresolvedObjectName) Object

func (u *UnresolvedObjectName) Object() string

Object returns the unqualified object name.

func (*UnresolvedObjectName) Resolved

func (u *UnresolvedObjectName) Resolved(ann *Annotations) ObjectName

Resolved returns the resolved name in the annotation for this node (or nil if there isn't one).

func (*UnresolvedObjectName) SQLString

func (name *UnresolvedObjectName) SQLString() string

SQLString implements the ResolvableTypeReference interface.

func (*UnresolvedObjectName) Schema

func (u *UnresolvedObjectName) Schema() string

Schema returns the schema of the object.

func (*UnresolvedObjectName) String

func (u *UnresolvedObjectName) String() string

func (*UnresolvedObjectName) ToRoutineName

func (u *UnresolvedObjectName) ToRoutineName() RoutineName

ToRoutineName converts the unresolved name to a function name.

func (*UnresolvedObjectName) ToTableName

func (u *UnresolvedObjectName) ToTableName() TableName

ToTableName converts the unresolved name to a table name.

func (*UnresolvedObjectName) ToUnresolvedName

func (u *UnresolvedObjectName) ToUnresolvedName() *UnresolvedName

ToUnresolvedName converts the unresolved object name to the more general unresolved name.

func (*UnresolvedObjectName) WalkTableExpr

func (expr *UnresolvedObjectName) WalkTableExpr(_ Visitor) TableExpr

WalkTableExpr implements the TableExpr interface.

type UnresolvedProcedureName

type UnresolvedProcedureName struct {
	// contains filtered or unexported fields
}

UnresolvedProcedureName is an unresolved procedure name.

func MakeUnresolvedProcedureName

func MakeUnresolvedProcedureName(u *UnresolvedName) UnresolvedProcedureName

MakeUnresolvedProcedureName returns a new UnresolvedProcedureName containing the give UnresolvedName.

func (UnresolvedProcedureName) UnresolvedName

func (u UnresolvedProcedureName) UnresolvedName() *UnresolvedName

UnresolvedName implements the UnresolvedRoutineName interface.

type UnresolvedRoutineName

type UnresolvedRoutineName interface {
	UnresolvedName() *UnresolvedName
	// contains filtered or unexported methods
}

UnresolvedRoutineName is an unresolved function or procedure name. The two implementations of this interface are used to differentiate between the two types of routines for things like error messages.

type UnrestrictedName

type UnrestrictedName string

An UnrestrictedName is a Name that does not need to be escaped when it matches a reserved keyword.

In general, an UnrestrictedName is the result of parsing an unrestricted_name nonterminal, which is used in the grammar where reserved keywords can be unambiguously interpreted as identifiers. When formatted, an UnrestrictedName that matches a reserved keyword thus does not need to be quoted.

For historical reasons, some unrestricted_name nonterminals are instead parsed as Names. The only user-visible impact of this is that we are too aggressive about quoting names in certain positions. New grammar rules should prefer to parse unrestricted_name nonterminals into UnrestrictedNames.

func (*UnrestrictedName) Format

func (u *UnrestrictedName) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*UnrestrictedName) String

func (node *UnrestrictedName) String() string

type UnspecifiedObjectName

type UnspecifiedObjectName struct {
	// contains filtered or unexported fields
}

UnspecifiedObjectName is an object name correspond to any object type.

func (*UnspecifiedObjectName) FQString

func (o *UnspecifiedObjectName) FQString() string

FQString renders the table name in full, not omitting the prefix schema and catalog names. Suitable for logging, etc.

func (*UnspecifiedObjectName) Format

func (o *UnspecifiedObjectName) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*UnspecifiedObjectName) Object

func (o *UnspecifiedObjectName) Object() string

func (*UnspecifiedObjectName) String

func (o *UnspecifiedObjectName) String() string

func (*UnspecifiedObjectName) ToUnresolvedObjectName

func (o *UnspecifiedObjectName) ToUnresolvedObjectName() *UnresolvedObjectName

ToUnresolvedObjectName converts the type name to an unresolved object name. Schema and catalog are included if indicated by the ExplicitSchema and ExplicitCatalog flags.

type Unsplit

type Unsplit struct {
	TableOrIndex TableIndexName
	// Each row contains values for the columns in the PK or index (or a prefix
	// of the columns).
	Rows *Select
	All  bool
}

Unsplit represents an `ALTER TABLE/INDEX .. UNSPLIT AT ..` statement.

func (*Unsplit) Format

func (node *Unsplit) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Unsplit) StatementReturnType

func (*Unsplit) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Unsplit) StatementTag

func (*Unsplit) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Unsplit) StatementType

func (*Unsplit) StatementType() StatementType

StatementType implements the Statement interface.

func (*Unsplit) String

func (n *Unsplit) String() string

type UnsupportedError

type UnsupportedError struct {
	Err         error
	FeatureName string
}

UnsupportedError is an error object which is returned by some unimplemented SQL statements. It is currently only used to skip over PGDUMP statements during an import.

func (*UnsupportedError) Cause

func (u *UnsupportedError) Cause() error

Cause implements causer.

func (*UnsupportedError) Error

func (u *UnsupportedError) Error() string

func (*UnsupportedError) Unwrap

func (u *UnsupportedError) Unwrap() error

Unwrap implements wrapper.

type UnsupportedTypeChecker

type UnsupportedTypeChecker interface {
	// CheckType returns an error if the given type is not supported by the
	// current cluster version.
	CheckType(ctx context.Context, typ *types.T) error
}

UnsupportedTypeChecker is used to check that a type is supported by the current cluster version. It is an interface because some packages cannot import the clusterversion package.

type Update

type Update struct {
	With      *With
	Table     TableExpr
	Exprs     UpdateExprs
	From      TableExprs
	Where     *Where
	OrderBy   OrderBy
	Limit     *Limit
	Returning ReturningClause
}

Update represents an UPDATE statement.

func (*Update) Format

func (node *Update) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*Update) StatementReturnType

func (n *Update) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*Update) StatementTag

func (*Update) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Update) StatementType

func (*Update) StatementType() StatementType

StatementType implements the Statement interface.

func (*Update) String

func (n *Update) String() string

type UpdateExpr

type UpdateExpr struct {
	Tuple bool
	Names NameList
	Expr  Expr
}

UpdateExpr represents an update expression.

func (*UpdateExpr) Format

func (node *UpdateExpr) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type UpdateExprs

type UpdateExprs []*UpdateExpr

UpdateExprs represents a list of update expressions.

func (*UpdateExprs) Format

func (node *UpdateExprs) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type UserPriority

type UserPriority int

UserPriority holds the user priority for a transaction.

const (
	UnspecifiedUserPriority UserPriority = iota
	Low
	Normal
	High
)

UserPriority values

func UserPriorityFromString

func UserPriorityFromString(val string) (_ UserPriority, ok bool)

UserPriorityFromString converts a string into a UserPriority.

func (UserPriority) String

func (up UserPriority) String() string

type UsingJoinCond

type UsingJoinCond struct {
	Cols NameList
}

UsingJoinCond represents a USING join condition.

func (*UsingJoinCond) Format

func (node *UsingJoinCond) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type ValidationBehavior

type ValidationBehavior int

ValidationBehavior specifies whether or not a constraint is validated.

const (
	// ValidationDefault is the default validation behavior (immediate).
	ValidationDefault ValidationBehavior = iota
	// ValidationSkip skips validation of any existing data.
	ValidationSkip
)

type ValueHandler

type ValueHandler interface {
	Len() int
	Null()
	Date(d pgdate.Date)
	Datum(d Datum)
	Bool(b bool)
	Bytes(b []byte)
	// Decimal returns a pointer into the vec for in place construction.
	Decimal() *apd.Decimal
	Float(f float64)
	Int16(i int16)
	Int32(i int32)
	Int(i int64)
	Duration(d duration.Duration)
	JSON(j json.JSON)
	String(s string)
	TimestampTZ(t time.Time)
	Reset()
}

ValueHandler is an interface to allow raw types to be extracted from strings.

type ValuesClause

type ValuesClause struct {
	Rows []Exprs
}

ValuesClause represents a VALUES clause.

func (*ValuesClause) Format

func (node *ValuesClause) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ValuesClause) StatementReturnType

func (*ValuesClause) StatementReturnType() StatementReturnType

StatementReturnType implements the Statement interface.

func (*ValuesClause) StatementTag

func (*ValuesClause) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ValuesClause) StatementType

func (*ValuesClause) StatementType() StatementType

StatementType implements the Statement interface.

func (*ValuesClause) String

func (n *ValuesClause) String() string

type VarName

type VarName interface {
	TypedExpr

	// NormalizeVarName() guarantees to return a variable name
	// that is not an UnresolvedName. This converts the UnresolvedName
	// to an AllColumnsSelector or ColumnItem as necessary.
	NormalizeVarName() (VarName, error)
}

VarName occurs inside scalar expressions.

Immediately after parsing, the following types can occur:

  • UnqualifiedStar: a naked star as argument to a function, e.g. count(*), or at the top level of a SELECT clause. See also uses of StarExpr() and StarSelectExpr() in the grammar.

- UnresolvedName: other names of the form `a.b....e` or `a.b...e.*`.

Consumers of variable names do not like UnresolvedNames and instead expect either AllColumnsSelector or ColumnItem. Use NormalizeVarName() for this.

After a ColumnItem is available, it should be further resolved, for this the Resolve() method should be used; see name_resolution.go.

func StarExpr

func StarExpr() VarName

StarExpr is a convenience function that represents an unqualified "*".

type VariableExpr

type VariableExpr interface {
	Expr
	Variable()
}

VariableExpr is an Expr that may change per row. It is used to signal the evaluation/simplification machinery that the underlying Expr is not constant.

type VariadicType

type VariadicType struct {
	FixedTypes []*types.T
	VarType    *types.T
}

VariadicType is a TypeList implementation which accepts a fixed number of arguments at the beginning and an arbitrary number of homogenous arguments at the end.

func (VariadicType) GetAt

func (v VariadicType) GetAt(i int) *types.T

GetAt is part of the TypeList interface.

func (VariadicType) Length

func (v VariadicType) Length() int

Length is part of the TypeList interface.

func (VariadicType) Match

func (v VariadicType) Match(types []*types.T) bool

Match is part of the TypeList interface.

func (VariadicType) MatchAt

func (v VariadicType) MatchAt(typ *types.T, i int) bool

MatchAt is part of the TypeList interface.

func (VariadicType) MatchAtIdentical

func (VariadicType) MatchAtIdentical(typ *types.T, i int) bool

MatchAtIdentical is part of the TypeList interface. TODO(mgartner): This will be incorrect once we add support for variadic UDFs

func (VariadicType) MatchIdentical

func (VariadicType) MatchIdentical(types []*types.T) bool

MatchIdentical is part of the TypeList interface.

func (VariadicType) MatchLen

func (v VariadicType) MatchLen(l int) bool

MatchLen is part of the TypeList interface.

func (VariadicType) String

func (v VariadicType) String() string

func (VariadicType) Types

func (v VariadicType) Types() []*types.T

Types is part of the TypeList interface.

type VectorRows

type VectorRows struct {
	Batch coldata.Batch
}

VectorRows lets us store a Batch in a tree.LiteralValuesClause.

func (VectorRows) Get

func (r VectorRows) Get(i, j int) Expr

Get implements the ExprContainer interface.

func (VectorRows) NumCols

func (r VectorRows) NumCols() int

NumCols implements the ExprContainer interface.

func (VectorRows) NumRows

func (r VectorRows) NumRows() int

NumRows implements the ExprContainer interface.

type Visitor

type Visitor interface {
	// VisitPre is called for each node before recursing into that subtree. Upon return, if recurse
	// is false, the visit will not recurse into the subtree (and VisitPost will not be called for
	// this node).
	//
	// The returned Expr replaces the visited expression and can be used for rewriting expressions.
	// The function should NOT modify nodes in-place; it should make copies of nodes. The Walk
	// infrastructure will automatically make copies of parents as needed.
	VisitPre(expr Expr) (recurse bool, newExpr Expr)

	// VisitPost is called for each node after recursing into the subtree. The returned Expr
	// replaces the visited expression and can be used for rewriting expressions.
	//
	// The returned Expr replaces the visited expression and can be used for rewriting expressions.
	// The function should NOT modify nodes in-place; it should make and return copies of nodes. The
	// Walk infrastructure will automatically make copies of parents as needed.
	VisitPost(expr Expr) (newNode Expr)
}

Visitor defines methods that are called for nodes during an expression or statement walk.

type When

type When struct {
	Cond Expr
	Val  Expr
}

When represents a WHEN sub-expression.

func (*When) Format

func (node *When) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type Where

type Where struct {
	Type string
	Expr Expr
}

Where represents a WHERE or HAVING clause.

func NewWhere

func NewWhere(typ string, expr Expr) *Where

NewWhere creates a WHERE or HAVING clause out of an Expr. If the expression is nil, it returns nil.

func (*Where) Format

func (node *Where) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type Window

type Window []*WindowDef

Window represents a WINDOW clause.

func (*Window) Format

func (node *Window) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type WindowDef

type WindowDef struct {
	Name       Name
	RefName    Name
	Partitions Exprs
	OrderBy    OrderBy
	Frame      *WindowFrame
}

WindowDef represents a single window definition expression.

func OverrideWindowDef

func OverrideWindowDef(base *WindowDef, override WindowDef) (WindowDef, error)

OverrideWindowDef implements the logic to have a base window definition which then gets augmented by a different window definition.

func (*WindowDef) Format

func (node *WindowDef) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type WindowFrame

type WindowFrame struct {
	Mode      treewindow.WindowFrameMode      // the mode of framing being used
	Bounds    WindowFrameBounds               // the bounds of the frame
	Exclusion treewindow.WindowFrameExclusion // optional frame exclusion
}

WindowFrame represents static state of window frame over which calculations are made.

func (*WindowFrame) DefaultFrameExclusion

func (f *WindowFrame) DefaultFrameExclusion() bool

DefaultFrameExclusion returns true if optional frame exclusion is omitted.

func (*WindowFrame) Format

func (f *WindowFrame) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*WindowFrame) IsDefaultFrame

func (f *WindowFrame) IsDefaultFrame() bool

IsDefaultFrame returns whether a frame equivalent to the default frame is being used (default is RANGE UNBOUNDED PRECEDING).

type WindowFrameBound

type WindowFrameBound struct {
	BoundType  treewindow.WindowFrameBoundType
	OffsetExpr Expr
}

WindowFrameBound specifies the offset and the type of boundary.

func (*WindowFrameBound) Format

func (node *WindowFrameBound) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*WindowFrameBound) HasOffset

func (node *WindowFrameBound) HasOffset() bool

HasOffset returns whether node contains an offset.

type WindowFrameBounds

type WindowFrameBounds struct {
	StartBound *WindowFrameBound
	EndBound   *WindowFrameBound
}

WindowFrameBounds specifies boundaries of the window frame. The row at StartBound is included whereas the row at EndBound is not.

func (*WindowFrameBounds) HasOffset

func (node *WindowFrameBounds) HasOffset() bool

HasOffset returns whether node contains an offset in either of the bounds.

type WindowOverload

type WindowOverload interface {
	// Window is just a marker method so folks don't think you can just shove
	// anything here. It ought to be an eval.WindowOverload.
	Window()
}

WindowOverload is an opaque type which is used to box an eval.WindowOverload.

type With

type With struct {
	Recursive bool
	CTEList   []*CTE
}

With represents a WITH statement.

func (*With) Format

func (node *With) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type ZoneConfigSettings

type ZoneConfigSettings struct {
	SetDefault bool
	YAMLConfig Expr
	Options    KVOptions
}

ZoneConfigSettings represents info needed for zone config setting.

func (*ZoneConfigSettings) Format

func (node *ZoneConfigSettings) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

type ZoneSpecifier

type ZoneSpecifier struct {
	// Only one of NamedZone, Database or TableOrIndex may be set.
	NamedZone UnrestrictedName
	Database  Name
	// TODO(radu): TableOrIndex abuses TableIndexName: it allows for the case when
	// an index is not specified, in which case TableOrIndex.Index is empty.
	TableOrIndex TableIndexName

	// Partition is only respected when Table is set.
	Partition Name
}

ZoneSpecifier represents a reference to a configurable zone of the keyspace.

func (*ZoneSpecifier) Format

func (node *ZoneSpecifier) Format(ctx *FmtCtx)

Format implements the NodeFormatter interface.

func (*ZoneSpecifier) String

func (node *ZoneSpecifier) String() string

func (ZoneSpecifier) TargetsIndex

func (node ZoneSpecifier) TargetsIndex() bool

TargetsIndex returns whether the zone specifier targets an index.

func (ZoneSpecifier) TargetsPartition

func (node ZoneSpecifier) TargetsPartition() bool

TargetsPartition returns whether the zone specifier targets a partition.

func (ZoneSpecifier) TargetsTable

func (node ZoneSpecifier) TargetsTable() bool

TargetsTable returns whether the zone specifier targets a table or a subzone within a table.

func (ZoneSpecifier) TelemetryName

func (node ZoneSpecifier) TelemetryName() string

TelemetryName returns a name fitting for telemetry purposes.

Source Files

Directories

Path Synopsis
Command evalgen is used to generate interfaces and "visitor" methods for expr and op evaluation.
Command evalgen is used to generate interfaces and "visitor" methods for expr and op evaluation.
Package treebin contains the implementation-agnostic information about all binary operators that we support.
Package treebin contains the implementation-agnostic information about all binary operators that we support.
Package treecmp contains the implementation-agnostic information about all comparison operators that we support.
Package treecmp contains the implementation-agnostic information about all comparison operators that we support.
Package treewindow contains some constants describing window-function specific options.
Package treewindow contains some constants describing window-function specific options.

Jump to

Keyboard shortcuts

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