{"record":{"id":"641cf251dba4836b","repo":"apache/beam","slug":"show-tables-from-in-accepts-at-most-a-catalog-name-and-a","errorCode":null,"errorMessage":"SHOW TABLES FROM/IN accepts at most a catalog name and a database name.","messagePattern":"SHOW TABLES FROM/IN accepts at most a catalog name and a database name\\.","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/codegen/includes/parserImpls.ftl","lineNumber":742,"sourceCode":"        path.add(\"beamsystem\");\n        path.add(\"tables\");\n        SqlNodeList selectList = SqlNodeList.of(SqlIdentifier.star(s.end(this)));\n        SqlNode where = null;\n        if (regex != null) {\n            SqlIdentifier nameIdentifier = new SqlIdentifier(\"NAME\", s.end(this));\n            where = SqlStdOperatorTable.LIKE.createCall(\n                s.end(this),\n                nameIdentifier, regex);\n        }\n        if (databaseCatalog != null) {\n            List<String> components = databaseCatalog.names;\n            if (components.size() == 1) {\n                path.add(\"__current_catalog__\");\n                path.add(components.get(0));\n            } else if (components.size() == 2) {\n                path.addAll(components);\n            } else {\n                throw new ParseException(\n                    \"SHOW TABLES FROM/IN accepts at most a catalog name and a database name.\");\n            }\n        } else {\n            path.add(\"__current_catalog__\");\n            path.add(\"__current_database__\");\n        }\n        SqlIdentifier from = new SqlIdentifier(path, s.end(this));\n\n        return new SqlSelect(\n            s.end(this),\n            null,\n            selectList,\n            from,\n            where,\n            null,\n            null,\n            null,\n            null,","sourceCodeStart":724,"sourceCodeEnd":760,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/codegen/includes/parserImpls.ftl#L724-L760","documentation":"Apache Beam's SQL (Calcite-based) parser rejects SHOW TABLES statements whose FROM/IN clause references more than two name components. Only a catalog name plus a database name (or a single database name) is accepted; any deeper qualification has no meaning in the catalog model.","triggerScenarios":"Executing a SQL query like `SHOW TABLES FROM catalog.db.extra` or `SHOW TABLES IN a.b.c` — i.e., a dotted identifier path with 3+ components passed to the SHOW TABLES parser rule.","commonSituations":"Copying SHOW TABLES syntax from MySQL/Spark (which allow fully qualified names) into Beam SQL; building the identifier programmatically from user-supplied connection strings with too many dot-separated parts.","solutions":["Reduce the FROM/IN qualifier to at most `catalog.database` (2 components).","If you only need the current catalog, use a single database name: `SHOW TABLES FROM mydb`.","Omit the clause entirely to default to the current catalog and current database."],"exampleFix":"// before\nStatement st = conn.createStatement();\nst.execute(\"SHOW TABLES FROM project.dataset.region_tables\");\n// after\nst.execute(\"SHOW TABLES FROM dataset\"); // or 'FROM catalog.dataset' at most","handlingStrategy":"validation","validationCode":"const parts = qualifier.split('.');\nif (parts.length > 2) throw new Error('SHOW TABLES FROM/IN allows at most catalog.database');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate identifier paths have at most 2 dot-separated components before building SHOW TABLES statements.","Prefer omitting the FROM/IN clause when the default catalog/database suffices."],"tags":["sql","parser","invalid-argument"],"backgroundTag":"invalid-argument-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}