dialects

package
v0.42.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const HiveDateFormat = "yyyy-MM-dd"

HiveDateFormat is Hive's DATE_FORMAT ('yyyy-MM-dd') without the quotes.

View Source
const HiveTimeFormat = "yyyy-MM-dd HH:mm:ss"

HiveTimeFormat is Hive's TIME_FORMAT ('yyyy-MM-dd HH:mm:ss') without the quotes.

View Source
const PrestoTimeFormat = "%Y-%m-%d %T"

Variables

This section is empty.

Functions

func CanonicalString

func CanonicalString(dialect DialectType) (string, error)

CanonicalString reduces a DialectType-style value (nil | string | *Dialect) to a string the string-based resolvers understand, mirroring upstream sqlglot's polymorphic DialectType at the boundaries that still thread a dialect as a string (schema, identifier parsing).

func FormatTime

func FormatTime(value string, mapping map[string]string) (string, bool)

FormatTime converts a format string through mapping, porting format_time (sqlglot/time.py:10-62); ok=false for the empty string (time.py:27 returns None). The trie is rebuilt per call: conversion happens only on the rare format-carrying function paths, never in a hot loop.

func HiveFormatTime

func HiveFormatTime(format string) string

HiveFormatTime renders a sqlglot strftime format back in Hive's pattern language (Generator.format_time with INVERSE_TIME_MAPPING, dialect.py:265-271); "" when format is empty.

func MySQLLower

func MySQLLower(s string) string

MySQLLower folds a string exactly as MySQL folds identifiers for case-insensitive resolution: per code point via MySQL's my_unicase_default `.tolower` map (see mysql_casefold_table.go, generated from the MySQL source). The fold is Unicode-simple and accent-PRESERVING — É->é, but Ñ stays distinct from N and ß is unchanged — and covers only the BMP (utf8mb3); any code point without a table entry (incl. all non-BMP runes) is left unchanged.

This is the MySQL-compatible identifier fold. It is EXPORTED so a consumer (e.g. a JVM service via a native binding) can call this exact implementation rather than re-deriving it: neither Go's strings.ToLower nor the JVM's String.lowercase() reproduces this map, and they diverge from each other on characters like U+0130 and Greek final-sigma (see DEVIATIONS.md §1.2). Do NOT substitute a stdlib case function.

func OracleFormatTime

func OracleFormatTime(format string) string

OracleFormatTime converts an Oracle format string to a strftime one (dialect.py:1014-1025, _format_time).

func OracleTimeFormat

func OracleTimeFormat(format string) string

OracleTimeFormat converts a strftime format string back to Oracle's spelling (Generator.format_time with INVERSE_TIME_MAPPING).

func PrestoFormatTime

func PrestoFormatTime(format string) string

PrestoFormatTime ports Generator.format_time with Presto's inverse TIME_MAPPING.

func TSQLFormatTime

func TSQLFormatTime(format string) string

TSQLFormatTime ports format_time with TSQL's inverse TIME_MAPPING (used by _format_sql).

Types

type Dialect

type Dialect struct {
	Name            string
	QuoteStart      string
	QuoteEnd        string
	IdentifierStart string
	IdentifierEnd   string
	// TokenizerFactory supports Athena's classify-and-re-tokenize router while preserving
	// Dialect.NewTokenizer's concrete *tokens.Tokenizer return type. A nil factory uses the
	// ordinary compiled TokenizerConfig path.
	TokenizerFactory func() *tokens.Tokenizer
	TokenizerConfig  tokens.TokenizerConfig
	// MySQLVersion is NON-UPSTREAM tokenizer state (DEVIATIONS.md §1.5): the parsed
	// MySQL five-digit comparable value. Nil is the default-off sentinel.
	MySQLVersion *int
	// MySQLAnsiQuotes is NON-UPSTREAM, opt-in MySQL tokenizer state (DEVIATIONS): when true, the
	// MySQL `sql_mode=ANSI_QUOTES` behavior is active — `"` is a QUOTED IDENTIFIER delimiter (like the
	// backtick), not a string literal (which must then use `'`). Nil/false is the default-off MySQL
	// behavior (`"` is a string). Set via the `mysql_ansi_quotes` dialect setting; applied by
	// applyMySQLAnsiQuotes (dialects/mysql.go) at settings-resolution time. Mutable per statement on
	// the real server, so a consumer re-resolves the dialect when the backend's live sql_mode changes.
	MySQLAnsiQuotes *bool
	// OpaqueFunctions is NON-UPSTREAM, opt-in (DEVIATIONS): when true, name-lookup builtin calls
	// parse as exp.Anonymous with the name as written and generate back verbatim; keyword-grammar
	// forms (CAST, EXTRACT ... FROM, TRIM ... FROM, SUBSTRING ... FROM/FOR, POSITION ... IN,
	// CHAR ... USING, CEIL ... TO) keep their structured nodes and render form-faithfully.
	// Set via the `opaque_functions` dialect setting at GetOrRaise resolve time.
	OpaqueFunctions       bool
	NormalizationStrategy NormalizationStrategy
	DPipeIsStringConcat   bool
	StrictStringConcat    bool
	TypedDivision         bool
	SafeDivision          bool
	// CanImplementArrayAny ports CAN_IMPLEMENT_ARRAY_ANY (generator.py:520, base False):
	// when true the generator rewrites ARRAY_ANY into an ARRAY_SIZE/FILTER emptiness
	// check (generator.py:5252-5257) instead of warning and emitting the call verbatim.
	CanImplementArrayAny    bool
	SupportsColumnJoinMarks bool
	ColonIsVariantExtract   bool
	// ColonChainIsSingleExtract ports COLON_CHAIN_IS_SINGLE_EXTRACT (parser.py:1880, base True;
	// databricks overrides to False): whether x:y:z is one extraction with a merged path.
	ColonChainIsSingleExtract bool
	// The JSON_PATH_* generator flags (generator.py:505-561) control how a JSONPath renders.
	// QuoteJSONPath wraps the whole path in the dialect's quote characters (base True).
	QuoteJSONPath bool
	// JSONPathKeyQuotedForcesBrackets renders a quoted key as ["key"] even when it would be a
	// safe identifier (base False; databricks True).
	JSONPathKeyQuotedForcesBrackets bool
	// The JSONPath parser/tokenizer flags (jsonpath.py + per-dialect JSONPathTokenizer).
	// JSONPathVarDash merges DASH into a var run (bigquery, hive and its children).
	JSONPathVarDash bool
	// JSONPathVarNumber merges NUMBER into a var run (bigquery).
	JSONPathVarNumber bool
	// JSONPathNoDollar removes '$' from the JSONPath single-token table (snowflake).
	JSONPathNoDollar bool
	// JSONPathBacktickIdentifier adds the backtick to the JSONPath identifier delimiters
	// (databricks).
	JSONPathBacktickIdentifier bool
	// JSONPathKeySafety is the dialect's SAFE_JSON_PATH_KEY_RE variant, which decides whether a
	// JSONPath key renders as a bare dotted key.
	JSONPathKeySafety JSONPathKeySafety
	// JSONPathPointerSyntax keeps a path literal that uses DuckDB's JSON pointer syntax
	// (a leading "/" or a "[#" back-of-list index) instead of parsing it.
	JSONPathPointerSyntax bool
	// JSONPathSingleQuoteEscape uses backslash-escaped single quotes for a bracketed key
	// (base False).
	JSONPathSingleQuoteEscape bool
	// JSONPathBracketedKeySupported allows the ["key"] form (base True).
	JSONPathBracketedKeySupported bool
	NullOrdering                  string
	SupportsOrderByAll            bool
	TryCastRequiresString         *bool
	DatePartMapping               map[string]string
	// TimeMapping / InverseTimeMapping port TIME_MAPPING (dialects/dialect.py:447) and the
	// metaclass-generated INVERSE_TIME_MAPPING (dialect.py:261-271): the dialect's TO_CHAR-style
	// pattern table (parse side, consumed by build_formatted_time) and its inverse (generate
	// side, consumed by Generator.format_time). nil for dialects upstream leaves at the {}
	// default; the Postgres family populates both (redshift overriding with its MON/MONTH
	// additions, dialects/redshift.py:30-34).
	TimeMapping              map[string]string
	InverseTimeMapping       map[string]string
	ValidIntervalUnits       map[string]bool
	SupportsUserDefinedTypes bool
	SupportsFixedSizeArrays  bool
	SupportsLimitAll         bool
	SupportsValuesDefault    bool
	// SupportsImplicitUnnest ports the parser flag SUPPORTS_IMPLICIT_UNNEST
	// (parser.py:1887): when true, `_parse_query_modifiers` rewrites a `FROM a, a.b` join
	// whose leftmost table part matches an already-introduced relation into an explicit
	// Unnest (parser.py:4305-4330). Base defaults to false (parser.py:1887); upstream sets
	// it true for Redshift (parsers/redshift.py:84) and BigQuery (parsers/bigquery.py:192).
	SupportsImplicitUnnest bool
	// SupportsSelectInto ports the generator flag SUPPORTS_SELECT_INTO (generator.py:466):
	// when false (base/mysql), the generator rewrites `SELECT ... INTO x` into
	// `CREATE TABLE x AS SELECT ...`; postgres (and tsql) keep the inline INTO.
	SupportsSelectInto bool
	// ValuesIsFunction ports the MySQL parser's FUNC_TOKENS addition of TokenType.VALUES
	// (parsers/mysql.py:63-70), paired upstream with its FUNCTION_PARSERS["VALUES"] override
	// (parsers/mysql.py:158-160): `VALUES(col)` in `ON DUPLICATE KEY UPDATE` is a function
	// call, not the VALUES table-constructor keyword. Callback overrides now live in the
	// parser-side dialect registry, but FUNC_TOKENS admission remains a separate,
	// not-yet-generalized problem: this flag lets parseFunctionCall admit VALUES before
	// callback dispatch.
	ValuesIsFunction bool
	// CharsetIsFunction likewise ports MySQL's FUNC_TOKENS addition of
	// TokenType.CHARACTER_SET (parsers/mysql.py:63-70): `CHARSET(...)`/`CHARACTER SET(...)`
	// is an ordinary (Anonymous) function call, not the CHARACTER SET/CHARSET keyword.
	// The parser-side callback registry does not control that earlier admission decision,
	// so this flag remains until FUNC_TOKENS itself is generalized per dialect.
	CharsetIsFunction bool
	// DuplicateKeyUpdateWithSet ports the generator flag of the same name
	// (generator.py:374, generators/mysql.py:137): base emits `ON DUPLICATE KEY UPDATE SET
	// ...`, MySQL's own generator omits the SET keyword (`ON DUPLICATE KEY UPDATE ...`).
	DuplicateKeyUpdateWithSet bool
	// WrapDerivedValues ports the generator flag of the same name (generator.py:320,
	// generators/mysql.py:148): base wraps an aliased/derived VALUES table constructor in
	// parentheses (`(VALUES (1, 2)) AS t`), MySQL emits it bare (`VALUES (1, 2) AS t`).
	WrapDerivedValues bool
	// CreateFunctionReturnAs ports the generator flag of the same name (generator.py:324,
	// default True; generators/spark2.py:214 overrides to False): whether a CREATE FUNCTION
	// body is introduced by `AS`. Upstream gates it on the body being an exp.Return
	// (generator.py:1363), a node this port's parser never builds, so the gate is currently
	// unreachable - it is kept so the flag itself stays a faithful port.
	CreateFunctionReturnAs bool
	// ValuesAsTable ports the generator flag of the same name (generator.py:397,
	// generators/mysql.py:139): base renders a table-source VALUES as a VALUES constructor,
	// MySQL rewrites it into a series of SELECT unions (`(SELECT 1 AS a, ...) AS t`). A VALUES
	// used as an INSERT source (not under FROM/JOIN) is unaffected by this flag.
	ValuesAsTable                      bool
	IntervalSpans                      bool
	NormalizeFunctions                 string
	DefaultFunctionsColumnNames        map[exp.Kind][]string
	AliasPostTablesample               bool
	AliasPostVersion                   bool
	UnnestColumnOnly                   bool
	Pseudocolumns                      map[string]bool
	PreferCTEAliasColumn               bool
	ForceEarlyAliasRefExpansion        bool
	ExpandOnlyGroupAliasRef            bool
	AnnotateAllScopes                  bool
	DisablesAliasRefExpansion          bool
	SupportsAliasRefsInJoinConditions  bool
	ProjectionAliasesShadowSourceNames bool
	TablesReferenceableAsColumns       bool
	SupportsStructStarExpansion        bool
	ExcludesPseudocolumnsFromStar      bool
	QueryResultsAreStructs             bool
	// PromoteToInferredDatetimeType ports PROMOTE_TO_INFERRED_DATETIME_TYPE
	// (dialects/dialect.py:700): canonicalize compares a temporal value with a date-like string
	// at the type the string looks like. False by default, true for MySQL.
	PromoteToInferredDatetimeType bool
	// SafeToEliminateDoubleNegation ports SAFE_TO_ELIMINATE_DOUBLE_NEGATION
	// (dialects/dialect.py:754): simplify may rewrite NOT NOT x to a BOOLEAN x. True by default.
	SafeToEliminateDoubleNegation bool
	// CoalesceComparisonNonStandard ports COALESCE_COMPARISON_NON_STANDARD
	// (dialects/dialect.py:660): simplify must not rewrite comparisons with COALESCE.
	CoalesceComparisonNonStandard bool
	// WeekOffset ports WEEK_OFFSET (dialects/dialect.py:363): the first day of the week for week
	// truncation, 0 for Monday and -1 for Sunday.
	WeekOffset int
	// UnpivotValueColumnsFirst ports the parser flag UNPIVOT_VALUE_COLUMNS_FIRST (parser.py:1841):
	// an UNPIVOT emits its value columns ahead of its name column (T-SQL).
	UnpivotValueColumnsFirst bool
	// PrioritizeNonLiteralTypes ports PRIORITIZE_NON_LITERAL_TYPES (dialects/dialect.py:801): when
	// annotate_types combines a literal and a non-literal of the same integer or real family, the
	// non-literal's type wins instead of the coerced one.
	PrioritizeNonLiteralTypes         bool
	RequiresParenthesizedStructAccess bool
	IndexOffset                       int
	// RenameTableWithDB ports the generator flag of the same name (generator.py:344): base
	// allows `ALTER TABLE db.a RENAME TO db.b`, some dialects (e.g. postgres, generators/
	// postgres.py:234) only allow renaming within the same db and drop the db qualifier.
	RenameTableWithDB bool
	// SupportsModifyColumn ports the generator flag of the same name (generator.py:475):
	// whether `ALTER TABLE ... MODIFY COLUMN <column-redefinition>` syntax is supported.
	SupportsModifyColumn bool
	// SupportsChangeColumn ports the generator flag of the same name (generator.py:478):
	// whether `ALTER TABLE ... CHANGE COLUMN <rename-and-redefine>` syntax is supported.
	SupportsChangeColumn bool
	// SupportsCreateTableLike ports the generator flag of the same name (generator.py:480):
	// whether the CREATE TABLE LIKE statement is supported (base True; Materialize overrides
	// False, generators/materialize.py:15). Consumed by likeproperty_sql.
	SupportsCreateTableLike bool
	// Nvl2Supported ports NVL2_SUPPORTED (generator.py:519, base True; dremio False): when
	// false, NVL2 renders as a CASE expression instead of the function call.
	Nvl2Supported bool
	// TrySupported ports TRY_SUPPORTED (generator.py:543, base True; mysql/postgres/dremio
	// False): a TryCast renders TRY_CAST when supported, else a plain CAST.
	TrySupported bool
	// LimitOnlyLiterals ports LIMIT_ONLY_LITERALS (generator.py:531, base False; dremio True):
	// a non-literal LIMIT/OFFSET argument is simplified to a literal before rendering.
	LimitOnlyLiterals bool
	// MultiArgDistinct ports MULTI_ARG_DISTINCT (generator.py:536, base True; dremio False):
	// a multi-argument DISTINCT is rewritten through a CASE WHEN ... IS NULL guard.
	MultiArgDistinct bool
	// SupportsConvertTimezone ports SUPPORTS_CONVERT_TIMEZONE (generator.py:530, base False;
	// dremio True): when false, CONVERT_TIMEZONE renders as the AT TIME ZONE form.
	SupportsConvertTimezone bool
	// SupportsBetweenFlags ports the generator flag of the same name (generator.py:608):
	// whether SYMMETRIC/ASYMMETRIC flags are supported with BETWEEN (base False; postgres
	// True, generators/postgres.py:280; Materialize and RisingWave re-override False).
	SupportsBetweenFlags bool
	// ExpressionPrecedesPropertiesCreatables ports Generator.EXPRESSION_PRECEDES_PROPERTIES_
	// CREATABLES (generator.py:684, base empty set): creatable kinds whose `AS <expression>`
	// renders before the POST_SCHEMA/POST_WITH properties instead of after them (risingwave
	// SINK, generators/risingwave.py:22).
	ExpressionPrecedesPropertiesCreatables map[string]bool
	// WrappedTransformColumnConstraint ports Parser.WRAPPED_TRANSFORM_COLUMN_CONSTRAINT
	// (parser.py:1896): whether the `name AS expr` column transform requires the expression
	// to be parenthesized (base True; risingwave overrides False, parsers/risingwave.py:11,
	// so `col INT AS expr` parses without the parens).
	WrappedTransformColumnConstraint bool
	// VarcharRequiresSize ports the MySQL-generator-family flag of the same name
	// (generators/mysql.py:149): MySQL requires VARCHAR to carry an explicit size.
	VarcharRequiresSize bool
	// AlterTableSupportsCascade ports the dialect flag of the same name (dialects/dialect.py:
	// 701): whether ALTER TABLE ... CASCADE is supported to propagate a column change to
	// existing partitions (Hive-family only).
	AlterTableSupportsCascade bool
	// AlterTableAddRequiredForEachColumn ports the dialect flag of the same name (dialects/
	// dialect.py:709): whether ADD must be repeated for each column added by ALTER TABLE.
	AlterTableAddRequiredForEachColumn bool
	// AlterRenameRequiresColumn ports the parser flag of the same name (parser.py:1819):
	// whether renaming a column with ALTER requires the presence of the COLUMN keyword.
	AlterRenameRequiresColumn bool
	// AlterTablePartitions ports the parser flag of the same name (parser.py:1822): whether
	// ALTER statements are allowed to contain PARTITION specifications.
	AlterTablePartitions bool
	// AlterTableIncludeColumnKeyword ports the generator flag of the same name (generator.py:
	// 400): whether the word COLUMN is included when adding a column with ALTER TABLE.
	AlterTableIncludeColumnKeyword bool
	// ComputedColumnWithType ports the generator flag of the same name (generator.py:412):
	// whether to include the type of a computed column in the CREATE DDL.
	ComputedColumnWithType bool
	// AlterSetWrapped ports the generator flag of the same name (generator.py:568): whether
	// to wrap AlterSet's properties in parens, e.g. `ALTER ... SET (<props>)`.
	AlterSetWrapped bool
	// AlterSetType ports the generator flag of the same name (generator.py:582): the syntax
	// to use when altering the type of a column via ALTER SET.
	AlterSetType string
	// InitcapDefaultDelimiterChars ports INITCAP_DEFAULT_DELIMITER_CHARS (dialects/dialect.py:
	// 762): the delimiter set an INITCAP call is considered to be using the default with, so
	// the generator can drop a redundant delimiters argument (generator.py:6246-6260). hive
	// (dialects/hive.py:35) and spark2 (dialects/spark2.py:29) override it.
	InitcapDefaultDelimiterChars string

	// SupportsDropAlterIcebergProperty ports the generator flag of the same name (generator.py:
	// 619): whether DROP/ALTER can carry the ICEBERG keyword (e.g. Snowflake's `DROP ICEBERG
	// TABLE a.b`; DuckDB overrides to False and just emits `DROP TABLE a.b`).
	SupportsDropAlterIcebergProperty bool
	// SingleStringInterval ports the generator flag of the same name (generator.py:335); postgres
	// overrides to True (generators/postgres.py:233): render INTERVAL as a single quoted
	// "<value> <unit>" string instead of the base's separate `INTERVAL <this> <unit>` tokens.
	SingleStringInterval bool
	// IntervalAllowsPluralForm ports the generator flag of the same name (generator.py:335);
	// mysql overrides to False (generators/mysql.py:132): whether a plural interval unit (e.g.
	// "DAYS") is kept as-is, or singularized via TIME_PART_SINGULARS first.
	IntervalAllowsPluralForm bool
	// ParameterToken ports the generator flag PARAMETER_TOKEN (generator.py:667); postgres
	// overrides to "$" (generators/postgres.py:240): the sigil parameterSQL prefixes a
	// Parameter's name with (base/mysql use "@", postgres uses "$" for its positional $1/$2/...
	// placeholders).
	ParameterToken string
	// LockingReadsSupported ports the generator flag LOCKING_READS_SUPPORTED (generator.py:314);
	// mysql (generators/mysql.py:133) and postgres (generators/postgres.py:235) override to True:
	// whether row-locking read modifiers (FOR UPDATE/SHARE/...) are rendered instead of raising
	// "unsupported".
	LockingReadsSupported bool
	// TablesampleSizeIsPercent ports the dialect flag of the same name (dialects/dialect.py:342);
	// postgres overrides to true (dialects/postgres.py:20): whether a bare numeric size in
	// TABLESAMPLE means percent (rather than rows).
	TablesampleSizeIsPercent bool
	// TablesampleSizeIsRows ports the generator flag TABLESAMPLE_SIZE_IS_ROWS (generator.py:421);
	// postgres overrides to false (generators/postgres.py:242): whether a rendered size needs a
	// trailing ROWS keyword.
	TablesampleSizeIsRows bool
	// TablesampleSeedKeyword ports the generator flag TABLESAMPLE_SEED_KEYWORD (generator.py:430);
	// postgres overrides to "REPEATABLE" (generators/postgres.py:243): the keyword preceding a
	// TABLESAMPLE clause's seed value.
	TablesampleSeedKeyword string
	// TablesampleRequiresParens ports the generator flag TABLESAMPLE_REQUIRES_PARENS
	// (generator.py:418): whether parentheses are required around the table sample's expression.
	TablesampleRequiresParens bool
	// TablesampleWithMethod ports the generator flag TABLESAMPLE_WITH_METHOD (generator.py:427):
	// whether the TABLESAMPLE clause supports a method name, like BERNOULLI.
	TablesampleWithMethod bool
	// TablesampleKeywords ports the generator flag TABLESAMPLE_KEYWORDS (generator.py:424): the
	// keyword(s) to use when generating a sample clause.
	TablesampleKeywords string
	// CopyHasIntoKeyword ports the generator flag COPY_HAS_INTO_KEYWORD (generator.py:526);
	// postgres overrides to False (generators/postgres.py:251): whether copySQL renders
	// `COPY INTO <this>` (base) or `COPY <this>` (postgres).
	CopyHasIntoKeyword bool
	// CopyParamsAreWrapped ports the generator flag COPY_PARAMS_ARE_WRAPPED (generator.py:
	// 520): whether copySQL's WITH-clause params are wrapped in parens (`WITH (...)`,
	// indented when pretty) or emitted bare.
	CopyParamsAreWrapped bool
	// CopyParamsAreCsv ports the dialect flag COPY_PARAMS_ARE_CSV (dialects/dialect.py:363):
	// whether COPY's WITH-clause params are comma-separated (parser: the separator consumed
	// between options; generator: the separator emitted between rendered options).
	CopyParamsAreCsv bool
	// CopyParamsEqRequired ports the generator flag COPY_PARAMS_EQ_REQUIRED (generator.py:
	// 523): whether copyparameterSQL always renders `option = value` (True) or `option value`
	// (False) when a param has a scalar value.
	CopyParamsEqRequired bool
	// JSONArrowsRequireJSONType ports the parser flag JSON_ARROWS_REQUIRE_JSON_TYPE
	// (parsers/postgres.py:191); base/mysql leave it False. When set, a JSON `->`/`->>` RHS
	// that is a literal marks the built JSONExtract/JSONExtractScalar node's only_json_types
	// arg (mirroring build_json_extract_path's arrow_req_json_type branch, dialect.py:
	// 2092-2124), which the generator uses to choose operator-form (`->`/`->>`) over
	// function-form (JSON_EXTRACT_PATH/JSON_EXTRACT_PATH_TEXT) rendering.
	JSONArrowsRequireJSONType bool
	// JSONOperatorsAreBinary ports the v30.17.0 COLUMN_OPERATORS/JSON_OPERATORS split
	// (parsers/postgres.py:192-219, parser.py:6312-6313): when set, the JSON operators
	// (`->` `->>` `#>` `#>>` `?`) leave the accessor tier and bind at the bitwise tier with
	// a term RHS — `1 + j -> 'a'` parses as JSONExtract(Add(1, j), 'a'), matching real PG
	// operator precedence. base/mysql keep the accessor-tier behavior.
	JSONOperatorsAreBinary bool
	// NormalizeNotNull ports NORMALIZE_NOT_NULL (dialect.py:757, v30.17.0; postgres.py:16
	// overrides False): whether a postfix NOTNULL builds the normalized NOT(Is(x, NULL))
	// (true) or Is(x, NULL, negate=True), rendering `x IS NOT NULL` (false, postgres).
	NormalizeNotNull bool

	// SUPPORTS_ALTER_COLUMN_NULLABILITY (generator.py:489, v30.17.0): ALTER COLUMN can set
	// nullability together with its type (mysql true, generators/mysql.py:118).
	SupportsAlterColumnNullability bool
	// SUPPORTS_ALTER_COLUMN_IF_EXISTS (generator.py:492, v30.17.0).
	SupportsAlterColumnIfExists bool
	// JSONTypeRequiredForExtraction ports the generator flag JSON_TYPE_REQUIRED_FOR_EXTRACTION
	// (generator.py:488); mysql (generators/mysql.py:142) and postgres (generators/postgres.py:
	// 245) both override to True. Consumed by arrow_json_extract_sql (dialect.py:1210-1215):
	// when set, a string-literal `this` is wrapped in `CAST(... AS JSON)` before rendering the
	// JSON_EXTRACT_SCALAR arrow form.
	JSONTypeRequiredForExtraction bool
	// StrictCast ports parser.py:1755 STRICT_CAST: whether CAST and :: build Cast (true)
	// or the dialect's permissive TryCast form (false).
	StrictCast bool
	// LogDefaultsToLn ports parser.py:1765 LOG_DEFAULTS_TO_LN: whether one-argument LOG(x)
	// canonicalizes to Ln instead of Log.
	LogDefaultsToLn bool
	// JoinsHaveEqualPrecedence ports parser.py:1824-1828: whether keyword and comma joins build
	// the same left-deep tree instead of keyword JOIN binding more tightly.
	JoinsHaveEqualPrecedence bool
	// AddJoinOnTrue ports parser.py:1842-1844: whether a JOIN without criteria receives ON TRUE
	// so its semantics remain explicit when transpiled to dialects that require a condition.
	AddJoinOnTrue bool
	// RegexpExtractDefaultGroup ports dialect.py:679 and build_regexp_extract at dialect.py:
	// 2343-2360: the capture group inserted when REGEXP_EXTRACT omits its group argument.
	RegexpExtractDefaultGroup int
	// RegexpExtractPositionOverflowReturnsNull ports dialect.py:682-683 and
	// build_regexp_extract at dialect.py:2343-2360: the canonical RegexpExtract node records
	// whether an overflowing position returns NULL rather than an empty string.
	RegexpExtractPositionOverflowReturnsNull bool
	// Functions ports the per-dialect FUNCTIONS class attribute (parsers/mysql.py,
	// parsers/postgres.py, etc.): a dialect-specific overlay of function-name -> builder
	// entries, merged OVER exp.FunctionByName at parse time (see parser/parser.go's
	// functions==nil merge site in parseFunctionCall). Unlike upstream - where every
	// dialect's FUNCTIONS is `{**parser.Parser.FUNCTIONS, ...overrides}`, a single
	// pre-merged class-level dict - this port keeps exp.FunctionByName as the one base map
	// and each Dialect only carries its OWN additions/overrides here, merged in on demand.
	// A nil/empty map (the base Dialect's zero value) means "no per-dialect overrides",
	// so p.dialect.Functions is safe to index even when unset.
	Functions map[string]func([]exp.Expression) exp.Expression
	// TablesampleCSV ports TABLESAMPLE_CSV (parser.py:1851, base False; teradata True): the
	// TABLESAMPLE/SAMPLE argument list is a CSV of primary expressions instead of one number.
	TablesampleCSV bool
	// ValuesFollowedByParen ports the parser flag of the same name (parser.py:1801): whether a
	// bare VALUES keyword not immediately followed by "(" can be reparsed as a plain identifier
	// (e.g. `SELECT values`, `values.c`). MySQL overrides to False (parsers/mysql.py:303),
	// since MySQL treats VALUES specially even without a following paren.
	ValuesFollowedByParen bool
	// TrimPatternFirst ports the parser flag of the same name (parser.py:1860, default False;
	// parsers/spark2.py:22 overrides to True): in `TRIM(<pattern> FROM <expr>)` the FROM token,
	// not the position, decides whether the first argument is the pattern. Consumed by
	// parseTrim (parser/parser_functions.go).
	TrimPatternFirst bool
	// ChangeColumnAlterSyntax ports the parser flag of the same name (parsers/hive.py:60,
	// default False; parsers/spark2.py:23 overrides to True): whether Hive's
	// `CHANGE COLUMN a b <type>` accepts the `TYPE` keyword before the new type. Consumed by
	// parseHiveAlterTableChange (parser/stmt_alter.go).
	ChangeColumnAlterSyntax bool
	// PivotColumnNaming ports the parser flag of the same name (parser.py:1846, default
	// "agg_name_if_aliased"; parsers/spark2.py:24 overrides to "agg_name_if_multiple"): which
	// aggregation-name rule the PIVOT output-column inference uses. Recorded on the Pivot node
	// so the generator can rename the columns when a statement is written under a dialect that
	// names them differently (generator.py:2534-2546).
	PivotColumnNaming string
	// PrefixedPivotColumns ports PREFIXED_PIVOT_COLUMNS (base False; parsers/bigquery.py:190
	// True): the aggregation alias moves to the front of each inferred PIVOT output column
	// name, so `SUM(f) AS sum ... IN ('x')` yields sum_x instead of x_sum. Recorded on the
	// Pivot node alongside PivotColumnNaming (parser.py:5504).
	PrefixedPivotColumns bool
	// ConcatWsCoalesce ports CONCAT_WS_COALESCE (base False; duckdb True): CONCAT_WS ignores
	// NULL arguments.
	ConcatWsCoalesce bool
	// StrictJSONPathSyntax ports STRICT_JSON_PATH_SYNTAX (base True; duckdb and starrocks
	// False): an invalid JSON path logs a warning and the literal is kept.
	StrictJSONPathSyntax bool
	// NumbersCanBeUnderscoreSeparated ports NUMBERS_CAN_BE_UNDERSCORE_SEPARATED (duckdb True).
	NumbersCanBeUnderscoreSeparated bool
	// UUIDIsStringType ports UUID_IS_STRING_TYPE (base True; duckdb False): annotate_types treats
	// UUID as a UUID type rather than text.
	UUIDIsStringType bool
	// MapKeysAreArbitraryExpressions ports MAP_KEYS_ARE_ARBITRARY_EXPRESSIONS (duckdb True): a
	// MAP constructor accepts arbitrary key/value expressions.
	MapKeysAreArbitraryExpressions bool
	// NormalizeExtractDateParts ports NORMALIZE_EXTRACT_DATE_PARTS (base False; duckdb True):
	// EXTRACT's date part is folded through DATE_PART_MAPPING before rendering.
	NormalizeExtractDateParts bool
	// ExponentOperators ports the EXPONENT table (parser.py:989 base {}, parsers/duckdb.py:
	// 106-110 `{CARET, DSTAR} -> Pow`, parsers/teradata.py:99-101 `{DSTAR} -> Pow`): the
	// token types that bind tighter than `*`/`/` and parse as Pow. Keyed by token so a
	// dialect can take only one of the two spellings — Teradata's `^` stays BitwiseXor,
	// only `**` is exponentiation. Postgres's `{CARET} -> Pow` (parsers/postgres.py:168-170)
	// is not set here yet: main never wired it, so `2 ^ 3` stays xor under postgres in this
	// port (upstream generates POWER(2, 3)) — a pre-existing gap, tracked as a follow-up.
	ExponentOperators map[tokens.TokenType]bool
	// RegexpRangeOperators ports duckdb's RANGE_PARSERS[TILDE] = RegexpFullMatch.
	RegexpRangeOperators bool
	// CaretAtStartsWith ports duckdb's RANGE_PARSERS[CARET_AT] = StartsWith.
	CaretAtStartsWith bool
	// ArrayOverlapsDAMP ports duckdb's RANGE_PARSERS[DAMP] = ArrayOverlaps.
	ArrayOverlapsDAMP bool
	// PrefixAlias ports DuckDB's `alias: expression` / `FROM alias: table` prefix aliases
	// (parsers/duckdb.py:341-364).
	PrefixAlias bool
	// LambdaKeyword ports DuckDB's `LAMBDA x : expr` lambda form (parsers/duckdb.py:327-338).
	LambdaKeyword bool
	// ZoneAwareTimestampConstructor ports the parser flag ZONE_AWARE_TIMESTAMP_CONSTRUCTOR
	// (parser.py:1831, default False; parsers/presto.py:61 overrides to True). Consumed at
	// parser.py:6186-6191 when parsing a typed-literal CAST: for a TIMESTAMP-typed literal whose
	// text carries a time-zone offset (TIME_ZONE_RE), the target type is promoted to TIMESTAMPTZ
	// (`TIMESTAMP '2020-01-01 00:00:00+00'` -> CAST(... AS TIMESTAMPTZ)). Presto is the first
	// in-scope override; base/mysql/postgres leave it at the False default.
	ZoneAwareTimestampConstructor bool
	// SupportsPartitionSelection ports the parser flag SUPPORTS_PARTITION_SELECTION
	// (parser.py:1810, default False): whether a table source in FROM may carry a trailing
	// PARTITION(...) selector, e.g. `SELECT * FROM t1 PARTITION(p0)`. MySQL overrides to True
	// (parsers/mysql.py:304); base/postgres leave it False.
	SupportsPartitionSelection bool
	// StringAliases ports the parser flag STRING_ALIASES (parser.py:1780, default False):
	// whether a trailing string constant is folded into an identifier alias in _parse_alias,
	// e.g. the SELECT projection `SELECT 1 'x'` -> `SELECT 1 AS "x"` (parser.py:8490-8492).
	// MySQL/tsql/sqlite override to True (parsers/mysql.py:302, tsql.py:324, sqlite.py:19);
	// base/postgres leave it False, so `SELECT 1 'x'` fails closed there - matching both
	// upstream and the real engines (PG rejects it, MySQL accepts it). This gates only the
	// projection/expression alias in parseAlias; the table-name and table-alias string forms
	// are gated separately by StringTableIdentifiers below.
	StringAliases bool
	// StringTableIdentifiers gates whether a bare string constant may stand in for a table NAME
	// (`FROM 'foo'`) or table ALIAS (`FROM t 'x'`) - _parse_table_part (parser.py:4668) and
	// _parse_table_alias (parser.py:4111), both of which upstream calls UNCONDITIONALLY (there is
	// no upstream flag for this). This port-introduced per-dialect gate defaults True (accept,
	// matching upstream's permissive default so base + the presto/trino/hive/athena partial
	// dialects are unchanged) but is False for postgres and mysql, whose real engines BOTH reject a
	// bare string in either position (verified PG 17.6 / MySQL 8.0.33) - a §1 correctness deviation
	// (follow the engine, not upstream). NB this is orthogonal to StringAliases: MySQL accepts the
	// projection string alias `SELECT 1 'x'` (StringAliases=True) yet rejects the table forms
	// (StringTableIdentifiers=False).
	StringTableIdentifiers bool
	// ReservedKeywords ports the generator class var RESERVED_KEYWORDS (generator.py:790,
	// empty for base/postgres; generators/mysql.py:339 for MySQL): unquoted identifiers whose
	// lowercased name is in this set are quoted on generation (identifier_sql, generator.py:
	// 1983). A nil/empty map (base's zero value) means "quote nothing extra".
	ReservedKeywords map[string]bool
	// StringEscape is STRING_ESCAPES[0] when the dialect lists an escape ahead of the quote
	// (Redshift's ["\\", "'"]); the generator escapes a quote with it. Empty means the
	// tokenizer's escapes decide, as before.
	StringEscape string
	// BitStart/BitEnd, HexStart/HexEnd, ByteStart/ByteEnd port BIT_START/BIT_END,
	// HEX_START/HEX_END, BYTE_START/BYTE_END (dialects/dialect.py:292-295): the
	// bitstringSQL/hexstringSQL/bytestringSQL delimiters, derived upstream from the FIRST
	// entry of the tokenizer's BIT_STRINGS/HEX_STRINGS/BYTE_STRINGS class attribute (e.g.
	// mysql/postgres BIT_STRINGS=[("b'","'"),...] -> BIT_START="b'", BIT_END="'"). Unlike
	// upstream's `_FORMAT_STRINGS` dict (Python dict insertion order), this port's
	// TokenizerConfig.FormatStrings is a plain Go map with no reliable iteration order, so
	// these are explicit per-dialect fields (set alongside QuoteStart/IdentifierStart above)
	// rather than derived from FormatStrings at Dialect-construction time. Empty string
	// (base's zero value) means "dialect has no such string family", matching upstream's
	// None default.
	BitStart, BitEnd   string
	HexStart, HexEnd   string
	ByteStart, ByteEnd string
	// HexStringIsIntegerType ports HEX_STRING_IS_INTEGER_TYPE (dialects/dialect.py:676) and
	// ByteStringIsBytesType ports BYTE_STRING_IS_BYTES_TYPE (dialects/dialect.py:724): neither
	// base, mysql, nor postgres overrides either flag away from its False default, so both
	// stay at the Go zero value for all three dialects here - present for 1:1 fidelity with
	// hexstringSQL/bytestringSQL's upstream signature, not because any in-scope dialect sets
	// them true.
	HexStringIsIntegerType bool
	ByteStringIsBytesType  bool
	// ConcatCoalesce ports CONCAT_COALESCE (dialects/dialect.py:404, postgres.py:15): whether
	// the dialect's native CONCAT function already coalesces NULL args to empty strings.
	// Consumed by parsePrimary's adjacent-string-literal rewrite (`'a' 'b'` -> Concat) to set
	// the built node's own "coalesce" arg to match; postgres is the only override (true) among
	// base/mysql/postgres.
	ConcatCoalesce bool
	// LimitIsTop ports generator.py:382 LIMIT_IS_TOP: a Limit renders as SELECT TOP n
	// instead of a trailing LIMIT clause (TSQL, Teradata).
	LimitIsTop bool
	// ParseJSONName ports PARSE_JSON_NAME (generator.py:590): the function spelling a
	// ParseJSON node renders under, or "" for the bare-value fallback. nil keeps the base
	// PARSE_JSON default.
	ParseJSONName *string
	// LimitFetch ports generator.py:343 LIMIT_FETCH: "LIMIT" or "FETCH". "FETCH" rewrites a
	// Limit into a FETCH clause; "LIMIT" rewrites a Fetch into a LIMIT clause.
	LimitFetch string
	// EnsureBools ports generator.py ENSURE_BOOLS: render boolean literals as 1/0 in
	// predicate positions and (1 = 1)/(1 = 0) elsewhere (TSQL has no boolean type).
	EnsureBools bool
	// CteRecursiveKeywordRequired ports generator.py CTE_RECURSIVE_KEYWORD_REQUIRED
	// (default True); TSQL omits the RECURSIVE keyword.
	CteRecursiveKeywordRequired bool
	// ReturningEnd ports generator.py:385 RETURNING_END (default True): whether RETURNING/
	// OUTPUT renders after the statement body or immediately after the target.
	ReturningEnd bool
	// SetOpModifiers ports parser.py:1867 SET_OP_MODIFIERS: which query modifiers attach to
	// the UNION node rather than its right operand. TSQL keeps only OFFSET there.
	SetOpModifiers map[string]bool
	// OptionalAliasTokenCTE ports parser.py:1899 OPTIONAL_ALIAS_TOKEN_CTE: when false
	// (ClickHouse, parsers/clickhouse.py:246), a CTE requires the explicit AS keyword
	// (parser.py:4218).
	OptionalAliasTokenCTE bool
	// PreserveOriginalNames ports dialect.py:405 PRESERVE_ORIGINAL_NAMES: a function parsed
	// through a known builder records its original spelling in meta["name"], and the
	// function fallback renders that name instead of the class's canonical name
	// (parser.py:7283-7284, generator.py:4680-4681).
	PreserveOriginalNames bool
	// StructDelimiter ports generator.py:679 STRUCT_DELIMITER: the delimiters around a
	// nested DataType's parameter list (default `<...>`; ClickHouse uses `(...)`).
	StructDelimiter [2]string
	// AutoRefreshBareIntervals ports generator.py:340 AUTO_REFRESH_BARE_INTERVALS: a
	// REFRESH schedule interval renders without the INTERVAL keyword (ClickHouse).
	AutoRefreshBareIntervals bool
	// ExtraFuncTokens ports a dialect's FUNC_TOKENS additions (parsers/clickhouse.py:330-336
	// adds AND/FILE/OR/SET): a keyword token in this set starts a function call.
	ExtraFuncTokens map[tokens.TokenType]bool
	// RemovedFunctions names base FUNCTIONS entries a dialect drops
	// (parsers/clickhouse.py:250-254 removes TRANSFORM and APPROX_TOP_SUM).
	RemovedFunctions map[string]bool
	// EscapedSequences ports a dialect's ESCAPED_SEQUENCES table (dialect.py:66-90, derived
	// from UNESCAPED_SEQUENCES): nil keeps the default control-character set.
	EscapedSequences map[byte]string
	// ExtraIdVarTokens ports ID_VAR_TOKENS additions (parsers/clickhouse.py:340-343 adds LIKE).
	ExtraIdVarTokens map[tokens.TokenType]bool
	// WithPropertiesPrefix ports generator.py:558 WITH_PROPERTIES_PREFIX (default "WITH";
	// StarRocks uses "PROPERTIES").
	WithPropertiesPrefix string
	// InsertOverwrite ports generator.py:471 INSERT_OVERWRITE (default " OVERWRITE TABLE";
	// StarRocks uses " OVERWRITE").
	InsertOverwrite string
	// IsBoolAllowed ports generator.py:376 IS_BOOL_ALLOWED (StarRocks disables it).
	IsBoolAllowed bool
	// UpdateStatementSupportsFrom ports generator.py:625 UPDATE_STATEMENT_SUPPORTS_FROM.
	UpdateStatementSupportsFrom bool
	// OnConditionEmptyBeforeError ports dialect.py:654 ON_CONDITION_EMPTY_BEFORE_ERROR:
	// MySQL parses `X ON EMPTY Y ON ERROR`, Oracle the opposite (parser.py:8333-8341).
	OnConditionEmptyBeforeError bool
	// PivotAliasWithAs ports generator.py PIVOT_ALIAS_WITH_AS (Oracle disables it).
	PivotAliasWithAs bool
	// UnpivotAliasesAreIdentifiers ports generator.py UNPIVOT_ALIASES_ARE_IDENTIFIERS
	// (Oracle disables it, keeping string/number aliases as literals).
	UnpivotAliasesAreIdentifiers bool
	// ArrayConcatIsVarLen ports generator.py ARRAY_CONCAT_IS_VAR_LEN: whether ARRAY_CONCAT takes
	// any number of arguments (true) or nests binary calls (false, Redshift).
	ArrayConcatIsVarLen bool
	// ArrayFuncsPropagatesNulls ports ARRAY_FUNCS_PROPAGATES_NULLS (dialects/dialect.py): whether
	// the array functions return NULL when any input array is NULL (Redshift).
	ArrayFuncsPropagatesNulls bool
	// LogBaseFirst ports generator.py LOG_BASE_FIRST (base True; bigquery False): whether the
	// LOG base precedes the value in the canonical node and is swapped when rendering.
	LogBaseFirst bool
	// HexLowercase ports HEX_LOWERCASE (bigquery True): HEX renders lowercase hex digits.
	HexLowercase bool
	// HexFunc ports generator.py HEX_FUNC (base "HEX"; bigquery "TO_HEX").
	HexFunc string
	// JSONExtractScalarScalarOnly ports JSON_EXTRACT_SCALAR_SCALAR_ONLY (bigquery True): the
	// parser records scalar_only on the JSONExtractScalar node.
	JSONExtractScalarScalarOnly bool
	// JSONPathSingleDotIsWildcard ports JSON_PATH_SINGLE_DOT_IS_WILDCARD (bigquery True): a
	// bare `.` with no key is a wildcard rather than a parse error.
	JSONPathSingleDotIsWildcard bool
	// LeastGreatestIgnoresNulls ports LEAST_GREATEST_IGNORES_NULLS (base True; bigquery False):
	// recorded on the parsed Least/Greatest nodes.
	LeastGreatestIgnoresNulls bool
	// DefaultNullType ports DEFAULT_NULL_TYPE (bigquery BIGINT): the type annotate_types gives a
	// bare NULL.
	DefaultNullType exp.DType
	// FormatMapping / InverseFormatMapping port FORMAT_MAPPING (bigquery) and its reverse,
	// the datetime-format tables used by the format_time inversions.
	FormatMapping        map[string]string
	InverseFormatMapping map[string]string
	// SetOpExplicitDistinct ports bigquery's SET_OP_DISTINCT_BY_DEFAULT = None for every set
	// operation: DISTINCT/ALL must always be rendered explicitly.
	SetOpExplicitDistinct bool
	// IgnoreNullsInFunc ports IGNORE_NULLS_IN_FUNC (base False; bigquery True): IGNORE/RESPECT
	// NULLS renders inside the aggregate call rather than after it.
	IgnoreNullsInFunc bool
	// IgnoreNullsBeforeOrder ports IGNORE_NULLS_BEFORE_ORDER (base True): when the aggregate has
	// ORDER BY/LIMIT modifiers, the inline IGNORE NULLS goes before them.
	IgnoreNullsBeforeOrder bool
	// UnnestWithOrdinality ports UNNEST_WITH_ORDINALITY (base True; bigquery False).
	UnnestWithOrdinality bool
	// InUnnestOpBare ports in_unnest_op (generator.py: in_unnest_op defaults to a wrapped
	// SELECT; bigquery renders the bare UNNEST expression).
	InUnnestOpBare bool
	// SupportsTableAliasColumns ports SUPPORTS_TABLE_ALIAS_COLUMNS (base True; bigquery False):
	// a table alias column list is dropped when false.
	SupportsTableAliasColumns bool
	// SupportsWindowExclude ports SUPPORTS_WINDOW_EXCLUDE (generator.py:512, base False;
	// postgres/sqlite/oracle/duckdb set it True): a window frame EXCLUDE clause is rendered
	// instead of dropped with a warning.
	SupportsWindowExclude bool
	// SupportsNamedCTEColumns ports SUPPORTS_NAMED_CTE_COLUMNS (generator.py:459, base True;
	// bigquery False): a CTE alias keeps its column list even when table-alias columns are not
	// supported.
	SupportsNamedCTEColumns bool
	// QualifyBeforeWindow ports bigquery's AFTER_HAVING_MODIFIER_TRANSFORMS order: QUALIFY is
	// rendered before the WINDOW clause (base renders WINDOW first).
	QualifyBeforeWindow bool
	// WildcardTableParts ports bigquery's _parse_table_parts override, which always forwards
	// wildcard=True (parsers/bigquery.py:451) so `x.*` / `x.y*` join the last part.
	WildcardTableParts bool
	// QualifiedTablesCaseSensitive ports BigQuery.normalize_identifier
	// (dialects/bigquery.py:132-159): under CASE_INSENSITIVE, UDF names and qualified table
	// names keep their case, so `FROM Coordinates, \`Coordinates.position\“ does not fold
	// the qualified reference.
	QualifiedTablesCaseSensitive bool
	// TimeFormat ports TIME_FORMAT (snowflake's `'YYYY-MM-DD HH24:MI:SS'`).
	TimeFormat string
	// UnescapedSequences ports UNESCAPED_SEQUENCES (snowflake maps \a and \v).
	UnescapedSequences map[string]string
	// ArrayAggIncludesNulls ports ARRAY_AGG_INCLUDES_NULLS.
	ArrayAggIncludesNulls *bool
	// StarIlikeBackslashEscape ports STAR_ILIKE_BACKSLASH_ESCAPE (snowflake True).
	StarIlikeBackslashEscape bool
	// JSONExtractRequiresJSONExpression ports JSON_EXTRACT_REQUIRES_JSON_EXPRESSION.
	JSONExtractRequiresJSONExpression bool
	// DefaultSamplingMethod ports DEFAULT_SAMPLING_METHOD.
	DefaultSamplingMethod string
	// IdentifyPivotStrings ports IDENTIFY_PIVOT_STRINGS (snowflake True).
	IdentifyPivotStrings bool
	// DirectedJoins ports DIRECTED_JOINS (snowflake True): `[kind] DIRECTED JOIN`.
	DirectedJoins bool
	// RlikeFullMatch ports snowflake RANGE_PARSERS[RLIKE] building RegexpLike(full_match=true).
	RlikeFullMatch bool
	// MapIntervalUnits maps an interval unit through DATE_PART_MAPPING (snowflake W -> WEEK).
	MapIntervalUnits bool
	// JSONKeyValuePairSep ports JSON_KEY_VALUE_PAIR_SEP (base ":"; bigquery/mysql/snowflake/...
	// ","): the separator jsonkeyvalue_sql emits between a JSON object key and value.
	JSONKeyValuePairSep string
	// MoveCTEsToTopLevel ports EXPRESSIONS_WITHOUT_NESTED_CTES  (generator.py:849); Hive
	// (generators/hive.py:246-251) lists Insert/Select/Subquery. A root of one of these kinds
	// hoists every nested WITH before generation (generator.py:986-995). nil disables it, which
	// matches the empty base set.
	MoveCTEsToTopLevel map[exp.Kind]bool
	// DeclareDefaultAssignment ports generator.py:620 DECLARE_DEFAULT_ASSIGNMENT, the token
	// between a DECLARE item's type and its default value (base "="; bigquery/trino "DEFAULT").
	DeclareDefaultAssignment string
	// HasDistinctArrayConstructors ports HAS_DISTINCT_ARRAY_CONSTRUCTORS: ARRAY[...] and
	// ARRAY(...) are different constructors, so the parser records which one was written.
	HasDistinctArrayConstructors bool
	// StarExcludeRequiresDerivedTable ports generator.py STAR_EXCLUDE_REQUIRES_DERIVED_TABLE
	// (true by default; Redshift renders a select-level EXCLUDE inline).
	StarExcludeRequiresDerivedTable bool
	// contains filtered or unexported fields
}

func Athena

func Athena() *Dialect

Athena routes each statement through Hive or Athena-extended Trino.

func Base

func Base() *Dialect

func BigQuery

func BigQuery() *Dialect

BigQuery ports dialects/bigquery.py (class BigQuery): the tokenizer, parser flags and FUNCTIONS overlay. The parser grammar overrides live in parser/dialect_bigquery.go and the generator in generator/dialect_bigquery.go.

func Clickhouse

func Clickhouse() *Dialect

Clickhouse ports the ClickHouse dialect class from .reference/sqlglot-v30.17.0/sqlglot/dialects/clickhouse.py:15-131.

func Databricks

func Databricks() *Dialect

Databricks ports dialects/databricks.py (class Databricks(Spark)): the parser flag and FUNCTIONS overlays, the tokenizer's STREAM/VOID keywords, the JSON path flags and the DatabricksGenerator behavior (generator/dialect_databricks.go).

func Doris

func Doris() *Dialect

Doris ports the Apache Doris dialect class from .reference/sqlglot-v30.17.0/sqlglot/dialects/doris.py:8-15. Like StarRocks, Doris extends MySQL; the parser-override and generator dispatch chains inherit the mysql tables.

func Dremio

func Dremio() *Dialect

Dremio ports the Dremio dialect from .reference/sqlglot-v30.17.0/sqlglot/dialects/dremio.py. It extends the base dialect; the parser overrides live in parser/dialect_dremio.go and the generator overrides in generator/dialect_dremio.go.

func DuckDB

func DuckDB() *Dialect

DuckDB ports dialects/duckdb.py (class DuckDB): the tokenizer, parser flags and FUNCTIONS overlay. The parser grammar overrides live in parser/dialect_duckdb.go and the generator in generator/dialect_duckdb.go.

func GetOrRaise

func GetOrRaise(dialect DialectType) (*Dialect, error)

GetOrRaise resolves a DialectType-style value to a *Dialect, mirroring upstream sqlglot's Dialect.get_or_raise(DialectType): it accepts nil (base), a string (bare name or the comma-separated settings form, e.g. "mysql, normalization_strategy=mysql_case_insensitive"), or an already-built *Dialect (returned as-is). The supported string settings are normalization_strategy and mysql_version (upstream also has "version", not modeled here).

A name is served from a cached template as a shallow copy: field writes are isolated per call, so a per-call setting override cannot leak, but the tokenizer config and mapping tables are shared read-only. Callers must not mutate the maps reached through the returned Dialect; pass a *Dialect you built yourself for a fully private instance.

func GetOrRaiseShared

func GetOrRaiseShared(dialect DialectType) (*Dialect, error)

GetOrRaiseShared resolves a dialect for read-only use: a bare name returns the shared cached template instead of the defensive copy GetOrRaise makes, so it allocates nothing per call. The parse and generate entry points use it because they only read the dialect. The returned value must never be mutated; settings variants and callers that need to change a field must go through GetOrRaise.

func Hive

func Hive() *Dialect

Hive ports the Hive dialect's parser and tokenizer surface. Generator transforms, type mappings, INITCAP behavior, and typing metadata remain intentionally out of scope.

func MariaDB

func MariaDB() *Dialect

MariaDB ports the MariaDB dialect identity. Upstream sqlglot has no MariaDB dialect, so this is a beyond-upstream extension: every MySQL behavior is inherited (the parser and generator override chains treat "mariadb" as a child of "mysql"), and MariaDB-only grammar is gated on this name. The MariaDB-only constructs are:

  • `NEXT VALUE FOR` / `PREVIOUS VALUE FOR` sequences (parser/dialect_mariadb.go),
  • `/*M! ... */` executable comments, activated alongside `/*!` under the `mysql_version` setting (DEVIATIONS "Opt-in behavioral extensions").

See DEVIATIONS "Opt-in behavioral extensions" and testdata/upstream_extensions.jsonl.

func Materialize

func Materialize() *Dialect

Materialize ports the Materialize dialect class (dialects/materialize.py:8-13). It extends Postgres; the parser and generator override chains fall back to the postgres tables.

func MySQL

func MySQL() *Dialect

func Oracle

func Oracle() *Dialect

Oracle ports the Oracle dialect class from .reference/sqlglot-v30.17.0/sqlglot/dialects/oracle.py:15-92.

func Postgres

func Postgres() *Dialect

func Presto

func Presto() *Dialect

Presto ports dialects/presto.py and parsers/presto.py.

func Redshift

func Redshift() *Dialect

Redshift ports the Redshift dialect class (dialects/redshift.py:11-63). It extends Postgres; the parser and generator override chains fall back to the postgres tables.

func RisingWave

func RisingWave() *Dialect

RisingWave ports the RisingWave dialect class (dialects/risingwave.py:9-24). It extends Postgres; the parser and generator override chains fall back to the postgres tables.

func SQLite

func SQLite() *Dialect

SQLite ports the SQLite dialect class from .reference/sqlglot-v30.17.0/sqlglot/dialects/sqlite.py:13-40. It extends the base dialect; the parser overrides live in parser/dialect_sqlite.go and the generator overrides in generator/dialect_sqlite.go.

func Snowflake

func Snowflake() *Dialect

Snowflake ports dialects/snowflake.py (class Snowflake): the tokenizer, parser flags and FUNCTIONS overlay. The parser grammar overrides live in parser/dialect_snowflake.go and the generator in generator/dialect_snowflake.go.

func Spark

func Spark() *Dialect

Spark ports dialects/spark.py (class Spark(Spark2)): Spark 3+'s tokenizer, parser FUNCTIONS overlay and feature flags. The SparkGenerator behavior is registered in generator/dialect_spark.go.

func Spark2

func Spark2() *Dialect

Spark2 ports dialects/spark2.py (class Spark2(Hive)): Hive plus the Spark 2.x specifics - the tokenizer's X'…' hex strings and TIMESTAMP keyword remap, the parser-side flags and FUNCTIONS overlay (parsers/spark2.py), and the Spark2Generator behavior, which is registered in the generator package (generator/dialect_spark2.go).

func StarRocks

func StarRocks() *Dialect

StarRocks ports the StarRocks dialect class from .reference/sqlglot-v30.17.0/sqlglot/dialects/starrocks.py:9-22. StarRocks extends MySQL, so this starts from MySQL() and applies the StarRocks deltas.

func TSQL

func TSQL() *Dialect

TSQL ports the T-SQL (Microsoft SQL Server) dialect class from .reference/sqlglot-v30.17.0/sqlglot/dialects/tsql.py:14-194.

func Teradata

func Teradata() *Dialect

Teradata ports the Teradata dialect from .reference/sqlglot-v30.17.0/sqlglot/dialects/teradata.py (parser overrides in parser/dialect_teradata.go, generator overrides in generator/dialect_teradata.go).

func Trino

func Trino() *Dialect

Trino ports the dialect deltas in .reference/sqlglot-v30.12.0/sqlglot/dialects/trino.py:9-20 and the function registry additions in .reference/sqlglot-v30.12.0/sqlglot/parsers/trino.py:15-18. Each call starts from a fresh Presto instance so no inherited map is shared with a separately constructed dialect.

func (*Dialect) CanQuote

func (d *Dialect) CanQuote(identifier exp.Expression, identify any) bool

func (*Dialect) CaseSensitive

func (d *Dialect) CaseSensitive(text string) bool

func (*Dialect) FoldIdentifierName

func (d *Dialect) FoldIdentifierName(name string, isTable bool) string

FoldIdentifierName applies the dialect's normalization strategy to a bare identifier NAME (a plain string with no AST node/parent), returning the folded form. It is the string-level counterpart to NormalizeIdentifier — which derives an identifier's role from its parent — for callers that must fold a detached name (e.g. a catalog/schema key) where no AST context exists. isTable selects the role for the role-aware MySQLCaseSensitiveTableNames strategy (lctn=0): true = a relation-level name (table/schema/catalog/alias/CTE) that stays case-sensitive; false = a column-level name that folds. It is ignored by the other strategies.

The input is treated as an UNQUOTED name (folding is unconditional): callers pass a name they have already decided is unquoted, matching how schema normalization builds identifiers with quoted=false. A quoted name must not be folded and should not be passed here.

func (*Dialect) GenerateValuesAliases

func (d *Dialect) GenerateValuesAliases(values exp.Expression) []exp.Expression

func (*Dialect) IsReservedKeyword

func (d *Dialect) IsReservedKeyword(word string) bool

IsReservedKeyword reports whether word is a reserved keyword in this dialect — a word that cannot be an unquoted identifier. It is the case-safe accessor for ReservedKeywords (which is stored lowercase-keyed): a consumer folding keyword case must fold ONLY reserved words, since a non-reserved keyword can be a case-sensitive identifier (e.g. on MySQL lower_case_table_names=0). Only MySQL populates a reserved set today; other dialects return false.

func (*Dialect) JSONPathConfig added in v0.41.0

func (d *Dialect) JSONPathConfig() jsonpath.Config

JSONPathConfig assembles the dialect's jsonpath.Config from the JSONPath flags (jsonpath.py:15-45 and the per-dialect JSONPathTokenizer overrides).

func (*Dialect) NewTokenizer

func (d *Dialect) NewTokenizer() *tokens.Tokenizer

func (*Dialect) NormalizeIdentifier

func (d *Dialect) NormalizeIdentifier(e exp.Expression) exp.Expression

func (*Dialect) NormalizeIdentifiers

func (d *Dialect) NormalizeIdentifiers(expression exp.Expression) exp.Expression

NormalizeIdentifiers folds unquoted identifiers in the tree per this dialect's normalization strategy, mirroring upstream's normalize_identifiers(expression, dialect) walker (optimizer/normalize_identifiers.py:34-78).

The walk lives on the Dialect instead of in the optimizer package because the parser needs it too: upstream's _implicit_unnests_to_explicit imports it lazily inside the function (parser.py:4306) precisely to dodge a module-level cycle. Go has no lazy imports, so keeping the walk in the optimizer would make parser -> optimizer cycle against the optimizer's own internal tests, which reach the parser through the root package.

func (*Dialect) QuoteIdentifier

func (d *Dialect) QuoteIdentifier(identifier exp.Expression, identify bool) exp.Expression

func (*Dialect) SettingsString

func (d *Dialect) SettingsString() string

SettingsString serializes the dialect to the canonical "name, normalization_strategy=..." form that GetOrRaise round-trips. It captures the state that participates in identifier resolution — the dialect name (tokenizer/quoting) and normalization_strategy — which is the complete set of *Dialect state the qualify pipeline consults. Other tweaked fields are not serialized (they don't affect qualify), so a *Dialect handed to CanonicalString is honored for those two facets.

func (*Dialect) ToJSONPath added in v0.41.0

func (d *Dialect) ToJSONPath(path exp.Expression) exp.Expression

ToJSONPath ports Dialect.to_json_path (dialects/dialect.py:1153-1166): a Literal path is parsed into an exp.JSONPath when the dialect's JSONPath tokenizer accepts it; otherwise the literal is kept and, under StrictJSONPathSyntax, a warning is logged.

type DialectType

type DialectType = exp.DialectType

DialectType is the polymorphic dialect argument accepted throughout the public API, mirroring upstream sqlglot's DialectType (dialect.py: Union[str, Dialect, Type[Dialect], None]). A value is one of:

  • nil — the base, dialect-agnostic dialect
  • string — a dialect name, optionally followed by comma-separated settings, e.g. "mysql" or "mysql, mysql_version=8.0.35, normalization_strategy=..."
  • *Dialect — an already-resolved dialect (returned as-is by GetOrRaise)

It is a type alias for any, so it is fully interchangeable with any: adding it to a signature never breaks an existing string/*Dialect/nil caller. On a hot path prefer passing a *Dialect (resolve once via GetOrRaise) — each string value is re-resolved into a fresh *Dialect on every call, so reusing one avoids that repeated work.

The underlying alias is declared in the root expressions package (as expressions.DialectType) so that package's builders and the parse/generate hooks can name the same type without importing dialects (which would form an import cycle, since dialects imports expressions). This is the canonical public name; the two are identical and interchangeable.

type JSONPathKeySafety added in v0.41.0

type JSONPathKeySafety int

JSONPathKeySafety selects the dialect's SAFE_JSON_PATH_KEY_RE variant (generator.py:853 base; generators/hive.py:237 and generators/bigquery.py).

const (
	// JSONPathKeySafetyBase is ^[_a-zA-Z][\w]*$ (SAFE_IDENTIFIER_RE).
	JSONPathKeySafetyBase JSONPathKeySafety = iota
	// JSONPathKeySafetyDash is hive's ^[_\-a-zA-Z][\-\w]*$.
	JSONPathKeySafetyDash
	// JSONPathKeySafetyBigQuery is bigquery's ^[\-\w]*$ (also matches the empty key).
	JSONPathKeySafetyBigQuery
)

type NormalizationStrategy

type NormalizationStrategy int
const (
	Lowercase NormalizationStrategy = iota
	Uppercase
	CaseSensitive
	CaseInsensitive
	CaseInsensitiveUppercase

	// MySQLCaseInsensitive folds EVERY identifier (columns AND table/schema names), regardless of
	// quoting, with MySQLLower. Models MySQL with lower_case_table_names=1/2 (all names
	// case-insensitive).
	MySQLCaseInsensitive
	// MySQLCaseSensitiveTableNames is role-aware: table/database name identifiers are
	// case-sensitive (never folded); every other identifier (columns, aliases, CTE names, ...)
	// is folded with MySQLLower, regardless of quoting. Models MySQL's default on a
	// case-sensitive filesystem (lower_case_table_names=0): columns case-insensitive on every
	// platform, database/table names case-sensitive on Linux.
	MySQLCaseSensitiveTableNames
)

Jump to

Keyboard shortcuts

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