{"record":{"id":"072dec7d63dd8a0b","repo":"dbeaver/dbeaver","slug":"error-reading-table-statistics","errorCode":null,"errorMessage":"Error reading table statistics","messagePattern":"Error reading table statistics","errorType":"exception","errorClass":"DBCException","httpStatus":null,"severity":"warning","filePath":"plugins/org.jkiss.dbeaver.ext.altibase/src/org/jkiss/dbeaver/ext/altibase/model/AltibaseSchema.java","lineNumber":244,"sourceCode":"            return;\n        }\n        try (JDBCSession session = DBUtils.openMetaSession(monitor, this, \"Load table status\")) {\n            try (JDBCPreparedStatement dbStat = session.prepareStatement(\n                    \"SELECT table_name, memory_size, disk_size FROM system_.sys_table_size_ WHERE USER_NAME = ?\")) {\n                dbStat.setString(1, getName());\n                \n                try (JDBCResultSet dbResult = dbStat.executeQuery()) {\n                    while (dbResult.next()) {\n                        String tableName = dbResult.getString(1);\n                        AltibaseTable table = (AltibaseTable) getTable(monitor, tableName);\n                        if (table != null) {\n                            table.fetchTableSize(dbResult);\n                        }\n                    }\n                }\n            }\n        } catch (SQLException e) {\n            throw new DBCException(\"Error reading table statistics\", e);\n        } finally {\n            for (GenericTableBase table : getTableCache().getCachedObjects()) {\n                if (table instanceof AltibaseTable && !((AltibaseTable) table).hasStatistics()) {\n                    ((AltibaseTable) table).resetSize();\n                }\n            }\n            hasStatistics = true;\n        }\n    }\n    \n    static class DbLinkCache extends JDBCObjectLookupCache<GenericObjectContainer, AltibaseDbLink> {\n\n        @Nullable\n        @Override\n        protected AltibaseDbLink fetchObject(@NotNull JDBCSession session, @NotNull GenericObjectContainer container, \n                @NotNull JDBCResultSet resultSet) throws SQLException, DBException {\n            return ((AltibaseMetaModel) container.getDataSource().getMetaModel()).createDbLinkImpl(container, resultSet);\n        }","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/dbeaver/dbeaver/blob/1e5ee1042bc61661368942aece126f3e67049955/plugins/org.jkiss.dbeaver.ext.altibase/src/org/jkiss/dbeaver/ext/altibase/model/AltibaseSchema.java#L226-L262","documentation":"Thrown while loading per-table size/statistics for an Altibase schema. AltibaseSchema queries a system catalog for table sizes, maps each row to a cached AltibaseTable, and delegates to fetchTableSize; any SQLException from the catalog query (missing view, privilege error, disconnect) is wrapped in this DBCException. The finally block still runs, resetting sizes for any table that never received statistics, so partial data never silently lingers.","triggerScenarios":"Called from the schema statistics refresh path: getTable(monitor, tableName) lookup + fetchTableSize(dbResult) inside a while(dbResult.next()) loop over a JDBCResultSet backed by an Altibase system_. view. Fires when executeQuery() or dbResult.getString(1) raises SQLException, or when the underlying Altibase server rejects the catalog query.","commonSituations":"Connecting to an Altibase version whose sys_table_size_ / statistics catalog view is renamed or absent; a low-privilege database user lacking SELECT on the statistics dictionary view; transient network drop or session timeout during a large-schema statistics load; system_. schema not present in older Altibase builds.","solutions":["Verify the connected Altibase user has SELECT privilege on the system_ catalog views used by the statistics query.","Check the Altibase server version matches the catalog view names the plugin expects; upgrade the DBeaver Altibase plugin or the server to a compatible version.","Inspect the wrapped SQLException (cause) for the SQLState / vendor error code to identify a missing-view vs. permission vs. connectivity failure.","If statistics are optional for your workflow, allow the load to fail gracefully — the finally block already resets sizes so the schema tree still renders."],"exampleFix":"// before\n} catch (SQLException e) {\n    throw new DBCException(\"Error reading table statistics\", e);\n}\n// after - surface the SQLState so the user can distinguish permission vs. missing view\n} catch (SQLException e) {\n    log.warn(\"Error reading table statistics for schema \" + getName(), e);\n    throw new DBCException(\"Error reading table statistics [\" + e.getSQLState() + \"]: \" + e.getMessage(), e);\n}","handlingStrategy":"try-catch","validationCode":"// Verify the user can see the statistics catalog before triggering a full schema refresh\ntry (JDBCSession s = DBUtils.openMetaSession(monitor, schema.getDataSource(), \"preflight\");\n     JDBCPreparedStatement ps = s.prepareStatement(\n         \"SELECT 1 FROM system_.sys_table_size_ WHERE ROWNUM <= 1\")) {\n    ps.executeQuery();\n} catch (SQLException ignored) {\n    // statistics unavailable - skip the refresh\n}","typeGuard":null,"tryCatchPattern":"try {\n    schema.readStatistics(monitor);\n} catch (DBCException e) {\n    log.warn(\"Altibase statistics unavailable for \" + schema.getName(), e);\n    // schema tree remains usable; sizes simply stay unset\n}","preventionTips":["Grant SELECT on Altibase system_.* statistics views to the connecting user.","Treat statistics load as best-effort: catch DBCException so the schema tree still renders.","Match the DBeaver Altibase plugin version to the server version's catalog layout."],"tags":["altibase","jdbc","metadata","statistics","catalog"],"backgroundTag":null,"analyzedSha":"1e5ee1042bc61661368942aece126f3e67049955","analyzedAt":"2026-08-13T23:31:13.467Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}