{"record":{"id":"6ed3fe68b9326fee","repo":"googleapis/mcp-toolbox","slug":"querying-non-dataset-level-information-schema-view","errorCode":null,"errorMessage":"querying non-dataset-level INFORMATION_SCHEMA view %q is not allowed when dataset restrictions are in place","messagePattern":"querying non-dataset-level INFORMATION_SCHEMA view %q is not allowed when dataset restrictions are in place","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/bigquery/bigquerycommon/table_name_parser.go","lineNumber":249,"sourceCode":"\n\t\t\t\tfor _, part := range parts {\n\t\t\t\t\tif strings.EqualFold(part, \"EXTERNAL_QUERY\") {\n\t\t\t\t\t\treturn 0, fmt.Errorf(\"EXTERNAL_QUERY is not allowed when dataset restrictions are in place\")\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Check for INFORMATION_SCHEMA\n\t\t\t\tinfoSchemaIdx := -1\n\t\t\t\tfor idx, part := range parts {\n\t\t\t\t\tif strings.EqualFold(part, \"INFORMATION_SCHEMA\") {\n\t\t\t\t\t\tinfoSchemaIdx = idx\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif infoSchemaIdx != -1 {\n\t\t\t\t\tviewName := parts[len(parts)-1]\n\t\t\t\t\tif !datasetLevelInformationSchemaViews[strings.ToLower(viewName)] {\n\t\t\t\t\t\treturn 0, fmt.Errorf(\"querying non-dataset-level INFORMATION_SCHEMA view %q is not allowed when dataset restrictions are in place\", viewName)\n\t\t\t\t\t}\n\t\t\t\t\tif infoSchemaIdx == 0 {\n\t\t\t\t\t\treturn 0, fmt.Errorf(\"querying INFORMATION_SCHEMA views without a dataset prefix is not allowed when dataset restrictions are in place\")\n\t\t\t\t\t}\n\t\t\t\t\tif infoSchemaIdx > 2 {\n\t\t\t\t\t\treturn 0, fmt.Errorf(\"invalid INFORMATION_SCHEMA query path %q\", strings.Join(parts, \".\"))\n\t\t\t\t\t}\n\t\t\t\t\tparts = parts[:infoSchemaIdx+1]\n\t\t\t\t}\n\n\t\t\t\tif len(parts) == 1 {\n\t\t\t\t\tkeyword := strings.ToLower(parts[0])\n\t\t\t\t\tswitch keyword {\n\t\t\t\t\tcase \"call\":\n\t\t\t\t\t\treturn 0, fmt.Errorf(\"CALL is not allowed when dataset restrictions are in place, as the called procedure's contents cannot be safely analyzed\")\n\t\t\t\t\tcase \"immediate\":\n\t\t\t\t\t\tif lastToken == \"execute\" {\n\t\t\t\t\t\t\treturn 0, fmt.Errorf(\"EXECUTE IMMEDIATE is not allowed when dataset restrictions are in place, as its contents cannot be safely analyzed\")","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/bigquery/bigquerycommon/table_name_parser.go#L231-L267","documentation":"The SQL scanner found an INFORMATION_SCHEMA reference whose view name is not in the allow-list of dataset-level views while dataset restrictions are active — region/project-level metadata views could leak names of datasets outside the restriction.","triggerScenarios":"Thrown at internal/tools/bigquery/bigquerycommon/table_name_parser.go:249 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a dataset-level INFORMATION_SCHEMA view (e.g. DATASET.TABLES) within an allowed dataset","Remove INFORMATION_SCHEMA queries from restricted tools","Relax dataset restrictions if metadata access is intended"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}