prestodb/presto · error · SQLException

Invalid column label:

Error message

Invalid column label: 

What it means

After the null check, columnIndex(label) looks the lowercased label up in the fieldMap built from the result metadata; if no column matches, this SQLException is thrown. It fires when the requested label does not exactly (case-insensitively) match any column name of the executed query — usually a typo or a column that is not in the SELECT list.

Source

Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:1713

    private Object column(String label)
            throws SQLException
    {
        checkOpen();
        checkValidRow();
        Object value = row.get().get(columnIndex(label) - 1);
        wasNull.set(value == null);
        return value;
    }

    private int columnIndex(String label)
            throws SQLException
    {
        if (label == null) {
            throw new SQLException("Column label is null");
        }
        Integer index = fieldMap.get(label.toLowerCase(ENGLISH));
        if (index == null) {
            throw new SQLException("Invalid column label: " + label);
        }
        return index;
    }

    private static Number toNumber(Object value)
            throws SQLException
    {
        if (value == null) {
            return 0;
        }
        if (value instanceof Number) {
            return (Number) value;
        }
        if (value instanceof Boolean) {
            return ((Boolean) value) ? 1 : 0;
        }
        throw new SQLException("Value is not a number: " + value.getClass().getCanonicalName());
    }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Compare the label against the query's column names via ResultSetMetaData
  2. Fix the spelling/case of the requested column label
  3. Include the missing column in the SELECT list of the query
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:1713 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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