prestodb/presto · error · PrestoException

SYNTAX_ERROR

SYNTAX_ERROR

Error message

Too many dots in table name: %s

What it means

MetadataUtils.createQualifiedObjectName validates the parts of a table name. A fully qualified name may have at most three parts (catalog.schema.table); anything with more parts is a syntax-level error, thrown as a PrestoException with SYNTAX_ERROR.

Source

Thrown at presto-analyzer/src/main/java/com/facebook/presto/sql/analyzer/utils/MetadataUtils.java:47

import static com.facebook.presto.sql.analyzer.SemanticErrorCode.CATALOG_NOT_SPECIFIED;
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.SCHEMA_NOT_SPECIFIED;
import static java.lang.String.format;
import static java.util.Locale.ENGLISH;
import static java.util.Objects.requireNonNull;

public class MetadataUtils
{
    private MetadataUtils()
    {}

    public static QualifiedObjectName createQualifiedObjectName(Optional<String> sessionCatalogName, Optional<String> sessionSchemaName, Node node, QualifiedName name,
                                                                BiFunction<String, String, String> normalizer)
    {
        requireNonNull(sessionCatalogName, "sessionCatalogName is null");
        requireNonNull(sessionSchemaName, "sessionSchemaName is null");
        requireNonNull(name, "name is null");
        if (name.getParts().size() > 3) {
            throw new PrestoException(SYNTAX_ERROR, format("Too many dots in table name: %s", name));
        }

        List<Identifier> parts = Lists.reverse(name.getOriginalParts());
        String objectName = parts.get(0).getValue();
        String schemaName = (parts.size() > 1) ? parts.get(1).getValue() : sessionSchemaName.orElseThrow(() ->
                new SemanticException(SCHEMA_NOT_SPECIFIED, node, "Schema must be specified when session schema is not set"));
        String catalogName = (parts.size() > 2) ? parts.get(2).getValue() : sessionCatalogName.orElseThrow(() ->
                new SemanticException(CATALOG_NOT_SPECIFIED, node, "Catalog must be specified when session catalog is not set"));

        catalogName = catalogName.toLowerCase(ENGLISH);
        schemaName = normalizer.apply(catalogName, schemaName);
        objectName = normalizer.apply(catalogName, objectName);
        return new QualifiedObjectName(catalogName, schemaName, objectName);
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Remove the extra qualifier so the name has at most catalog.schema.table parts
  2. Quote identifiers containing dots so they parse as one part: "my.table"
  3. If a nested namespace exists, configure the catalog/connector mapping instead of encoding it in the name

Example fix

-- before
SELECT * FROM hive.default.my schema.t
-- after
SELECT * FROM hive.default."my schema.t"
Defensive patterns

Strategy: validation

Validate before calling

// Validate identifier parts count client-side
boolean isValidTableName(QualifiedName n) { return n.getParts().size() <= 3; }

Type guard

boolean isThreePartName(String name) { return name.split("\\.").length <= 3; }

Try / catch

try { QualifiedObjectName o = MetadataUtils.createQualifiedObjectName(session, node, name); } catch (PrestoException e) { if ("SYNTAX_ERROR".equals(e.getErrorCode().getName())) { /* fix name or quote dotted parts */ } throw e; }

Prevention

When it happens

Trigger: A table name with four or more dot-separated parts, e.g. SELECT * FROM a.b.c.d or quoted identifiers introducing extra dots.

Common situations: Pasting fully-qualified names from other systems (e.g. JDBC or three-part names plus database prefix); accidental extra dot; quoting a name that contains a dot as a single identifier incorrectly.

Related errors


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