{"record":{"id":"65344eedde77a6b4","repo":"vitessio/vitess","slug":"unsupported-query-s","errorCode":null,"errorMessage":"unsupported query %s","messagePattern":"unsupported query (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtexplain/vtexplain_vttablet.go","lineNumber":603,"sourceCode":"\n\tswitch sqlparser.Preview(query) {\n\tcase sqlparser.StmtSelect:\n\t\tvar err error\n\t\tresult, err = t.handleSelect(query)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tcase sqlparser.StmtBegin, sqlparser.StmtCommit, sqlparser.StmtSet,\n\t\tsqlparser.StmtSavepoint, sqlparser.StmtSRollback, sqlparser.StmtRelease:\n\t\tresult = &sqltypes.Result{}\n\tcase sqlparser.StmtShow:\n\t\tresult = &sqltypes.Result{Fields: sqltypes.MakeTestFields(\"\", \"\")}\n\tcase sqlparser.StmtInsert, sqlparser.StmtReplace, sqlparser.StmtUpdate, sqlparser.StmtDelete:\n\t\tresult = &sqltypes.Result{\n\t\t\tRowsAffected: 1,\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported query %s\", query)\n\t}\n\n\treturn callback(result)\n}\n\nfunc (t *explainTablet) handleSelect(query string) (*sqltypes.Result, error) {\n\t// Parse the select statement to figure out the table and columns\n\t// that were referenced so that the synthetic response has the\n\t// expected field names and types.\n\tstmt, err := t.vte.env.Parser().Parse(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar selStmt *sqlparser.Select\n\tswitch stmt := stmt.(type) {\n\tcase *sqlparser.Select:\n\t\tselStmt = stmt","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtexplain/vtexplain_vttablet.go#L585-L621","documentation":"vtexplain's simulated tablet only handles a fixed set of statement kinds (select/insert/replace/update/delete and a few others) in HandleQuery. Any other statement type reaching the tablet hits the default branch and returns this error. It signals that vtexplain cannot produce a meaningful simulated result for that statement.","triggerScenarios":"Running vtexplain on a workload containing a statement whose sqlparser.StmtType is not among the supported cases (e.g. SET, SHOW, BEGIN/COMMIT, admin statements) — anything other than select/dml handled in HandleQuery's switch.","commonSituations":"Feeding a vtctl/vtexplain workload file that contains SET statements or transaction control; explaining mixed maintenance scripts; tools sending session statements through the explain pipeline.","solutions":["Remove unsupported statements (SET, SHOW, transaction control) from the workload being explained.","Explain only DML and SELECT statements; keep them in a dedicated workload file.","If new statement support is needed, extend the switch in vtexplain_vttablet.go HandleQuery."],"exampleFix":"-- before workload\nSET @@session.sql_mode='STRICT';\nSELECT * FROM user;\n-- after workload\nSELECT * FROM user;","handlingStrategy":"validation","validationCode":"stmtType := sqlparser.Preview(query)\nswitch stmtType {\ncase sqlparser.StmtSelect, sqlparser.StmtInsert, sqlparser.StmtReplace, sqlparser.StmtUpdate, sqlparser.StmtDelete:\n    // ok to explain\ndefault:\n    return fmt.Errorf(\"skipping unsupported %v in workload\", stmtType)\n}","typeGuard":null,"tryCatchPattern":"if err := vtexplain.Run(...); err != nil {\n    if strings.Contains(err.Error(), \"unsupported query\") {\n        // filter the statement out of the workload and retry\n    }\n}","preventionTips":["Keep explain workloads to pure DML/SELECT statements.","Strip SET/transaction statements when exporting workloads.","Add a pre-filter in tooling that parses and checks each statement."],"tags":["vtexplain","unsupported-statement"],"backgroundTag":"unsupported-statement-type","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}