{"record":{"id":"ae15be218f1b72c1","repo":"googleapis/mcp-toolbox","slug":"querying-information-schema-views-without-a-datase","errorCode":null,"errorMessage":"querying INFORMATION_SCHEMA views without a dataset prefix is not allowed when dataset restrictions are in place","messagePattern":"querying INFORMATION_SCHEMA views without a dataset prefix 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":252,"sourceCode":"\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\")\n\t\t\t\t\t\t}\n\t\t\t\t\tcase \"procedure\", \"function\":\n\t\t\t\t\t\tif lastToken == \"create\" || lastToken == \"create or replace\" {","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/bigquery/bigquerycommon/table_name_parser.go#L234-L270","documentation":"The SQL scanner found INFORMATION_SCHEMA as the first identifier in the query (no dataset prefix) while dataset restrictions are active — unprefixed metadata views span the whole project and cannot be scoped to allowed datasets.","triggerScenarios":"Thrown at internal/tools/bigquery/bigquerycommon/table_name_parser.go:252 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Qualify the view with a dataset prefix (dataset.INFORMATION_SCHEMA.TABLES)","Remove the INFORMATION_SCHEMA query 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"}