{"record":{"id":"4f204f4a174af7cc","repo":"prestodb/presto","slug":"not-found-4f204f","errorCode":"NOT_FOUND","errorMessage":"Schema not found: ","messagePattern":"Schema not found: ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-clickhouse/src/main/java/com/facebook/presto/plugin/clickhouse/ClickHouseClient.java","lineNumber":529,"sourceCode":"                quoted(clickHouseColumn.getColumnName()),\n                quoted(newColumnName));\n\n        try (Connection connection = connectionFactory.openConnection(identity)) {\n            execute(connection, sql);\n        }\n        catch (SQLException e) {\n            PrestoException exception = new PrestoException(JDBC_ERROR, \"Query: \" + sql, e);\n            throw exception;\n        }\n    }\n\n    public ClickHouseOutputTableHandle beginInsertTable(ConnectorTableMetadata tableMetadata, ConnectorSession session, String tableName)\n            throws SQLException\n    {\n        SchemaTableName schemaTableName = tableMetadata.getTable();\n        ClickHouseIdentity identity = ClickHouseIdentity.from(session);\n        if (!getSchemaNames(identity).contains(schemaTableName.getSchemaName())) {\n            throw new PrestoException(NOT_FOUND, \"Schema not found: \" + schemaTableName.getSchemaName());\n        }\n\n        try (Connection connection = connectionFactory.openConnection(identity)) {\n            boolean uppercase = connection.getMetaData().storesUpperCaseIdentifiers();\n            String remoteSchema = toRemoteSchemaName(session, identity, connection, schemaTableName.getSchemaName());\n            String remoteTable = toRemoteTableName(session, identity, connection, remoteSchema, schemaTableName.getTableName());\n            if (uppercase) {\n                tableName = tableName.toUpperCase(ENGLISH);\n            }\n            String catalog = connection.getCatalog();\n\n            ImmutableList.Builder<String> columnNames = ImmutableList.builder();\n            ImmutableList.Builder<Type> columnTypes = ImmutableList.builder();\n            ImmutableList.Builder<String> columnList = ImmutableList.builder();\n            for (ColumnMetadata column : tableMetadata.getColumns()) {\n                String columnName = column.getName();\n                if (uppercase) {\n                    columnName = columnName.toUpperCase(ENGLISH);","sourceCodeStart":511,"sourceCodeEnd":547,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-clickhouse/src/main/java/com/facebook/presto/plugin/clickhouse/ClickHouseClient.java#L511-L547","documentation":"PrestoException (NOT_FOUND) thrown by ClickHouseClient.beginInsertTable when the schema (database) portion of the target table does not exist in ClickHouse. The check runs before opening a connection for the insert, so writes fail fast with a clear message naming the missing schema.","triggerScenarios":"INSERT into a catalog.schema.table where schemaTableName.getSchemaName() is not in getSchemaNames(identity); inserting into a table created in a database that was dropped or that never existed.","commonSituations":"Typo in the schema name in INSERT statements; using the wrong catalog mapping; ClickHouse database dropped between table creation and insert; case mismatch when case-insensitive name mapping is disabled.","solutions":["Verify the schema exists: SHOW CREATE SCHEMA / SHOW SCHEMAS in the ClickHouse catalog.","Correct the schema name in your INSERT statement.","Create the missing database in ClickHouse (CREATE DATABASE).","Check the connector's case-sensitive-name-mapping setting if the schema exists with different case.","Confirm you are querying the intended catalog."],"exampleFix":"-- before\nINSERT INTO clickhouse.wrong_schema.events SELECT * FROM events;\n-- after\nINSERT INTO clickhouse.analytics.events SELECT * FROM events;","handlingStrategy":"validation","validationCode":"-- verify the schema exists before INSERT\nSHOW SCHEMAS FROM clickhouse LIKE 'analytics';\n-- must return the schema used in clickhouse.analytics.events","typeGuard":null,"tryCatchPattern":"try {\n    insertData(...);\n} catch (PrestoException e) {\n    if (e.getMessage().startsWith(\"Schema not found\")) {\n        execute(\"CREATE SCHEMA IF NOT EXISTS clickhouse.\" + schemaName);\n        // then retry the insert once\n    } else {\n        throw e;\n    }\n}","preventionTips":["Run CREATE SCHEMA IF NOT EXISTS in deployment scripts before writes.","Validate catalog.schema.table references in application config at startup.","Watch for database drops in ClickHouse (audit logs).","Note case sensitivity of schema names in your environment."],"tags":["clickhouse","jdbc","connector","not-found","insert"],"backgroundTag":"schema-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"}