{"record":{"id":"b00306934a49d857","repo":"bytebase/bytebase","slug":"no-object-name-is-specified-b00306","errorCode":null,"errorMessage":"no object name is specified","messagePattern":"no object name is specified","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/plugin/parser/tsql/query_span_extractor.go","lineNumber":310,"sourceCode":"\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.\n\t// For example, there are two tables T1 and T2, and both of them have a column named \"C1\". The following query will throw\n\t// a compilation error:\n\t//   SELECT C1 FROM T1, T2;\n\t// Users can specify the table name to disambiguate:\n\t//   SELECT T1.C1 FROM T1, T2;\n\t// If an alias is set the original table name is shadowed:\n\t//   SELECT T1.C1 FROM T1 AS T3, T2;  -- invalid\n\tfor _, tableSource := range q.tableSourcesFrom {\n\t\tif mask&maskDatabaseName != 0 && !q.isIdentifierEqual(normalizedDatabaseName, tableSource.GetDatabaseName()) {\n\t\t\tcontinue\n\t\t}\n\t\tif mask&maskSchemaName != 0 && !q.isIdentifierEqual(normalizedSchemaName, tableSource.GetSchemaName()) {","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/bytebase/bytebase/blob/1870550677fe08f0d2a78c07acd27541464eb945/backend/plugin/parser/tsql/query_span_extractor.go#L292-L328","documentation":"Thrown by tsqlIsFieldSensitive when all four normalized name components (database, schema, table, column) are empty, so the resulting mask is maskNone. There is nothing to resolve: the function requires at least one qualifier level (in practice a column name) to identify a field for sensitivity analysis.","triggerScenarios":"resolveExpressionNode or collectPredicatesInScope invoking tsqlIsFieldSensitive with an entirely empty name tuple — e.g. an expression node with no identifier part, an empty column reference, or default-initialized name fields.","commonSituations":"Parser producing an empty identifier for expressions like `SELECT [] FROM t` or unhandled node kinds passed to the resolver; programmatic callers forgetting to set any name fields.","solutions":["Check the expression node before calling: only invoke tsqlIsFieldSensitive for actual column references with a non-empty column name.","Fix the upstream parsing/normalization so identifiers are populated; log the node kind that produced an empty tuple.","Return an empty/unknown sensitivity result for non-identifier expressions instead of calling the resolver."],"exampleFix":"// before: resolve regardless\nresult, err := q.tsqslIsFieldSensitive(db, schema, table, column)\n// after: guard empty input\nif column == \"\" {\n    return base.QuerySpanResult{}, nil // not a column reference\n}\nresult, err := q.tsqslIsFieldSensitive(db, schema, table, column)","handlingStrategy":"type-guard","validationCode":"if db == \"\" && schema == \"\" && table == \"\" && column == \"\" {\n    return errors.New(\"empty object name for field resolution\")\n}","typeGuard":"func hasAnyNamePart(db, schema, table, column string) bool {\n    return db != \"\" || schema != \"\" || table != \"\" || column != \"\"\n}","tryCatchPattern":"res, err := q.tsqslIsFieldSensitive(db, schema, table, column)\nif err != nil && strings.Contains(err.Error(), \"no object name is specified\") {\n    return base.QuerySpanResult{}, nil // not an identifier expression\n}","preventionTips":["Skip sensitivity resolution for non-identifier expression nodes.","Log the node kind whenever a resolver receives an empty name tuple.","Add an early return in resolveExpressionNode for empty identifiers."],"tags":["tsql","query-span","empty-identifier","field-sensitivity"],"backgroundTag":"empty-required-field","analyzedSha":"1870550677fe08f0d2a78c07acd27541464eb945","analyzedAt":"2026-09-06T21:16:13.665Z","contentChangedAt":"2026-09-06T21:16:13.665Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}