{"record":{"id":"1851bd7402db9640","repo":"prestodb/presto","slug":"missing-table-1851bd","errorCode":"MISSING_TABLE","errorMessage":"Table name is empty","messagePattern":"Table name is empty","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/MetadataExtractor.java","lineNumber":81,"sourceCode":"        this.warningCollector = requireNonNull(warningCollector, \"warningCollector is null\");\n    }\n\n    public void populateMetadataHandle(Session session, Statement statement, MetadataHandle metadataHandle)\n    {\n        if (executor.isPresent() && isPreProcessMetadataCalls(session)) {\n            metadataHandle.setPreProcessMetadataCalls(true);\n            populateMetadataHandle(session, statement, metadataHandle, new MetadataExtractorContext());\n        }\n    }\n\n    private void populateMetadataHandle(Session session, Statement statement, MetadataHandle metadataHandle, MetadataExtractorContext metadataExtractorContext)\n    {\n        Visitor visitor = new Visitor(session);\n        visitor.process(statement, metadataExtractorContext);\n\n        metadataExtractorContext.getTableNames().forEach(tableName -> {\n            if (tableName.getObjectName().isEmpty()) {\n                throw new SemanticException(MISSING_TABLE, \"Table name is empty\");\n            }\n            if (tableName.getSchemaName().isEmpty()) {\n                throw new SemanticException(MISSING_SCHEMA, \"Schema name is empty\");\n            }\n\n            metadataHandle.addViewDefinition(tableName, executor.get().submit(() -> {\n                Optional<ViewDefinition> optionalView = session.getRuntimeStats().recordWallTime(\n                        GET_VIEW_TIME_NANOS,\n                        () -> metadataResolver.getView(tableName));\n                if (optionalView.isPresent()) {\n                    ViewDefinition view = optionalView.get();\n                    Statement viewStatement = sqlParser.createStatement(view.getOriginalSql(), createParsingOptions(session, warningCollector));\n                    Session.SessionBuilder viewSessionBuilder = Session.builder(metadata.getSessionPropertyManager())\n                            .setQueryId(session.getQueryId())\n                            .setRuntimeStats(session.getRuntimeStats())\n                            .setTransactionId(session.getTransactionId().orElse(null))\n                            .setIdentity(session.getIdentity())\n                            .setSource(session.getSource().orElse(null))","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/MetadataExtractor.java#L63-L99","documentation":"MetadataExtractor.populateMetadataHandle collects every table/view name referenced by the analyzed statement and validates them before fetching view definitions. If a collected QualifiedObjectName has an empty object (table) name part, it throws MISSING_TABLE, because metadata cannot be resolved for a nameless table reference.","triggerScenarios":"Statement analysis collects a QualifiedObjectName whose objectName is empty — typically from a malformed or partially parsed table identifier supplied to the metadata extraction path (e.g. empty target of an INSERT or reference built with only catalog/schema).","commonSituations":"Programmatic statement construction with an empty table identifier; SQL whose table name was lost by an upstream templating/interpolation step (e.g. `SELECT * FROM .schema.` style artifacts).","solutions":["Check the submitted SQL for an empty or missing table identifier and fix the statement text.","If the statement is generated, log/inspect the rendered SQL before execution and guard against empty table-name variables.","Ensure table names are fully qualified with a non-empty catalog, schema, and object name."],"exampleFix":"// before (generated SQL with empty variable)\nString sql = \"SELECT * FROM \" + schema + \".\" + table; // table == \"\"\n// after\nif (table == null || table.isEmpty()) { throw new IllegalArgumentException(\"table name required\"); }\nString sql = \"SELECT * FROM \\\"\" + schema + \"\\\".\\\"\" + table + \"\\\"\";","handlingStrategy":"validation","validationCode":"// validate identifiers before submitting statements\nfunction assertValidTableName(name) {\n  if (!name || name.split(\".\").filter(Boolean).length === 0) throw new Error(\"Table name is empty\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Interpolate table identifiers only after null/empty checks.","Always use fully-qualified catalog.schema.table names in generated SQL.","Log the final rendered SQL in staging to catch empty substitutions."],"tags":["metadata-extractor","missing-table","empty-name","sql-parsing"],"backgroundTag":"empty-table-name","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}