{"record":{"id":"c3423cd4f26d6cfc","repo":"prestodb/presto","slug":"missing-table-c3423c","errorCode":"MISSING_TABLE","errorMessage":"Table '${tableName}' does not exist","messagePattern":"Table '(.+?)' does not exist","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java","lineNumber":277,"sourceCode":"                    selectList(aliasedName(\"table_name\", \"Table\")),\n                    from(schema.getCatalogName(), TABLE_TABLES),\n                    predicate,\n                    ordering(ascending(\"table_name\")));\n        }\n\n        @Override\n        protected Node visitShowGrants(ShowGrants showGrants, Void context)\n        {\n            String catalogName = session.getCatalog().orElse(null);\n            Optional<Expression> predicate = Optional.empty();\n\n            Optional<QualifiedName> tableName = showGrants.getTableName();\n            if (tableName.isPresent()) {\n                QualifiedObjectName qualifiedTableName = createQualifiedObjectName(session, showGrants, tableName.get(), metadata);\n\n                if (!metadataResolver.getView(qualifiedTableName).isPresent() &&\n                        !metadataResolver.getTableHandle(qualifiedTableName).isPresent()) {\n                    throw new SemanticException(MISSING_TABLE, showGrants, \"Table '%s' does not exist\", tableName);\n                }\n\n                catalogName = qualifiedTableName.getCatalogName();\n\n                accessControl.checkCanShowTablesMetadata(\n                        session.getRequiredTransactionId(),\n                        session.getIdentity(),\n                        session.getAccessControlContext(),\n                        new CatalogSchemaName(catalogName, qualifiedTableName.getSchemaName()));\n\n                predicate = Optional.of(combineConjuncts(\n                        equal(identifier(\"table_schema\"), new StringLiteral(qualifiedTableName.getSchemaName())),\n                        equal(identifier(\"table_name\"), new StringLiteral(qualifiedTableName.getObjectName()))));\n            }\n            else {\n                if (catalogName == null) {\n                    throw new SemanticException(CATALOG_NOT_SPECIFIED, showGrants, \"Catalog must be specified when session catalog is not set\");\n                }","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java#L259-L295","documentation":"In visitShowGrants, when a table name is supplied to SHOW GRANTS, it is resolved to a QualifiedObjectName and must exist: the code accepts it only if it is a view or a table (getView or getTableHandle present). Otherwise a SemanticException MISSING_TABLE is thrown.","triggerScenarios":"Running `SHOW GRANTS ON <catalog>.<schema>.<table>` where the named object is neither an existing table nor an existing view in the metadata resolver.","commonSituations":"Typo in the table name; querying grants on a table in the wrong catalog; the table was dropped/renamed; permissions let the statement parse but the object is invisible in that catalog.","solutions":["Verify the fully qualified table name and correct typos.","Confirm the table/view exists: `SHOW TABLES FROM <catalog>.<schema>` or SELECT from information_schema.tables.","Run SHOW GRANTS without the ON clause to list grants you can see and find the correct object name.","Check you are connected to the intended catalog/environment."],"exampleFix":"// before\nSHOW GRANTS ON hive.default.ording  -- typo\n// after\nSHOW GRANTS ON hive.default.ordering","handlingStrategy":"validation","validationCode":"// Confirm the table or view exists before SHOW GRANTS ON\nboolean exists = !client.execute(\n    \"SELECT 1 FROM \" + catalog + \".information_schema.tables \" +\n    \"WHERE table_schema = '\" + schema + \"' AND table_name = '\" + table + \"'\").getRows().isEmpty();\nif (!exists) throw new IllegalArgumentException(\"Table not found: \" + qualifiedName);","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(\"SHOW GRANTS ON \" + fqn);\n} catch (SemanticException e) {\n    if (e.getCode() == SemanticErrorCode.MISSING_TABLE) {\n        // verify object name or list visible grants\n    } else throw e;\n}","preventionTips":["Resolve table names from information_schema before granting-related queries","Use fully qualified three-part names (catalog.schema.table)","Check you are pointed at the intended environment/catalog","Handle dropped/renamed tables by refreshing metadata caches in tooling"],"tags":["sql","show-grants","table","semantic-error"],"backgroundTag":"table-does-not-exist","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"}