prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

More than one keyspace has been found for the schema name: %s -> (%s, %s)

What it means

With case-insensitive name matching (caseSensitiveNameMatchingEnabled=false), the connector scans all keyspaces for names matching the requested schema; if two distinct keyspaces match (e.g. 'Foo' and 'foo'), it refuses to guess and throws NOT_SUPPORTED listing both.

Source

Thrown at presto-cassandra/src/main/java/com/facebook/presto/cassandra/NativeCassandraSession.java:376

    }

    private KeyspaceMetadata getKeyspaceByCaseSensitiveName0(String caseSensitiveSchemaName)
            throws SchemaNotFoundException
    {
        Map<CqlIdentifier, KeyspaceMetadata> keyspaces =
                executeWithSession(session -> session.getMetadata().getKeyspaces());
        KeyspaceMetadata result = null;
        // Ensure that the error message is deterministic
        List<KeyspaceMetadata> sortedKeyspaces = Ordering.from(comparing((KeyspaceMetadata ks) -> ks.getName().asInternal()))
                .immutableSortedCopy(keyspaces.values());
        for (KeyspaceMetadata keyspace : sortedKeyspaces) {
            if (namesMatch(keyspace.getName().asInternal(), caseSensitiveSchemaName, caseSensitiveNameMatchingEnabled)) {
                if (caseSensitiveNameMatchingEnabled) {
                    result = keyspace;
                    break;
                }
                if (result != null) {
                    throw new PrestoException(
                            NOT_SUPPORTED,
                            format("More than one keyspace has been found for the schema name: %s -> (%s, %s)",
                                    caseSensitiveSchemaName.toLowerCase(ROOT), result.getName().asInternal(), keyspace.getName().asInternal()));
                }
                result = keyspace;
            }
        }

        if (result == null) {
            throw new SchemaNotFoundException(caseSensitiveSchemaName);
        }
        return result;
    }

    private static boolean namesMatch(String actualName, String expectedName, boolean caseSensitive)
    {
        return caseSensitive
                ? actualName.equals(expectedName)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Rename or drop one of the duplicate keyspaces so the lowercase names are unique
  2. Set cassandra.case-sensitive-name-matching=true and reference the schema with its exact case
  3. Fully qualify queries using the exact keyspace name and enable case-sensitive matching in the catalog
  4. Prevent future collisions by enforcing lowercase keyspace naming conventions

Example fix

// before: etc/catalog/cassandra.properties
cassandra.case-sensitive-name-matching=false

// after
cassandra.case-sensitive-name-matching=true
// then query: SELECT * FROM "MyKeyspace".t
Defensive patterns

Strategy: validation

Validate before calling

String wanted = schemaName.toLowerCase(Locale.ROOT);
long matches = keyspaces.stream()
    .map(k -> k.getName().asInternal().toLowerCase(Locale.ROOT))
    .filter(wanted::equals)
    .distinct()
    .count();
if (matches > 1) {
    throw new IllegalStateException("Ambiguous schema name across keyspaces: " + schemaName);
}

Try / catch

try {
    return metadata.getSchemaNames() /* or table lookup */;
} catch (PrestoException e) {
    if (NOT_SUPPORTED.toErrorCode().getCode() == e.getErrorCode().getCode()
            && e.getMessage().startsWith("More than one keyspace")) {
        throw new IllegalArgumentException("Enable case-sensitive name matching or dedupe keyspaces", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Referencing a schema name that, lowercased, collides with two or more existing Cassandra keyspaces while case-sensitive name matching is disabled.

Common situations: Migrated clusters that contain both 'MyKeyspace' and 'mykeyspace'; tools creating keyspaces with differing cases; shared clusters used by apps that ignore case conventions.

Understand the failure class

Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.

Related errors


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