{"record":{"id":"f47db1c4920723fd","repo":"bytebase/bytebase","slug":"schema-name-s-is-specified-without-table-name-f47db1","errorCode":null,"errorMessage":"schema name %s is specified without table name","messagePattern":"schema name (.+?) is specified without table name","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/plugin/parser/tsql/query_span_extractor.go","lineNumber":298,"sourceCode":"\t\tmaskNone         maskType = 0\n\t\tmaskDatabaseName maskType = 1 << iota\n\t\tmaskSchemaName\n\t\tmaskTableName\n\t\tmaskColumnName\n\t)\n\tmask := maskNone\n\tif normalizedColumnName != \"\" {\n\t\tmask |= maskColumnName\n\t}\n\tif normalizedTableName != \"\" {\n\t\tif mask&maskColumnName == 0 {\n\t\t\treturn base.QuerySpanResult{}, errors.Errorf(`table name %s is specified without column name`, normalizedTableName)\n\t\t}\n\t\tmask |= maskTableName\n\t}\n\tif normalizedSchemaName != \"\" {\n\t\tif mask&maskTableName == 0 {\n\t\t\treturn base.QuerySpanResult{}, errors.Errorf(`schema name %s is specified without table name`, normalizedSchemaName)\n\t\t}\n\t\tmask |= maskSchemaName\n\t}\n\tif normalizedDatabaseName != \"\" {\n\t\tif mask&maskSchemaName == 0 {\n\t\t\treturn base.QuerySpanResult{}, errors.Errorf(`database name %s is specified without schema name`, normalizedDatabaseName)\n\t\t}\n\t\tmask |= maskDatabaseName\n\t}\n\n\tif mask == maskNone {\n\t\treturn base.QuerySpanResult{}, errors.Errorf(`no object name is specified`)\n\t}\n\n\t// We just need to iterate through the fromFieldList sequentially until we find the first matching object.\n\t//\n\t// It is safe if there are two or more objects in the fromFieldList have the same column name, because the executor\n\t// will throw a compilation error if the column name is ambiguous.","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/bytebase/bytebase/blob/1870550677fe08f0d2a78c07acd27541464eb945/backend/plugin/parser/tsql/query_span_extractor.go#L280-L316","documentation":"Thrown by tsqlIsFieldSensitive when a schema name is supplied without a table name in the qualifier tuple. TSQL object names must fill hierarchy levels contiguously from the leaf (column, table, schema, database); skipping the table level while giving a schema is rejected via the mask check `mask&maskTableName == 0`.","triggerScenarios":"Calling tsqlIsFieldSensitive with normalizedSchemaName != \"\" but normalizedTableName == \"\" — e.g. a two-part reference whose inner part was misparsed so the table slot is empty.","commonSituations":"Parsing malformed or generated references like `schema..column` or `db.schema.` where the table component was lost, or callers assembling name parts into the wrong positional arguments.","solutions":["Supply the table name: use `database.schema.table.column` or at minimum `schema.table.column`.","Check the caller's argument order — table and schema are commonly swapped when building the tuple programmatically.","If the reference legitimately has no table (e.g. a schema-level check), do not route it through the column resolver."],"exampleFix":"// before: table slot empty\nresolveField(db=\"appdb\", schema=\"dbo\", table=\"\", column=\"amount\")\n// after\nresolveField(db=\"appdb\", schema=\"dbo\", table=\"orders\", column=\"amount\")","handlingStrategy":"validation","validationCode":"if schema != \"\" && table == \"\" {\n    return errors.New(\"schema given without table in field resolution\")\n}","typeGuard":"func contiguous(db, schema, table, column string) bool {\n    return !(schema != \"\" && table == \"\")\n}","tryCatchPattern":"res, err := q.tsqslIsFieldSensitive(db, schema, table, column)\nif err != nil && strings.Contains(err.Error(), \"without table name\") {\n    return base.QuerySpanResult{}, fmt.Errorf(\"malformed qualifier: %w\", err)\n}","preventionTips":["Fill the table slot before the schema slot when building name tuples.","Watch for swapped table/schema arguments in programmatic callers.","Normalize `schema..col` style references before resolution."],"tags":["tsql","query-span","identifier-resolution"],"backgroundTag":"invalid-identifier-format","analyzedSha":"1870550677fe08f0d2a78c07acd27541464eb945","analyzedAt":"2026-09-06T21:16:13.665Z","contentChangedAt":"2026-09-06T21:16:13.665Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}