prestodb/presto · error · ParsingException

backquoted identifiers are not supported; use double quotes

Error message

backquoted identifiers are not supported; use double quotes to quote identifiers

What it means

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.

Source

Thrown at presto-parser/src/main/java/com/facebook/presto/sql/parser/SqlParser.java:218

        }

        @Override
        public void exitUnquotedIdentifier(SqlBaseParser.UnquotedIdentifierContext context)
        {
            String identifier = context.IDENTIFIER().getText();
            for (IdentifierSymbol identifierSymbol : EnumSet.complementOf(allowedIdentifierSymbols)) {
                char symbol = identifierSymbol.getSymbol();
                if (identifier.indexOf(symbol) >= 0) {
                    throw new ParsingException("identifiers must not contain '" + identifierSymbol.getSymbol() + "'", null, context.IDENTIFIER().getSymbol().getLine(), context.IDENTIFIER().getSymbol().getCharPositionInLine());
                }
            }
        }

        @Override
        public void exitBackQuotedIdentifier(SqlBaseParser.BackQuotedIdentifierContext context)
        {
            Token token = context.BACKQUOTED_IDENTIFIER().getSymbol();
            throw new ParsingException(
                    "backquoted identifiers are not supported; use double quotes to quote identifiers",
                    null,
                    token.getLine(),
                    token.getCharPositionInLine());
        }

        @Override
        public void exitDigitIdentifier(SqlBaseParser.DigitIdentifierContext context)
        {
            Token token = context.DIGIT_IDENTIFIER().getSymbol();
            throw new ParsingException(
                    "identifiers must not start with a digit; surround the identifier with double quotes",
                    null,
                    token.getLine(),
                    token.getCharPositionInLine());
        }

        @Override

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Replace all backticks with double quotes
  2. Reconfigure the query generator to emit ANSI double-quoted identifiers
  3. Pre-process SQL: convert backtick-quoted tokens to double-quoted ones before parsing

Example fix

// before
String sql = "SELECT `name` FROM `users`";
// after
String sql = "SELECT \"name\" FROM \"users\"";
Defensive patterns

Strategy: validation

Validate before calling

// Convert MySQL backtick quoting to Presto double quotes before parsing
String converted = sql.replaceAll("`([^`]+)`", "\\\"$1\\\"");
if (converted.contains("`")) throw new IllegalArgumentException("Unbalanced backtick in SQL");

Type guard

boolean usesBackticks(String sql) {
    return sql != null && sql.indexOf('`') >= 0;
}

Try / catch

try {
    return sqlParser.createStatement(sql);
} catch (ParsingException e) {
    if (e.getMessage() != null && e.getMessage().contains("backquoted identifiers")) {
        return sqlParser.createStatement(sql.replace("`", "\"").replaceAll("\\\"([^\"]+)\\\"", "\\\"$1\\\""));
    }
    throw e;
}

Prevention

When it happens

Trigger: Parsing SQL using backticks around identifiers, e.g. SELECT `name` FROM `users` — typical of MySQL-dialect SQL fed to Presto.

Common situations: Migrating queries from MySQL, ORMs configured for MySQL quoting, copy-pasted DDL or analytics SQL from MySQL tools.

Related errors


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