prestodb/presto · error · PrestoException

GENERIC_USER_ERROR

GENERIC_USER_ERROR

Error message

Deleting default schema not allowed.

What it means

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.

Source

Thrown at presto-kudu/src/main/java/com/facebook/presto/kudu/schema/SchemaEmulationByTableNameConvention.java:98

    }

    @Override
    public boolean existsSchema(KuduClient client, String schemaName)
    {
        if (DEFAULT_SCHEMA.equals(schemaName)) {
            return true;
        }
        else {
            List<String> schemas = listSchemaNames(client);
            return schemas.contains(schemaName);
        }
    }

    @Override
    public void dropSchema(KuduClient client, String schemaName)
    {
        if (DEFAULT_SCHEMA.equals(schemaName)) {
            throw new PrestoException(GENERIC_USER_ERROR, "Deleting default schema not allowed.");
        }
        else {
            try {
                String prefix = getPrefixForTablesOfSchema(schemaName);
                for (String name : client.getTablesList(prefix).getTablesList()) {
                    client.deleteTable(name);
                }

                KuduTable schemasTable = getSchemasTable(client);
                KuduSession session = client.newSession();
                try {
                    Delete delete = schemasTable.newDelete();
                    delete.getRow().addString(0, schemaName);
                    session.apply(delete);
                }
                finally {
                    session.close();
                }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Exclude 'default' from any schema-drop loop; it cannot and should not be deleted
  2. If the goal is wiping data, drop the individual tables within the default schema instead
  3. Filter INFORMATION_SCHEMA/schema listing results to skip 'default' before dropping

Example fix

// before
for (String schema : schemas) {
    connector.dropSchema(client, schema);
}
// after
for (String schema : schemas) {
    if (!"default".equals(schema)) {
        connector.dropSchema(client, schema);
    }
}
Defensive patterns

Strategy: validation

Validate before calling

if ("default".equals(schemaName)) {
    throw new IllegalArgumentException("The default schema cannot be dropped");
}

Try / catch

try {
    metadata.dropSchema(...);
} catch (PrestoException e) {
    if (e.getErrorCode().getCode() == StandardErrorCode.GENERIC_USER_ERROR.getCode()) {
        // handle protected-schema attempt; skip or abort cleanup
    }
}

Prevention

When it happens

Trigger: Calling dropSchema('default') — e.g. DROP SCHEMA default — on a Kudu catalog with table-name-convention schema emulation.

Common situations: 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.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/a1165b1dca33b762. Report an issue: GitHub.