Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
2f8e2dc
Add support for CreateAlterDatabaseStatementTests110 parsing features
kyleconroy Jan 15, 2026
d5cbf30
Fix index options parsing for table constraints
kyleconroy Jan 15, 2026
40a1968
Add ALTER AVAILABILITY GROUP statement parsing support
kyleconroy Jan 15, 2026
d7016af
Handle deprecated sorted_data and sorted_data_reorg index options
kyleconroy Jan 15, 2026
9a43ab3
Add JSON_OBJECT and JSON_ARRAY function parsing support
kyleconroy Jan 15, 2026
f23c6aa
Fix InsertBulkColumnDefinition NullNotNull marshaling
kyleconroy Jan 15, 2026
4bab61b
Uppercase TIMESTAMP column identifier in INSERT BULK
kyleconroy Jan 15, 2026
744ea52
Preserve original case for NULL in DIRECTORY_NAME option
kyleconroy Jan 15, 2026
380b24e
Add INDEX = value syntax support for table hints
kyleconroy Jan 15, 2026
e47180f
Add CREATE SELECTIVE XML INDEX statement support
kyleconroy Jan 15, 2026
047f403
Add AUTOMATIC_TUNING database option parsing support
kyleconroy Jan 15, 2026
8605586
Add QUERY_STORE database option parsing support
kyleconroy Jan 16, 2026
1efd00f
Add ALTER DATABASE SCOPED CONFIGURATION SET statement parsing
kyleconroy Jan 16, 2026
cd7d6e1
Add OPTIMIZE_FOR_SEQUENTIAL_KEY index option support
kyleconroy Jan 16, 2026
14ae254
Add QUERY_STORE FLUSH_INTERVAL_SECONDS option and fix CLEAR ALL
kyleconroy Jan 16, 2026
dd5a7b8
Add MERGE statement enhancements for INSERT/TOP/OPTION support
kyleconroy Jan 16, 2026
1cd8269
Add column definition enhancements for IDENTITY/constraints
kyleconroy Jan 16, 2026
21ce89d
Add ALTER INDEX enhancements for DATA_COMPRESSION and WAIT_AT_LOW_PRI…
kyleconroy Jan 16, 2026
fc5c95b
Add IGNORE_DUP_KEY SUPPRESS_MESSAGES and COLUMNSTORE INDEX ONLINE sup…
kyleconroy Jan 16, 2026
f5f21dd
Add ALTER MATERIALIZED VIEW and ROUND_ROBIN distribution support
kyleconroy Jan 16, 2026
c4759e0
Add full CREATE/ALTER FULLTEXT INDEX parsing support
kyleconroy Jan 16, 2026
bad1829
Add ALTER TABLE REBUILD index options support
kyleconroy Jan 16, 2026
873a35a
Add ALTER INDEX 140 features support
kyleconroy Jan 16, 2026
d0e66d1
Add CTAS (CREATE TABLE AS SELECT) statement parsing support
kyleconroy Jan 16, 2026
c5895c8
Preserve original case for generic database scoped configuration options
kyleconroy Jan 16, 2026
ef6fcaa
Add ALTER SERVER CONFIGURATION statement support
kyleconroy Jan 16, 2026
db18793
Preserve original case for DEFAULT literal in ALTER SERVER CONFIGURATION
kyleconroy Jan 16, 2026
5950417
Add optional equals sign handling for fulltext index options
kyleconroy Jan 16, 2026
ef00a6a
Add multi-word data type support for CHARACTER VARYING, NCHAR VARYING
kyleconroy Jan 16, 2026
87dd9a1
Add comprehensive FROM clause parsing support
kyleconroy Jan 16, 2026
9da649c
Add rowset table reference parsing support
kyleconroy Jan 16, 2026
21156b7
Fix nested parenthesized query expression parsing
kyleconroy Jan 16, 2026
227c7e5
Add DROP SERVER AUDIT SPECIFICATION statement support
kyleconroy Jan 16, 2026
20815bf
Add Location, DataSourceType, PreviousPushDownOption to ALTER EXTERNA…
kyleconroy Jan 16, 2026
d0496a0
Support old-style table hints after TABLESAMPLE clause
kyleconroy Jan 16, 2026
d8db13f
Add CREATE FULLTEXT INDEX column parsing with LANGUAGE support
kyleconroy Jan 16, 2026
1ddac5f
Add FOR SYSTEM_TIME temporal clause parsing
kyleconroy Jan 16, 2026
c476b26
Handle identifier literals in OPENROWSET BULK options
kyleconroy Jan 16, 2026
ea548ca
Add VARYING and FOR REPLICATION parsing for procedures
kyleconroy Jan 16, 2026
97f4e84
Add support for MoneyLiteral, RealLiteral and IdentifierLiteral in pr…
kyleconroy Jan 16, 2026
ab6e7a7
Handle string literals and negative numbers in generic DB scoped config
kyleconroy Jan 16, 2026
6857a21
Add OPENJSON table reference support with WITH schema clause
kyleconroy Jan 16, 2026
09af88d
Add JsonPath field for OPENROWSET column JSON path mappings
kyleconroy Jan 16, 2026
5a66f17
Add ALTER COLUMN support for ALTER FULLTEXT INDEX statement
kyleconroy Jan 16, 2026
112e786
Fix identifier quoting for generic database scoped configuration options
kyleconroy Jan 16, 2026
4013de1
Add complete external file format options parsing support
kyleconroy Jan 16, 2026
e062ae3
Add DISTRIBUTION option support for CREATE EXTERNAL TABLE
kyleconroy Jan 16, 2026
4586de6
Add remaining CREATE EXTERNAL TABLE options support
kyleconroy Jan 16, 2026
e0d0edc
Wrap IN predicate subquery in ScalarSubquery for JSON output
kyleconroy Jan 16, 2026
dd42f28
Add WITH clause support for ALTER TABLE ALTER COLUMN
kyleconroy Jan 16, 2026
1b69175
Add alias support to VariableTableReference
kyleconroy Jan 16, 2026
81b0b38
Add GENERATED ALWAYS AS support for ALTER TABLE ALTER COLUMN
kyleconroy Jan 16, 2026
6635435
Add Event Session statement support
kyleconroy Jan 16, 2026
8c359e2
Add ALTER AUTHORIZATION statement and AS clause support
kyleconroy Jan 16, 2026
acbbdd5
Add IPv4 address parsing for CREATE ENDPOINT statements
kyleconroy Jan 16, 2026
99ba7fe
Add AUTHORIZATION clause and IP range support for endpoints
kyleconroy Jan 16, 2026
a5c42aa
Add CREATE EVENT NOTIFICATION statement support
kyleconroy Jan 16, 2026
e725593
Add CREATE/ALTER SECURITY POLICY statement support
kyleconroy Jan 16, 2026
8ed22c5
Add graph database and temporal table parsing support
kyleconroy Jan 16, 2026
628f301
Add comprehensive boolean expression parsing support
kyleconroy Jan 16, 2026
a869586
Add graph DB pseudo column support and $ref handling
kyleconroy Jan 16, 2026
53e4097
Add ALTER TABLE SPLIT/MERGE RANGE partition support
kyleconroy Jan 16, 2026
18ec952
Add LEFT and RIGHT string function support
kyleconroy Jan 16, 2026
f5c28ac
Add ROWSET_OPTIONS JSON normalization for OpenRowset bulk statements
kyleconroy Jan 16, 2026
9ca8720
Add SEARCH PROPERTY LIST support for fulltext index statements
kyleconroy Jan 16, 2026
66f3e1d
Fix MATCH clause AND handling to create flat left-associative structure
kyleconroy Jan 16, 2026
e29bfbb
Add PERIOD FOR SYSTEM_TIME support in ALTER TABLE statements
kyleconroy Jan 16, 2026
1133ab8
Add COPY INTO statement parsing for Azure Synapse Analytics
kyleconroy Jan 16, 2026
3fce598
Add CREATE ENDPOINT statement support with all protocol/payload options
kyleconroy Jan 16, 2026
fd34163
Add expression parsing improvements for T-SQL features
kyleconroy Jan 16, 2026
0081e36
Add expression parsing improvements for COLLATE and pseudo columns
kyleconroy Jan 16, 2026
9e75fd9
Add nested paren table ref handling and VariableTableReference alias …
kyleconroy Jan 16, 2026
0354255
Add old-style table hint support and LOCAL join modifier
kyleconroy Jan 16, 2026
45c18f1
Add graph edge CONNECTION constraint parsing with ON DELETE CASCADE
kyleconroy Jan 16, 2026
47a197d
Add SQL140 CREATE TABLE features: SUPPRESS_MESSAGES, ENCRYPTED, HIDDE…
kyleconroy Jan 16, 2026
06e3f96
Preserve singular vs plural form for retention period units
kyleconroy Jan 16, 2026
934b947
Add CREATE TABLE 130 features: PARTITION, NOT ENFORCED, filtered inde…
kyleconroy Jan 16, 2026
0d5a7ea
Add Always Encrypted column encryption key support
kyleconroy Jan 16, 2026
6b11d89
Add SHORTEST_PATH graph query pattern support
kyleconroy Jan 16, 2026
14461cc
Add ledger table support for SQL Server 2022
kyleconroy Jan 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions ast/adhoc_table_reference.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package ast

// AdHocTableReference represents a table accessed via OPENDATASOURCE
// Syntax: OPENDATASOURCE('provider', 'connstr').'object'
// Uses AdHocDataSource from execute_statement.go
type AdHocTableReference struct {
DataSource *AdHocDataSource `json:"DataSource,omitempty"`
Object *SchemaObjectNameOrValueExpression `json:"Object,omitempty"`
Alias *Identifier `json:"Alias,omitempty"`
ForPath bool `json:"ForPath"`
}

func (*AdHocTableReference) node() {}
func (*AdHocTableReference) tableReference() {}

// SchemaObjectNameOrValueExpression represents either a schema object name or a value expression
type SchemaObjectNameOrValueExpression struct {
SchemaObjectName *SchemaObjectName `json:"SchemaObjectName,omitempty"`
ValueExpression ScalarExpression `json:"ValueExpression,omitempty"`
}
11 changes: 11 additions & 0 deletions ast/alter_authorization_statement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package ast

// AlterAuthorizationStatement represents an ALTER AUTHORIZATION statement
type AlterAuthorizationStatement struct {
SecurityTargetObject *SecurityTargetObject
ToSchemaOwner bool
PrincipalName *Identifier
}

func (s *AlterAuthorizationStatement) node() {}
func (s *AlterAuthorizationStatement) statement() {}
45 changes: 45 additions & 0 deletions ast/alter_availability_group_statement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package ast

// AlterAvailabilityGroupStatement represents ALTER AVAILABILITY GROUP statement
type AlterAvailabilityGroupStatement struct {
Name *Identifier
StatementType string // "Action", "AddDatabase", "RemoveDatabase", "AddReplica", "ModifyReplica", "RemoveReplica", "Set"
Action AvailabilityGroupAction
Databases []*Identifier
Replicas []*AvailabilityReplica
Options []AvailabilityGroupOption
}

func (s *AlterAvailabilityGroupStatement) node() {}
func (s *AlterAvailabilityGroupStatement) statement() {}

// AvailabilityGroupAction is an interface for availability group actions
type AvailabilityGroupAction interface {
node()
availabilityGroupAction()
}

// AlterAvailabilityGroupAction represents simple actions like JOIN, ONLINE, OFFLINE
type AlterAvailabilityGroupAction struct {
ActionType string // "Join", "ForceFailoverAllowDataLoss", "Online", "Offline"
}

func (a *AlterAvailabilityGroupAction) node() {}
func (a *AlterAvailabilityGroupAction) availabilityGroupAction() {}

// AlterAvailabilityGroupFailoverAction represents FAILOVER action with options
type AlterAvailabilityGroupFailoverAction struct {
ActionType string // "Failover"
Options []*AlterAvailabilityGroupFailoverOption
}

func (a *AlterAvailabilityGroupFailoverAction) node() {}
func (a *AlterAvailabilityGroupFailoverAction) availabilityGroupAction() {}

// AlterAvailabilityGroupFailoverOption represents an option for failover action
type AlterAvailabilityGroupFailoverOption struct {
OptionKind string // "Target"
Value ScalarExpression // StringLiteral for target server
}

func (o *AlterAvailabilityGroupFailoverOption) node() {}
233 changes: 233 additions & 0 deletions ast/alter_database_set_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,58 @@ func (l *LiteralDatabaseOption) node() {}
func (l *LiteralDatabaseOption) databaseOption() {}
func (l *LiteralDatabaseOption) createDatabaseOption() {}

// AutomaticTuningDatabaseOption represents AUTOMATIC_TUNING option
type AutomaticTuningDatabaseOption struct {
OptionKind string // "AutomaticTuning"
AutomaticTuningState string // "Inherit", "Custom", "Auto", "NotSet"
Options []AutomaticTuningOption // Sub-options like CREATE_INDEX, DROP_INDEX, etc.
}

func (a *AutomaticTuningDatabaseOption) node() {}
func (a *AutomaticTuningDatabaseOption) databaseOption() {}

// AutomaticTuningOption is an interface for automatic tuning sub-options
type AutomaticTuningOption interface {
Node
automaticTuningOption()
}

// AutomaticTuningCreateIndexOption represents CREATE_INDEX option
type AutomaticTuningCreateIndexOption struct {
OptionKind string // "Create_Index"
Value string // "On", "Off", "Default"
}

func (a *AutomaticTuningCreateIndexOption) node() {}
func (a *AutomaticTuningCreateIndexOption) automaticTuningOption() {}

// AutomaticTuningDropIndexOption represents DROP_INDEX option
type AutomaticTuningDropIndexOption struct {
OptionKind string // "Drop_Index"
Value string // "On", "Off", "Default"
}

func (a *AutomaticTuningDropIndexOption) node() {}
func (a *AutomaticTuningDropIndexOption) automaticTuningOption() {}

// AutomaticTuningForceLastGoodPlanOption represents FORCE_LAST_GOOD_PLAN option
type AutomaticTuningForceLastGoodPlanOption struct {
OptionKind string // "Force_Last_Good_Plan"
Value string // "On", "Off", "Default"
}

func (a *AutomaticTuningForceLastGoodPlanOption) node() {}
func (a *AutomaticTuningForceLastGoodPlanOption) automaticTuningOption() {}

// AutomaticTuningMaintainIndexOption represents MAINTAIN_INDEX option
type AutomaticTuningMaintainIndexOption struct {
OptionKind string // "Maintain_Index"
Value string // "On", "Off", "Default"
}

func (a *AutomaticTuningMaintainIndexOption) node() {}
func (a *AutomaticTuningMaintainIndexOption) automaticTuningOption() {}

// ElasticPoolSpecification represents SERVICE_OBJECTIVE = ELASTIC_POOL(name = poolname)
type ElasticPoolSpecification struct {
ElasticPoolName *Identifier
Expand Down Expand Up @@ -377,3 +429,184 @@ type GenericDatabaseOption struct {

func (g *GenericDatabaseOption) node() {}
func (g *GenericDatabaseOption) databaseOption() {}

// HadrDatabaseOption represents ALTER DATABASE SET HADR {SUSPEND|RESUME|OFF}
type HadrDatabaseOption struct {
HadrOption string // "Suspend", "Resume", "Off"
OptionKind string // "Hadr"
}

func (h *HadrDatabaseOption) node() {}
func (h *HadrDatabaseOption) databaseOption() {}

// HadrAvailabilityGroupDatabaseOption represents ALTER DATABASE SET HADR AVAILABILITY GROUP = name
type HadrAvailabilityGroupDatabaseOption struct {
GroupName *Identifier
HadrOption string // "AvailabilityGroup"
OptionKind string // "Hadr"
}

func (h *HadrAvailabilityGroupDatabaseOption) node() {}
func (h *HadrAvailabilityGroupDatabaseOption) databaseOption() {}

// TargetRecoveryTimeDatabaseOption represents TARGET_RECOVERY_TIME database option
type TargetRecoveryTimeDatabaseOption struct {
OptionKind string // "TargetRecoveryTime"
RecoveryTime ScalarExpression // Integer literal
Unit string // "Seconds" or "Minutes"
}

func (t *TargetRecoveryTimeDatabaseOption) node() {}
func (t *TargetRecoveryTimeDatabaseOption) databaseOption() {}

// QueryStoreDatabaseOption represents QUERY_STORE database option
type QueryStoreDatabaseOption struct {
OptionKind string // "QueryStore"
OptionState string // "On", "Off", "NotSet"
Clear bool // QUERY_STORE CLEAR [ALL]
ClearAll bool // QUERY_STORE CLEAR ALL
Options []QueryStoreOption // Sub-options
}

func (q *QueryStoreDatabaseOption) node() {}
func (q *QueryStoreDatabaseOption) databaseOption() {}

// QueryStoreOption is an interface for query store sub-options
type QueryStoreOption interface {
Node
queryStoreOption()
}

// QueryStoreDesiredStateOption represents DESIRED_STATE option
type QueryStoreDesiredStateOption struct {
OptionKind string // "Desired_State"
Value string // "ReadOnly", "ReadWrite", "Off"
OperationModeSpecified bool // Whether OPERATION_MODE was explicitly specified
}

func (q *QueryStoreDesiredStateOption) node() {}
func (q *QueryStoreDesiredStateOption) queryStoreOption() {}

// QueryStoreCapturePolicyOption represents QUERY_CAPTURE_MODE option
type QueryStoreCapturePolicyOption struct {
OptionKind string // "Query_Capture_Mode"
Value string // "ALL", "AUTO", "NONE", "CUSTOM"
}

func (q *QueryStoreCapturePolicyOption) node() {}
func (q *QueryStoreCapturePolicyOption) queryStoreOption() {}

// QueryStoreSizeCleanupPolicyOption represents SIZE_BASED_CLEANUP_MODE option
type QueryStoreSizeCleanupPolicyOption struct {
OptionKind string // "Size_Based_Cleanup_Mode"
Value string // "OFF", "AUTO"
}

func (q *QueryStoreSizeCleanupPolicyOption) node() {}
func (q *QueryStoreSizeCleanupPolicyOption) queryStoreOption() {}

// QueryStoreIntervalLengthOption represents INTERVAL_LENGTH_MINUTES option
type QueryStoreIntervalLengthOption struct {
OptionKind string // "Interval_Length_Minutes"
StatsIntervalLength ScalarExpression // Integer literal
}

func (q *QueryStoreIntervalLengthOption) node() {}
func (q *QueryStoreIntervalLengthOption) queryStoreOption() {}

// QueryStoreMaxStorageSizeOption represents MAX_STORAGE_SIZE_MB option
type QueryStoreMaxStorageSizeOption struct {
OptionKind string // "Current_Storage_Size_MB" (note: uses Current_Storage_Size_MB as OptionKind)
MaxQdsSize ScalarExpression // Integer literal
}

func (q *QueryStoreMaxStorageSizeOption) node() {}
func (q *QueryStoreMaxStorageSizeOption) queryStoreOption() {}

// QueryStoreMaxPlansPerQueryOption represents MAX_PLANS_PER_QUERY option
type QueryStoreMaxPlansPerQueryOption struct {
OptionKind string // "Max_Plans_Per_Query"
MaxPlansPerQuery ScalarExpression // Integer literal
}

func (q *QueryStoreMaxPlansPerQueryOption) node() {}
func (q *QueryStoreMaxPlansPerQueryOption) queryStoreOption() {}

// QueryStoreTimeCleanupPolicyOption represents STALE_QUERY_THRESHOLD_DAYS option (in CLEANUP_POLICY)
type QueryStoreTimeCleanupPolicyOption struct {
OptionKind string // "Stale_Query_Threshold_Days"
StaleQueryThreshold ScalarExpression // Integer literal
}

func (q *QueryStoreTimeCleanupPolicyOption) node() {}
func (q *QueryStoreTimeCleanupPolicyOption) queryStoreOption() {}

// QueryStoreWaitStatsCaptureOption represents WAIT_STATS_CAPTURE_MODE option
type QueryStoreWaitStatsCaptureOption struct {
OptionKind string // "Wait_Stats_Capture_Mode"
OptionState string // "On", "Off"
}

func (q *QueryStoreWaitStatsCaptureOption) node() {}
func (q *QueryStoreWaitStatsCaptureOption) queryStoreOption() {}

// QueryStoreDataFlushIntervalOption represents FLUSH_INTERVAL_SECONDS/DATA_FLUSH_INTERVAL_SECONDS option
type QueryStoreDataFlushIntervalOption struct {
OptionKind string // "Flush_Interval_Seconds"
FlushInterval ScalarExpression // Integer literal
}

func (q *QueryStoreDataFlushIntervalOption) node() {}
func (q *QueryStoreDataFlushIntervalOption) queryStoreOption() {}

// AlterDatabaseScopedConfigurationSetStatement represents ALTER DATABASE SCOPED CONFIGURATION SET statement
type AlterDatabaseScopedConfigurationSetStatement struct {
Secondary bool
Option DatabaseConfigurationSetOption
}

func (a *AlterDatabaseScopedConfigurationSetStatement) node() {}
func (a *AlterDatabaseScopedConfigurationSetStatement) statement() {}

// DatabaseConfigurationSetOption is an interface for scoped configuration options
type DatabaseConfigurationSetOption interface {
Node
databaseConfigurationSetOption()
}

// MaxDopConfigurationOption represents MAXDOP configuration option
type MaxDopConfigurationOption struct {
OptionKind string // "MaxDop"
Value ScalarExpression // Integer value
Primary bool // true if set to PRIMARY
}

func (m *MaxDopConfigurationOption) node() {}
func (m *MaxDopConfigurationOption) databaseConfigurationSetOption() {}

// OnOffPrimaryConfigurationOption represents ON/OFF/PRIMARY configuration option
type OnOffPrimaryConfigurationOption struct {
OptionKind string // "LegacyCardinalityEstimate", "ParameterSniffing", "QueryOptimizerHotFixes"
OptionState string // "On", "Off", "Primary"
}

func (o *OnOffPrimaryConfigurationOption) node() {}
func (o *OnOffPrimaryConfigurationOption) databaseConfigurationSetOption() {}

// GenericConfigurationOption represents a generic configuration option
type GenericConfigurationOption struct {
OptionKind string // "MaxDop"
GenericOptionKind *Identifier // The custom option name
GenericOptionState *IdentifierOrScalarExpression // The value (identifier or scalar)
}

func (g *GenericConfigurationOption) node() {}
func (g *GenericConfigurationOption) databaseConfigurationSetOption() {}

// IdentifierOrScalarExpression represents either an identifier or a scalar expression
type IdentifierOrScalarExpression struct {
Identifier *Identifier
ScalarExpression ScalarExpression
}

func (i *IdentifierOrScalarExpression) node() {}
17 changes: 17 additions & 0 deletions ast/alter_index_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,29 @@ type SelectiveXmlIndexPromotedPath struct {
Name *Identifier
Path *StringLiteral
XQueryDataType *StringLiteral
SQLDataType *SqlDataTypeReference
MaxLength *IntegerLiteral
IsSingleton bool
}

func (s *SelectiveXmlIndexPromotedPath) node() {}

// CreateSelectiveXmlIndexStatement represents CREATE SELECTIVE XML INDEX statement
type CreateSelectiveXmlIndexStatement struct {
Name *Identifier
OnName *SchemaObjectName
XmlColumn *Identifier
IsSecondary bool
UsingXmlIndexName *Identifier // For secondary indexes
PathName *Identifier // For secondary indexes
PromotedPaths []*SelectiveXmlIndexPromotedPath
XmlNamespaces *XmlNamespaces
IndexOptions []IndexOption
}

func (s *CreateSelectiveXmlIndexStatement) statement() {}
func (s *CreateSelectiveXmlIndexStatement) node() {}

// XmlNamespaces represents a WITH XMLNAMESPACES clause
type XmlNamespaces struct {
XmlNamespacesElements []XmlNamespacesElement
Expand Down
Loading
Loading