{"record":{"id":"a36292881008b442","repo":"prestodb/presto","slug":"backquoted-identifiers-are-not-supported-use-doub","errorCode":null,"errorMessage":"backquoted identifiers are not supported; use double quotes to quote identifiers","messagePattern":"backquoted identifiers are not supported; use double quotes to quote identifiers","errorType":"exception","errorClass":"ParsingException","httpStatus":null,"severity":"error","filePath":"presto-parser/src/main/java/com/facebook/presto/sql/parser/SqlParser.java","lineNumber":218,"sourceCode":"        }\n\n        @Override\n        public void exitUnquotedIdentifier(SqlBaseParser.UnquotedIdentifierContext context)\n        {\n            String identifier = context.IDENTIFIER().getText();\n            for (IdentifierSymbol identifierSymbol : EnumSet.complementOf(allowedIdentifierSymbols)) {\n                char symbol = identifierSymbol.getSymbol();\n                if (identifier.indexOf(symbol) >= 0) {\n                    throw new ParsingException(\"identifiers must not contain '\" + identifierSymbol.getSymbol() + \"'\", null, context.IDENTIFIER().getSymbol().getLine(), context.IDENTIFIER().getSymbol().getCharPositionInLine());\n                }\n            }\n        }\n\n        @Override\n        public void exitBackQuotedIdentifier(SqlBaseParser.BackQuotedIdentifierContext context)\n        {\n            Token token = context.BACKQUOTED_IDENTIFIER().getSymbol();\n            throw new ParsingException(\n                    \"backquoted identifiers are not supported; use double quotes to quote identifiers\",\n                    null,\n                    token.getLine(),\n                    token.getCharPositionInLine());\n        }\n\n        @Override\n        public void exitDigitIdentifier(SqlBaseParser.DigitIdentifierContext context)\n        {\n            Token token = context.DIGIT_IDENTIFIER().getSymbol();\n            throw new ParsingException(\n                    \"identifiers must not start with a digit; surround the identifier with double quotes\",\n                    null,\n                    token.getLine(),\n                    token.getCharPositionInLine());\n        }\n\n        @Override","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-parser/src/main/java/com/facebook/presto/sql/parser/SqlParser.java#L200-L236","documentation":"Presto does not support MySQL-style backtick-quoted identifiers. When the grammar recognizes a BACKQUOTED_IDENTIFIER token, PostProcessor.exitBackQuotedIdentifier rejects it and points the user to the Presto-idiomatic double-quote quoting syntax.","triggerScenarios":"Parsing SQL using backticks around identifiers, e.g. SELECT `name` FROM `users` — typical of MySQL-dialect SQL fed to Presto.","commonSituations":"Migrating queries from MySQL, ORMs configured for MySQL quoting, copy-pasted DDL or analytics SQL from MySQL tools.","solutions":["Replace all backticks with double quotes","Reconfigure the query generator to emit ANSI double-quoted identifiers","Pre-process SQL: convert backtick-quoted tokens to double-quoted ones before parsing"],"exampleFix":"// before\nString sql = \"SELECT `name` FROM `users`\";\n// after\nString sql = \"SELECT \\\"name\\\" FROM \\\"users\\\"\";","handlingStrategy":"validation","validationCode":"// Convert MySQL backtick quoting to Presto double quotes before parsing\nString converted = sql.replaceAll(\"`([^`]+)`\", \"\\\\\\\"$1\\\\\\\"\");\nif (converted.contains(\"`\")) throw new IllegalArgumentException(\"Unbalanced backtick in SQL\");","typeGuard":"boolean usesBackticks(String sql) {\n    return sql != null && sql.indexOf('`') >= 0;\n}","tryCatchPattern":"try {\n    return sqlParser.createStatement(sql);\n} catch (ParsingException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"backquoted identifiers\")) {\n        return sqlParser.createStatement(sql.replace(\"`\", \"\\\"\").replaceAll(\"\\\\\\\"([^\\\"]+)\\\\\\\"\", \"\\\\\\\"$1\\\\\\\"\"));\n    }\n    throw e;\n}","preventionTips":["Configure ORMs to ANSI double-quote identifier quoting","Run a backtick-to-double-quote normalization on imported MySQL SQL","Search codebases for backticks in SQL string literals during migrations","Prefer double quotes in all hand-written Presto SQL"],"tags":["sql","identifier","mysql","quoting"],"backgroundTag":"backtick-identifier-unsupported","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"}