{"record":{"id":"9eac2844c3a16066","repo":"prestodb/presto","slug":"table-not-found","errorCode":"TABLE_NOT_FOUND","errorMessage":"Table '%s' has no supported columns (all %s columns are not supported)","messagePattern":"Table '(.+?)' has no supported columns \\(all (.+?) columns are not supported\\)","errorType":"error_code","errorClass":"TableNotFoundException","httpStatus":null,"severity":"error","filePath":"presto-base-jdbc/src/main/java/com/facebook/presto/plugin/jdbc/BaseJdbcClient.java","lineNumber":266,"sourceCode":"                    JdbcTypeHandle typeHandle = new JdbcTypeHandle(\n                            resultSet.getInt(\"DATA_TYPE\"),\n                            resultSet.getString(\"TYPE_NAME\"),\n                            resultSet.getInt(\"COLUMN_SIZE\"),\n                            resultSet.getInt(\"DECIMAL_DIGITS\"));\n                    Optional<ReadMapping> readMapping = toPrestoType(session, typeHandle);\n                    // skip unsupported column types\n                    if (readMapping.isPresent()) {\n                        String columnName = resultSet.getString(\"COLUMN_NAME\");\n                        boolean nullable = columnNullable == resultSet.getInt(\"NULLABLE\");\n                        Optional<String> comment = Optional.ofNullable(emptyToNull(resultSet.getString(\"REMARKS\")));\n                        columns.add(new JdbcColumnHandle(connectorId, columnName, typeHandle, readMapping.get().getType(), nullable, comment));\n                    }\n                }\n                if (columns.isEmpty()) {\n                    // A table may have no supported columns. In rare cases (e.g. PostgreSQL) a table might have no columns at all.\n                    // Throw an exception if the table has no supported columns.\n                    // This can occur if all columns in the table are of unsupported types, or in rare cases, if the table has no columns at all.\n                    throw new TableNotFoundException(\n                            tableHandle.getSchemaTableName(),\n                            format(\"Table '%s' has no supported columns (all %s columns are not supported)\", tableHandle.getSchemaTableName(), allColumns));\n                }\n                return ImmutableList.copyOf(columns);\n            }\n        }\n        catch (SQLException e) {\n            throw new PrestoException(JDBC_ERROR, e);\n        }\n    }\n\n    @Override\n    public Optional<ReadMapping> toPrestoType(ConnectorSession session, JdbcTypeHandle typeHandle)\n    {\n        if (typeHandle.getJdbcType() == java.sql.Types.TIMESTAMP) {\n            boolean legacyTimestamp = session.getSqlFunctionProperties().isLegacyTimestamp();\n            return Optional.of(legacyTimestamp ? timestampReadMappingLegacy() : timestampReadMapping());\n        }","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-base-jdbc/src/main/java/com/facebook/presto/plugin/jdbc/BaseJdbcClient.java#L248-L284","documentation":"BaseJdbcClient.getColumns() builds the Presto column list for a JDBC table by filtering remote columns through toPrestoType(). If nothing survives the filter, it throws TableNotFoundException, because Presto cannot represent a table with zero readable columns.","triggerScenarios":"Calling getColumns/getTableMetadata on a table where every column's JDBC type maps to no Presto type (e.g. custom/proprietary SQL types), or a degenerate remote table that genuinely has no columns (rare, e.g. PostgreSQL).","commonSituations":"Querying tables containing only vendor-specific or geometry/custom typed columns with a connector dialect lacking a type mapping; accidentally pointing a table name mapping at the wrong object; empty tables created by other tools with zero columns.","solutions":["Add a type mapping for the unsupported column type in the connector (override toPrestoType / add to the connector's type mapping) so at least one column is readable","Verify the table name/schema mapping points at the intended table, not a differently-typed object","Change the table on the remote database so it includes at least one column with a supported type","If the table is truly empty/irrelevant, drop it or exclude it from schema discovery"],"exampleFix":"// before: table has only custom type columns -> TableNotFoundException\n// after: add a mapping in the connector's JdbcClient subclass\n@Override\nprotected Optional<Type> toPrestoType(ConnectorSession session, JdbcTypeHandle typeHandle) {\n    Optional<Type> mapped = super.toPrestoType(session, typeHandle);\n    if (mapped.isPresent()) return mapped;\n    if (typeHandle.getJdbcTypeCode() == Types.OTHER) { // map custom type\n        return Optional.of(VARCHAR);\n    }\n    return Optional.empty();\n}","handlingStrategy":"validation","validationCode":"// Before relying on a JDBC table, confirm it exposes supported columns\nResultSet rs = dbMetaData.getColumns(catalog, schema, table, null);\nint supported = 0;\nwhile (rs.next()) {\n    int jdbcType = rs.getInt(\"DATA_TYPE\");\n    if (isSupportedJdbcType(jdbcType)) supported++; // check connector's type mappings\n}\nif (supported == 0) throw new IllegalStateException(\"Table \" + table + \" has no supported columns\");","typeGuard":"boolean hasSupportedColumns(ResultSetMetaData md) throws SQLException {\n    for (int i = 1; i <= md.getColumnCount(); i++) {\n        if (isSupportedJdbcType(md.getColumnType(i))) return true;\n    }\n    return false;\n}","tryCatchPattern":"try {\n    TableMetadata md = metadata.getTableMetadata(session, tableHandle);\n} catch (TableNotFoundException e) {\n    // zero readable columns: adjust mappings or skip this table\n    log.warn(\"Skipping table with no supported columns: %s\", e.getTableName());\n}","preventionTips":["Check the connector dialect's supported type list before modeling tables with exotic column types","Keep at least one standard-typed column (e.g. a varchar/int key) in tables exposed via JDBC","Validate table readability with a metadata query after creating tables with external tools"],"tags":["jdbc","metadata","type-mapping","table-not-found"],"backgroundTag":"table-not-found","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}