Eliminate all "omni too permissive" oracle mismatches where omni accepts invalid option names that SQL Server 2022 rejects. Drive TestKeywordOracleOptionPositions to 0 mismatches.
- Oracle test:
mssql/parser/oracle_test.go→TestKeywordOracleOptionPositions(80 cases, 33 mismatches) - Oracle: SQL Server 2022 via testcontainers (
SET PARSEONLY ON) - SqlScriptDOM OptionsHelper classes:
../SqlScriptDOM/SqlScriptDom/Parser/TSql/*.cs - Build check:
go build ./mssql/... - Full regression:
go test ./mssql/... -count=1 -short
0 mismatches. All 17 categories passing. TestKeywordOracleOptionPositions: 33 → 0 mismatches.
-
optionSettype defined for declaring valid option names per position - helper function
isValidOption(opts optionSet) boolchecks current token against valid set - helper function
expectOption(opts optionSet) (string, error)consumes and validates - optionSet supports both keyword tokens and identifier strings (for unregistered option names)
- enforcement test:
TestOptionValidationverifies valid options accepted, invalid rejected - framework does not break any existing parser tests
Verification: go build ./mssql/... + go test ./mssql/... -count=1 -short
-
SET ANSI_NULLS ONaccepted (valid) -
SET QUOTED_IDENTIFIER OFFaccepted (valid) -
SET ARITHABORT ONaccepted (valid) -
SET SELECT ONrejected (invalid — SELECT is not a SET option) -
SET FROM OFFrejected (invalid) - valid option set matches SqlScriptDOM PredicateSetOptionsHelper (25 options)
Verification: oracle test set_predicate/* → 0 mismatches
-
ALTER DATABASE db SET RECOVERY SIMPLEaccepted (valid) -
ALTER DATABASE db SET READ_ONLYaccepted (valid) -
ALTER DATABASE db SET ANSI_NULLS ONaccepted (valid) -
ALTER DATABASE db SET SELECT ONrejected (invalid) -
ALTER DATABASE db SET FROM OFFrejected (invalid) - valid option set matches SqlScriptDOM DatabaseOptionKindHelper
Verification: oracle test db_set/* → 0 mismatches
-
WITH (FILLFACTOR = 80)accepted (valid) -
WITH (PAD_INDEX = ON)accepted (valid — PARSEONLY may reject due to missing table, but parse should succeed) -
WITH (SELECT = 1)rejected (invalid) -
WITH (FROM = 1)rejected (invalid) - valid option set matches SqlScriptDOM IndexOptionHelper + IndexStateOption
Verification: oracle test index/* → 0 mismatches
-
WITH (MEMORY_OPTIMIZED = ON)accepted (valid — PARSEONLY may reject due to engine, but parse should succeed) -
WITH (SELECT = ON)rejected (invalid) -
WITH (FROM = ON)rejected (invalid) - valid option set matches SqlScriptDOM TableOptionHelper
Verification: oracle test create_table/* → 0 mismatches
-
WITH RECOMPILEaccepted (valid) -
WITH ENCRYPTIONaccepted (valid) -
WITH SELECTrejected (invalid) - valid option set matches SqlScriptDOM ProcedureOptionHelper
Verification: oracle test proc/* → 0 mismatches
-
WITH SCHEMABINDINGaccepted (valid) -
WITH ENCRYPTIONaccepted (valid) -
WITH SELECTrejected (invalid) - valid option set matches SqlScriptDOM ViewOptionHelper
Verification: oracle test view/* → 0 mismatches
-
OPTION (RECOMPILE)accepted (valid) -
OPTION (MAXDOP 1)accepted (valid) -
OPTION (SELECT)rejected (invalid) -
OPTION (FROM)rejected (invalid) - valid hint set matches SqlScriptDOM optimizer hint helpers
Verification: oracle test query_hint/* → 0 mismatches
-
FOR XML RAW, ELEMENTSaccepted (valid) -
FOR XML RAW, ROOT('r')accepted (valid) -
FOR XML RAW, SELECTrejected (invalid) -
FOR JSON PATH, ROOT('r')accepted (valid) -
FOR JSON PATH, WITHOUT_ARRAY_WRAPPERaccepted (valid) -
FOR JSON PATH, SELECTrejected (invalid) - valid option sets match SqlScriptDOM XmlForClauseOptionsHelper / JsonForClauseOptionsHelper
Verification: oracle test for_xml/* + for_json/* → 0 mismatches
-
CURSOR FAST_FORWARD FORaccepted (valid) -
CURSOR SCROLL FORaccepted (valid) -
CURSOR STATIC FORaccepted (valid) -
CURSOR SELECT FORrejected (invalid) - valid option set matches SqlScriptDOM CursorOptionsHelper (13 options)
Verification: oracle test cursor/* → 0 mismatches
-
WITH COMPRESSIONaccepted (valid) -
WITH INITaccepted (valid) -
WITH SELECTrejected (invalid) -
WITH FROMrejected (invalid) - valid option set matches SqlScriptDOM BackupOptionsNoValueHelper + BackupOptionsWithValueHelper
Verification: oracle test backup/* → 0 mismatches
-
WITH NORECOVERYaccepted (valid) -
WITH REPLACEaccepted (valid) -
WITH SELECTrejected (invalid) -
WITH FROMrejected (invalid) - valid option set matches SqlScriptDOM RestoreOptionNoValueHelper + RestoreOptionWithValueHelper
Verification: oracle test restore/* → 0 mismatches
-
WITH (FIELDTERMINATOR = ',')accepted (valid) -
WITH (ROWTERMINATOR = '\n')accepted (valid) -
WITH (SELECT = 1)rejected (invalid) -
WITH (FROM = 1)rejected (invalid) - valid option set matches SqlScriptDOM BulkInsertFlagOptionsHelper + IntOptionHelper + StringOptionHelper
Verification: oracle test bulk_insert/* → 0 mismatches
-
WITH (CHANGE_TRACKING = AUTO)accepted (valid) -
WITH (SELECT = ON)rejected (invalid) - valid option set matches SqlScriptDOM fulltext-related helpers
Verification: oracle test fulltext/* → 0 mismatches
-
CREATE MESSAGE TYPE msg VALIDATION = NONEaccepted (valid) -
CREATE SERVICE svc ON QUEUE dbo.q (SELECT)rejected (invalid — SELECT is not a contract name pattern) - valid patterns match SqlScriptDOM service broker grammar
Verification: oracle test broker/* → 0 mismatches
-
WITH (AUTOMATED_BACKUP_PREFERENCE = SECONDARY)accepted (valid) -
WITH (SELECT = ON)rejected (invalid) - valid option set matches SqlScriptDOM AvailabilityReplicaOptionsHelper
Verification: oracle test ag/* → 0 mismatches
-
STATE = STARTED AS TCP (LISTENER_PORT = 5022)accepted (valid) -
SELECT = STARTED AS TCPrejected (invalid — SELECT is not an endpoint option) - valid option set matches SqlScriptDOM EndpointProtocolOptionsHelper
Verification: oracle test endpoint/* → 0 mismatches
Each section: its oracle test subcases show 0 mismatches.
After all sections: TestKeywordOracleOptionPositions → 0 mismatches total. go test ./mssql/... -count=1 -short all green.