{"record":{"id":"a1165b1dca33b762","repo":"prestodb/presto","slug":"generic-user-error-a1165b","errorCode":"GENERIC_USER_ERROR","errorMessage":"Deleting default schema not allowed.","messagePattern":"Deleting default schema not allowed\\.","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-kudu/src/main/java/com/facebook/presto/kudu/schema/SchemaEmulationByTableNameConvention.java","lineNumber":98,"sourceCode":"    }\n\n    @Override\n    public boolean existsSchema(KuduClient client, String schemaName)\n    {\n        if (DEFAULT_SCHEMA.equals(schemaName)) {\n            return true;\n        }\n        else {\n            List<String> schemas = listSchemaNames(client);\n            return schemas.contains(schemaName);\n        }\n    }\n\n    @Override\n    public void dropSchema(KuduClient client, String schemaName)\n    {\n        if (DEFAULT_SCHEMA.equals(schemaName)) {\n            throw new PrestoException(GENERIC_USER_ERROR, \"Deleting default schema not allowed.\");\n        }\n        else {\n            try {\n                String prefix = getPrefixForTablesOfSchema(schemaName);\n                for (String name : client.getTablesList(prefix).getTablesList()) {\n                    client.deleteTable(name);\n                }\n\n                KuduTable schemasTable = getSchemasTable(client);\n                KuduSession session = client.newSession();\n                try {\n                    Delete delete = schemasTable.newDelete();\n                    delete.getRow().addString(0, schemaName);\n                    session.apply(delete);\n                }\n                finally {\n                    session.close();\n                }","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-kudu/src/main/java/com/facebook/presto/kudu/schema/SchemaEmulationByTableNameConvention.java#L80-L116","documentation":"User error thrown by SchemaEmulationByTableNameConvention.dropSchema when attempting to delete the 'default' schema. The default schema is implicit in table-name-convention emulation and is protected from deletion, since dropping it would have no backing object and would break all unqualified table references.","triggerScenarios":"Calling dropSchema('default') — e.g. DROP SCHEMA default — on a Kudu catalog with table-name-convention schema emulation.","commonSituations":"Cleanup scripts iterating over all schemas and dropping each one; users believing 'default' is a real schema that can be removed; generated migration scripts listing default among schemas.","solutions":["Exclude 'default' from any schema-drop loop; it cannot and should not be deleted","If the goal is wiping data, drop the individual tables within the default schema instead","Filter INFORMATION_SCHEMA/schema listing results to skip 'default' before dropping"],"exampleFix":"// before\nfor (String schema : schemas) {\n    connector.dropSchema(client, schema);\n}\n// after\nfor (String schema : schemas) {\n    if (!\"default\".equals(schema)) {\n        connector.dropSchema(client, schema);\n    }\n}","handlingStrategy":"validation","validationCode":"if (\"default\".equals(schemaName)) {\n    throw new IllegalArgumentException(\"The default schema cannot be dropped\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    metadata.dropSchema(...);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getCode() == StandardErrorCode.GENERIC_USER_ERROR.getCode()) {\n        // handle protected-schema attempt; skip or abort cleanup\n    }\n}","preventionTips":["Filter 'default' out of any bulk drop-schema routine","Treat the default schema as immutable in all tooling","Drop individual tables instead when data cleanup is the goal"],"tags":["presto","kudu","schema","user-error"],"backgroundTag":"protected-schema-deletion","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"}