{"record":{"id":"d3a8652efd28bbc7","repo":"prestodb/presto","slug":"not-found-d3a865","errorCode":"NOT_FOUND","errorMessage":"Schema not found: ${schemaName}","messagePattern":"Schema not found: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"presto-base-jdbc/src/main/java/com/facebook/presto/plugin/jdbc/BaseJdbcClient.java","lineNumber":372,"sourceCode":"    }\n\n    private JdbcOutputTableHandle beginWriteTable(ConnectorSession session, ConnectorTableMetadata tableMetadata)\n    {\n        try {\n            return createTable(tableMetadata, session, generateTemporaryTableName());\n        }\n        catch (SQLException e) {\n            throw new PrestoException(JDBC_ERROR, e);\n        }\n    }\n\n    protected JdbcOutputTableHandle createTable(ConnectorTableMetadata tableMetadata, ConnectorSession session, String tableName)\n            throws SQLException\n    {\n        SchemaTableName schemaTableName = tableMetadata.getTable();\n        JdbcIdentity identity = JdbcIdentity.from(session);\n        if (!getSchemaNames(session, 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 && !caseSensitiveNameMatchingEnabled) {\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 && !caseSensitiveNameMatchingEnabled) {\n                    columnName = columnName.toUpperCase(ENGLISH);","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-base-jdbc/src/main/java/com/facebook/presto/plugin/jdbc/BaseJdbcClient.java#L354-L390","documentation":"BaseJdbcClient.createTable() checks the target schema exists via getSchemaNames() before opening a connection to create the remote table. If the schema name is absent, it throws PrestoException(NOT_FOUND, \"Schema not found: ...\") instead of attempting a doomed CREATE TABLE.","triggerScenarios":"Calling CREATE TABLE / CREATE TABLE AS (beginWriteTable -> createTable) against a JDBC catalog with a schema name that does not exist on the remote database, or one hidden by a case-mismatch between the Presto name and the remote schema name.","commonSituations":"Typos in schema qualification; forgetting to create the schema on the remote database; case-sensitivity mismatch (e.g. lower/upper stored identifiers) between Presto and databases like Oracle or DB2; using a schema visible in one database instance but writing through a different JDBC connection.","solutions":["Create the schema first (CREATE SCHEMA my_schema) in the JDBC catalog or on the remote database","Check the exact schema name/spelling in the CREATE TABLE statement","Verify case-sensitive/case-insensitive name matching config matches how the remote DB stores identifiers","Confirm you are connected to the correct database instance/catalog"],"exampleFix":"// before\nCREATE TABLE missing_schema.t (id bigint);\n// after\nCREATE SCHEMA missing_schema;\nCREATE TABLE missing_schema.t (id bigint);","handlingStrategy":"try-catch","validationCode":"// Verify the schema exists before CREATE TABLE\nResultSet rs = connection.getMetaData().getSchemas(catalog, schemaName);\nif (!rs.next()) { throw new IllegalArgumentException(\"Schema not found: \" + schemaName); }","typeGuard":null,"tryCatchPattern":"try {\n    connector.createStatement().execute(createTableSql);\n} catch (PrestoException e) {\n    if (e.getErrorCode() == NOT_FOUND.toErrorCode()) {\n        // create the schema, then retry the DDL\n        connector.createStatement().execute(\"CREATE SCHEMA \" + schemaName);\n    } else throw e;\n}","preventionTips":["Always CREATE SCHEMA before CREATE TABLE in JDBC catalogs","Match identifier case to how the remote database stores schema names","Confirm the target database instance actually contains the schema"],"tags":["jdbc","schema","ddl","not-found"],"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-12T02:17:10.037Z"}