{"record":{"id":"60f67fdcbb1f671d","repo":"apache/beam","slug":"expected-show-current-catalog-or-show-current-database","errorCode":null,"errorMessage":"Expected SHOW CURRENT CATALOG or SHOW CURRENT DATABASE","messagePattern":"Expected SHOW CURRENT CATALOG or SHOW CURRENT DATABASE","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/codegen/includes/parserImpls.ftl","lineNumber":495,"sourceCode":"}\n{\n    <SHOW> <CURRENT> { s.add(this); }\n    {\n        List<String> path = new ArrayList<String>();\n        path.add(\"beamsystem\");\n    }\n    (\n        <CATALOG> {\n            path.add(\"__current_catalog__\");\n        }\n    |\n        <DATABASE> {\n            path.add(\"__current_database__\");\n        }\n    )\n    {\n        if (path.size() != 2) {\n            throw new ParseException(\n                \"Expected SHOW CURRENT CATALOG or SHOW CURRENT DATABASE\");\n        }\n        SqlNodeList selectList = SqlNodeList.of(SqlIdentifier.star(s.end(this)));\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            null,\n            null,\n            null,\n            null,\n            null,\n            null,\n            null,\n            null);","sourceCodeStart":477,"sourceCodeEnd":513,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/codegen/includes/parserImpls.ftl#L477-L513","documentation":"A parse-time error from Beam SQL's Calcite-based parser: the SHOW statement's parsed path did not have exactly two components, which would mean neither SHOW CURRENT CATALOG nor SHOW CURRENT DATABASE was written. The grammar only supports these two forms of SHOW; any other SHOW target reaches this ParseException.","triggerScenarios":"Executing a SQL statement like SHOW TABLES, SHOW SCHEMAS, or a malformed SHOW (e.g. SHOW CURRENT with a missing target, or extra qualifiers) through BeamSql / sql.parse via zetaql/Calcite front-end.","commonSituations":"Porting SQL from MySQL/Postgres where SHOW TABLES / SHOW COLUMNS is valid but unsupported by Beam SQL; typo'd SHOW statement; using an IDE-generated statement against Beam SQL.","solutions":["Rewrite the statement as exactly SHOW CURRENT CATALOG or SHOW CURRENT DATABASE.","Remove unsupported SHOW variants (SHOW TABLES etc.) — use information-schema-style queries or Beam APIs instead.","Check the statement for typos or extra tokens after CURRENT."],"exampleFix":"// before\nSHOW TABLES;\n// after\nSHOW CURRENT DATABASE;","handlingStrategy":"validation","validationCode":"// pre-validate SHOW statements before handing to Beam SQL\nstatic boolean isSupportedShow(String sql) {\n  String s = sql.trim().toUpperCase();\n  return !s.startsWith(\"SHOW\")\n      || s.equals(\"SHOW CURRENT CATALOG\")\n      || s.equals(\"SHOW CURRENT DATABASE\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  result = pipeline.apply(SqlTransform.query(sql));\n} catch (ParseException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Expected SHOW CURRENT\")) {\n    throw new IllegalArgumentException(\"Beam SQL only supports SHOW CURRENT CATALOG|DATABASE.\", e);\n  }\n  throw e;\n}","preventionTips":["Do not port SHOW statements from MySQL/Postgres into Beam SQL.","Restrict user-supplied SQL to a supported statement whitelist.","Test ad-hoc SQL against Beam SQL's grammar before running pipelines."],"tags":["java","sql","parser","beam-sql"],"backgroundTag":"sql-query-failed","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"}