prestodb/presto · error · SemanticException
MISSING_COLUMN
MISSING_COLUMN
Error message
Insert column name does not exist in target table: %s
What it means
Presto's INSERT analyzer validates that every column name listed in an INSERT INTO t (col1, col2, ...) statement actually exists in the target table. If a listed column name is not found among the table's columns, StatementAnalyzer.visitInsert throws this SemanticException with code MISSING_COLUMN. The name is normalized per the connector (metadata.normalizeIdentifier) before the check.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/StatementAnalyzer.java:560
throw new SemanticException(NOT_SUPPORTED, insert, "Insert into table with column masks is not supported");
}
List<String> tableColumns = columnsMetadata.stream()
.filter(column -> !column.isHidden())
.map(ColumnMetadata::getName)
.collect(toImmutableList());
List<String> insertColumns;
if (insert.getColumns().isPresent()) {
insertColumns = insert.getColumns().get().stream()
.map(Identifier::getValue)
.map(column -> metadata.normalizeIdentifier(session, targetTable.getCatalogName(), column))
.collect(toImmutableList());
Set<String> columnNames = new HashSet<>();
for (String insertColumn : insertColumns) {
if (!tableColumns.contains(insertColumn)) {
throw new SemanticException(MISSING_COLUMN, insert, "Insert column name does not exist in target table: %s", insertColumn);
}
if (!columnNames.add(insertColumn)) {
throw new SemanticException(DUPLICATE_COLUMN_NAME, insert, "Insert column name is specified more than once: %s", insertColumn);
}
}
}
else {
insertColumns = tableColumns;
}
List<ColumnMetadata> expectedColumns = insertColumns.stream()
.map(insertColumn -> getColumnMetadata(columnsMetadata, insertColumn))
.collect(toImmutableList());
checkTypesMatchForInsert(insert, queryScope, expectedColumns);
Map<String, ColumnHandle> columnHandles = tableColumnsMetadata.getColumnHandles();
analysis.setInsert(new Analysis.Insert(View on GitHub (pinned to 55bb57d202)
Solutions
- Run `DESCRIBE <target_table>` (or SHOW COLUMNS FROM) and correct the INSERT column list to match actual column names exactly.
- Check identifier quoting: quoted names are case-sensitive for many connectors; match the case shown by DESCRIBE or drop the quotes.
- Verify you are connected to the correct catalog/schema/table (fully qualify as catalog.schema.table) so the column list matches the intended table.
- If the column was recently renamed or dropped, update the query or re-add the column to the table.
Example fix
// before INSERT INTO orders (orderkey, custkey, orderdat) VALUES (1, 2, DATE '2026-01-01'); // after INSERT INTO orders (orderkey, custkey, orderdate) VALUES (1, 2, DATE '2026-01-01');
Defensive patterns
Strategy: validation
Validate before calling
-- Run before the INSERT: DESCRIBE catalog.schema.target_table; -- Then verify each name in your INSERT column list appears in the output (respecting case). SELECT column_name FROM information_schema.columns WHERE table_schema = 'schema' AND table_name = 'target_table';
Prevention
- Always generate INSERT column lists from information_schema/DESCRIBE output instead of hand-typing them.
- Keep identifier casing consistent with the connector's normalization rules; avoid mixed quoting.
- Fully qualify the table (catalog.schema.table) to avoid validating against the wrong table.
- Re-check column lists after any ALTER TABLE rename/drop.
When it happens
Trigger: Running INSERT INTO table (a, b, typo_col) VALUES (...), or INSERT ... SELECT with a column list, where one entry in the column list does not match any column of the target table after identifier normalization (case handling).
Common situations: Typos in column names; referring to columns from the SELECT source instead of the target table; case-sensitivity mismatch between quoted identifiers and the connector's normalized names; schema drift where a column was renamed or dropped after the query was written.
Related errors
- DUPLICATE_COLUMN_NAME
- MUST_BE_AGGREGATE_OR_GROUP_BY
- NESTED_AGGREGATION
- NESTED_WINDOW
- MUST_BE_AGGREGATION_FUNCTION
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/5ffda1bb331f7325.
Report an issue: GitHub.