{"record":{"id":"c6f546761574fbc4","repo":"apache/seatunnel","slug":"table-schema-get-failed-c6f546","errorCode":"TABLE_SCHEMA_GET_FAILED","errorMessage":"Check table is or not existed failed, table name is %s ","messagePattern":"Check table is or not existed failed, table name is (.+?) ","errorType":"error_code","errorClass":"S3RedshiftJdbcConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-s3-redshift/src/main/java/org/apache/seatunnel/connectors/seatunnel/redshift/RedshiftJdbcClient.java","lineNumber":76,"sourceCode":"        }\n        return INSTANCE;\n    }\n\n    private RedshiftJdbcClient(String url, String user, String password)\n            throws SQLException, ClassNotFoundException {\n        Class.forName(\"com.amazon.redshift.jdbc42.Driver\");\n        this.connection = DriverManager.getConnection(url, user, password);\n    }\n\n    public boolean checkTableExists(String tableName) {\n        boolean flag = false;\n        try {\n            DatabaseMetaData meta = connection.getMetaData();\n            String[] type = {\"TABLE\"};\n            ResultSet rs = meta.getTables(null, null, tableName, type);\n            flag = rs.next();\n        } catch (SQLException e) {\n            throw new S3RedshiftJdbcConnectorException(\n                    CommonErrorCodeDeprecated.TABLE_SCHEMA_GET_FAILED,\n                    String.format(\n                            \"Check table is or not existed failed, table name is %s \", tableName),\n                    e);\n        }\n        return flag;\n    }\n\n    public boolean execute(String sql) throws Exception {\n        try (Statement statement = connection.createStatement()) {\n            return statement.execute(sql);\n        }\n    }\n\n    public synchronized void close() throws SQLException {\n        connection.close();\n    }\n}","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-s3-redshift/src/main/java/org/apache/seatunnel/connectors/seatunnel/redshift/RedshiftJdbcClient.java#L58-L94","documentation":"RedshiftJdbcClient.checkTableExists queries DatabaseMetaData.getTables to test table existence. Any SQLException during metadata lookup is wrapped as S3RedshiftJdbcConnectorException(TABLE_SCHEMA_GET_FAILED) with the table name in the message.","triggerScenarios":"Calling checkTableExists when the JDBC connection is stale/closed, the table name pattern causes a metadata query error, or the Redshift server drops the session mid-call.","commonSituations":"Long-running jobs whose idle connection was terminated by a firewall/load balancer, incorrect case-sensitive table names, or permission issues on the catalog metadata views.","solutions":["Confirm the JDBC connection is alive (enable keepalive/timeout settings on the Redshift JDBC URL)","Verify the table name matches exactly (Redshift stores lowercase identifiers; check quoting)","Grant the user access to the schema/catalog so DatabaseMetaData.getTables can enumerate the table"],"exampleFix":"// before\njdbc_url = \"jdbc:redshift://host:5439/dev\"\n// after (add keepalives/timeout)\njdbc_url = \"jdbc:redshift://host:5439/dev?tcpKeepAlive=true&socketTimeout=300\"","handlingStrategy":"retry","validationCode":"// ensure connection is live before metadata call\nif (connection.isClosed() || !connection.isValid(5)) connection = reopenConnection();","typeGuard":null,"tryCatchPattern":"try {\n    client.checkTableExists(tableName);\n} catch (S3RedshiftJdbcConnectorException e) {\n    // retry once with a fresh connection before failing the job\n}","preventionTips":["Use tcpKeepAlive=true and sane socketTimeout in the Redshift JDBC URL","Use lowercase, unquoted table names to match Redshift identifier semantics","Grant the DB user metadata/catalog read permissions"],"tags":["jdbc","redshift","metadata"],"backgroundTag":"database-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}