{"record":{"id":"64cfbb776e335c87","repo":"apache/incubator-seata","slug":"unsupported-db-type-dbtype","errorCode":null,"errorMessage":"\"Unsupported DB type: \" + dbType","messagePattern":"\"Unsupported DB type: \" \\+ dbType","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"common/src/main/java/org/apache/seata/common/util/PageUtil.java","lineNumber":247,"sourceCode":"     */\n    public static String getDateTimeStartSql(String dbType, String timeColumnName) {\n        switch (dbType.toLowerCase()) {\n            case \"mysql\":\n                return \" and UNIX_TIMESTAMP(\" + timeColumnName + \") >= ? \";\n            case \"postgresql\":\n                return \" and \" + timeColumnName + \" >= TO_TIMESTAMP(?) \";\n            case \"oracle\":\n                return \" and \" + timeColumnName\n                        + \" >= TO_TIMESTAMP('1970-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') + NUMTODSINTERVAL(?, 'SECOND') \";\n            case \"sqlserver\":\n                return \" and \" + timeColumnName + \" >= DATEADD(SECOND, ?, '1970-01-01 00:00:00') \";\n            case \"dm\":\n            case \"oscar\":\n                // Compatible with Oracle syntax\n                return \" and \" + timeColumnName\n                        + \" >= TO_TIMESTAMP('1970-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') + NUMTODSINTERVAL(?, 'SECOND') \";\n            default:\n                throw new IllegalArgumentException(\"Unsupported DB type: \" + dbType);\n        }\n    }\n\n    /**\n     * get sql for time end (The database fields is of type datetime)\n     * @param dbType\n     * @param timeColumnName\n     * @return java.lang.String\n     */\n    public static String getDateTimeEndSql(String dbType, String timeColumnName) {\n        switch (dbType.toLowerCase()) {\n            case \"mysql\":\n                return \" and UNIX_TIMESTAMP(\" + timeColumnName + \") <= ? \";\n            case \"postgresql\":\n                return \" and \" + timeColumnName + \" <= TO_TIMESTAMP(?) \";\n            case \"oracle\":\n                return \" and \" + timeColumnName\n                        + \" <= TO_TIMESTAMP('1970-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') + NUMTODSINTERVAL(?, 'SECOND') \";","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/common/src/main/java/org/apache/seata/common/util/PageUtil.java#L229-L265","documentation":"PageUtil.getDateTimeStartSql builds a datetime-typed lower-bound fragment (FROM_UNIXTIME for mysql, TO_TIMESTAMP/NUMTODSINTERVAL for oracle/dm/oscar, DATEADD for sqlserver, etc.). Its default branch throws IllegalArgumentException(\"Unsupported DB type: \" + dbType) for any dialect outside the switch — note this message differs from the older \"is not supported yet\" variants.","triggerScenarios":"Calling getDateTimeStartSql(dbType, timeColumnName) with a dbType absent from the case list (check the file for the exact set — typically mysql, oracle, sqlserver, dm, oscar, plus datetime-capable branches such as postgresql) while running console queries where the time column is of type datetime rather than epoch millis.","commonSituations":"Switching the store schema from BIGINT epoch columns to DATETIME columns while the dbType or dialect branch for your database is missing; custom stores reusing PageUtil for datetime filters.","solutions":["Use a dbType covered by getDateTimeStartSql in your Seata version","Verify the schema type matches the method family: epoch columns use getTimeStartSql, DATETIME columns use getDateTimeStartSql","Update Seata to a version whose dialect list includes your database, or patch the switch upstream"],"exampleFix":"# before\nstore.db.dbType = h2 // getDateTimeStartSql throws 'Unsupported DB type'\n\n# after\nstore.db.dbType = mysql","handlingStrategy":"type-guard","validationCode":"Set<String> DT_DB = Set.of(\"mysql\", \"oracle\", \"sqlserver\", \"dm\", \"oscar\"); // verify against your version\nif (!DT_DB.contains(dbType)) throw new ConfigurationException(\"datetime filters unsupported: \" + dbType);","typeGuard":"static boolean supportsDatetimeFilter(String dbType) { return dbType != null && Set.of(\"mysql\",\"oracle\",\"sqlserver\",\"dm\",\"oscar\").contains(dbType.toLowerCase()); }","tryCatchPattern":"try { frag = PageUtil.getDateTimeStartSql(dbType, col); } catch (IllegalArgumentException e) { throw new ConfigurationException(\"datetime filters unsupported on \" + dbType, e); }","preventionTips":["Confirm the schema column type matches the method family (epoch vs datetime)","Test datetime range queries per dialect in CI","Track dialect support matrices per Seata release when adding stores"],"tags":["database","dialect","datetime","not-supported"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}