{"record":{"id":"c9e80d82602e602d","repo":"prestodb/presto","slug":"syntax-error","errorCode":"SYNTAX_ERROR","errorMessage":"Too many dots in table name: %s","messagePattern":"Too many dots in table name: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-analyzer/src/main/java/com/facebook/presto/sql/analyzer/utils/MetadataUtils.java","lineNumber":47,"sourceCode":"import static com.facebook.presto.sql.analyzer.SemanticErrorCode.CATALOG_NOT_SPECIFIED;\nimport static com.facebook.presto.sql.analyzer.SemanticErrorCode.SCHEMA_NOT_SPECIFIED;\nimport static java.lang.String.format;\nimport static java.util.Locale.ENGLISH;\nimport static java.util.Objects.requireNonNull;\n\npublic class MetadataUtils\n{\n    private MetadataUtils()\n    {}\n\n    public static QualifiedObjectName createQualifiedObjectName(Optional<String> sessionCatalogName, Optional<String> sessionSchemaName, Node node, QualifiedName name,\n                                                                BiFunction<String, String, String> normalizer)\n    {\n        requireNonNull(sessionCatalogName, \"sessionCatalogName is null\");\n        requireNonNull(sessionSchemaName, \"sessionSchemaName is null\");\n        requireNonNull(name, \"name is null\");\n        if (name.getParts().size() > 3) {\n            throw new PrestoException(SYNTAX_ERROR, format(\"Too many dots in table name: %s\", name));\n        }\n\n        List<Identifier> parts = Lists.reverse(name.getOriginalParts());\n        String objectName = parts.get(0).getValue();\n        String schemaName = (parts.size() > 1) ? parts.get(1).getValue() : sessionSchemaName.orElseThrow(() ->\n                new SemanticException(SCHEMA_NOT_SPECIFIED, node, \"Schema must be specified when session schema is not set\"));\n        String catalogName = (parts.size() > 2) ? parts.get(2).getValue() : sessionCatalogName.orElseThrow(() ->\n                new SemanticException(CATALOG_NOT_SPECIFIED, node, \"Catalog must be specified when session catalog is not set\"));\n\n        catalogName = catalogName.toLowerCase(ENGLISH);\n        schemaName = normalizer.apply(catalogName, schemaName);\n        objectName = normalizer.apply(catalogName, objectName);\n        return new QualifiedObjectName(catalogName, schemaName, objectName);\n    }\n}\n","sourceCodeStart":29,"sourceCodeEnd":63,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-analyzer/src/main/java/com/facebook/presto/sql/analyzer/utils/MetadataUtils.java#L29-L63","documentation":"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.","triggerScenarios":"A table name with four or more dot-separated parts, e.g. SELECT * FROM a.b.c.d or quoted identifiers introducing extra dots.","commonSituations":"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.","solutions":["Remove the extra qualifier so the name has at most catalog.schema.table parts","Quote identifiers containing dots so they parse as one part: \"my.table\"","If a nested namespace exists, configure the catalog/connector mapping instead of encoding it in the name"],"exampleFix":"-- before\nSELECT * FROM hive.default.my schema.t\n-- after\nSELECT * FROM hive.default.\"my schema.t\"","handlingStrategy":"validation","validationCode":"// Validate identifier parts count client-side\nboolean isValidTableName(QualifiedName n) { return n.getParts().size() <= 3; }","typeGuard":"boolean isThreePartName(String name) { return name.split(\"\\\\.\").length <= 3; }","tryCatchPattern":"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; }","preventionTips":["Use at most catalog.schema.table when naming tables","Quote identifiers containing dots","Check identifier parsing when migrating names from other systems"],"tags":["sql","naming","syntax"],"backgroundTag":"too-many-dots-in-table-name","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"}