prestodb/presto · error · UnsupportedOperationException

Listing all tables after adding/dropping/altering…

Error message

Listing all tables after adding/dropping/altering tables/views in a transaction is not supported

What it means

getAllTables on SemiTransactionalHiveMetastore refuses to list tables when the current transaction already contains add/drop/alter actions on tables or views, because the delegate metastore's listing would not reflect those uncommitted changes and could yield inconsistent results.

Solutions

  1. Restructure the workload so table listing happens before any DDL in the same transaction, or in a separate transaction/session
  2. Commit or roll back the pending table changes before calling listTables
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java:204 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/4951f8fde1593394. Report an issue: GitHub.

Appendix: source

Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java:204

    }

    public synchronized List<String> getAllDatabases(MetastoreContext metastoreContext)
    {
        checkReadable();
        return delegate.getAllDatabases(metastoreContext);
    }

    public synchronized Optional<Database> getDatabase(MetastoreContext metastoreContext, String databaseName)
    {
        checkReadable();
        return delegate.getDatabase(metastoreContext, databaseName);
    }

    public synchronized Optional<List<String>> getAllTables(MetastoreContext metastoreContext, String databaseName)
    {
        checkReadable();
        if (!tableActions.isEmpty()) {
            throw new UnsupportedOperationException("Listing all tables after adding/dropping/altering tables/views in a transaction is not supported");
        }
        return delegate.getAllTables(metastoreContext, databaseName);
    }

    public Optional<Table> getTable(MetastoreContext metastoreContext, String databaseName, String tableName)
    {
        HiveTableHandle hiveTableHandle = new HiveTableHandle(databaseName, tableName);
        return getTable(metastoreContext, hiveTableHandle);
    }

    public synchronized Optional<Table> getTable(MetastoreContext metastoreContext, HiveTableHandle hiveTableHandle)
    {
        checkReadable();
        Action<TableAndMore> tableAction = tableActions.get(hiveTableHandle.getSchemaTableName());
        if (tableAction == null) {
            return metastoreContext.getRuntimeStats().recordWallTime(GET_TABLE_TIME_NANOS, () -> delegate.getTable(metastoreContext, hiveTableHandle));
        }
        switch (tableAction.getType()) {

View on GitHub (pinned to 55bb57d202)