prestodb/presto · error · SemanticException
COLUMN_ALREADY_EXISTS
COLUMN_ALREADY_EXISTS
Error message
Column '%s' already exists
What it means
During ADD COLUMN processing, the connector's column handles for the target table already contain a column with the name given in the statement's ColumnDefinition. Since columns must be unique within a table, the alteration is rejected as redundant; the duplicated name is formatted into the message.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/AddColumnTask.java:108
accessControl.checkCanAddColumns(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), tableName);
Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(session, tableHandle.get());
ColumnDefinition element = statement.getColumn();
Type type;
try {
type = metadata.getType(parseTypeSignature(element.getType()));
}
catch (IllegalArgumentException | UnknownTypeException e) {
throw new SemanticException(TYPE_MISMATCH, element, "Unknown type '%s' for column '%s'", element.getType(), element.getName());
}
if (type.equals(UNKNOWN)) {
throw new SemanticException(TYPE_MISMATCH, element, "Unknown type '%s' for column '%s'", element.getType(), element.getName());
}
if (columnHandles.containsKey(element.getName().getValueLowerCase())) {
if (!statement.isColumnNotExists()) {
throw new SemanticException(COLUMN_ALREADY_EXISTS, statement, "Column '%s' already exists", element.getName());
}
return immediateFuture(null);
}
if (!element.isNullable() && !metadata.getConnectorCapabilities(session, connectorId).contains(NOT_NULL_COLUMN_CONSTRAINT)) {
throw new SemanticException(NOT_SUPPORTED, element, "Catalog '%s' does not support NOT NULL for column '%s'", connectorId.getCatalogName(), element.getName());
}
Map<String, Expression> sqlProperties = mapFromProperties(element.getProperties());
Map<String, Object> columnProperties = metadata.getColumnPropertyManager().getProperties(
connectorId,
tableName.getCatalogName(),
sqlProperties,
session,
metadata,
parameterExtractor(statement, parameters));
Identifier columnIdentifier = element.getName();
String name = metadata.normalizeIdentifier(session, tableName.getCatalogName(), columnIdentifier.getValue());View on GitHub (pinned to 55bb57d202)
Solutions
- Choose a different column name
- Drop the existing column first if replacement is intended
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/AddColumnTask.java:108 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/07eab25d530f7c78.
Report an issue: GitHub.