prestodb/presto · error · PrestoException
ALREADY_EXISTS
ALREADY_EXISTS
Error message
View already exists:
What it means
TestingMetadata.createView: a view with the same schema.table name already exists and replace=false, so creation is refused with ALREADY_EXISTS. This is the in-memory test connector's stand-in for a real metastore conflict.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/testing/TestingMetadata.java:212
throw new IllegalArgumentException("Target table already exists: " + tableMetadata.getTable());
}
}
@Override
public void dropTable(ConnectorSession session, ConnectorTableHandle tableHandle)
{
tables.remove(getTableName(tableHandle));
}
@Override
public void createView(ConnectorSession session, ConnectorTableMetadata viewMetadata, String viewData, boolean replace)
{
SchemaTableName viewName = viewMetadata.getTable();
if (replace) {
views.put(viewName, viewData);
}
else if (views.putIfAbsent(viewName, viewData) != null) {
throw new PrestoException(ALREADY_EXISTS, "View already exists: " + viewName);
}
}
@Override
public void dropView(ConnectorSession session, SchemaTableName viewName)
{
if (views.remove(viewName) == null) {
throw new ViewNotFoundException(viewName);
}
}
@Override
public List<SchemaTableName> listViews(ConnectorSession session, Optional<String> schemaName)
{
ImmutableList.Builder<SchemaTableName> builder = ImmutableList.builder();
for (SchemaTableName viewName : views.keySet()) {
if (schemaName.map(viewName.getSchemaName()::equals).orElse(true)) {
builder.add(viewName);View on GitHub (pinned to 55bb57d202)
Solutions
- Use CREATE OR REPLACE VIEW semantics (replace=true)
- Drop the existing view before creating
- Pick a different view name in the test
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/testing/TestingMetadata.java:212 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/3bf44ea2b8e49389.
Report an issue: GitHub.