{"record":{"id":"08dcf41230ba6190","repo":"hibernate/hibernate-orm","slug":"singlestore-doesn-t-support-any-clause","errorCode":null,"errorMessage":"SingleStore doesn't support ANY clause","messagePattern":"SingleStore doesn't support ANY clause","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SingleStoreSqlAstTranslator.java","lineNumber":222,"sourceCode":"\t\t\tappendSql( CLOSE_PARENTHESIS );\n\t\t}\n\t}\n\n\tprotected boolean shouldEmulateFetchClause(QueryPart queryPart) {\n\t\t// Check if current query part is already row numbering to avoid infinite recursion\n\t\treturn useOffsetFetchClause(\n\t\t\t\tqueryPart ) && getQueryPartForRowNumbering() != queryPart && supportsWindowFunctions() && !isRowsOnlyFetchClauseType(\n\t\t\t\tqueryPart );\n\t}\n\n\t@Override\n\tprotected boolean shouldEmulateLateralWithIntersect(QueryPart queryPart) {\n\t\treturn getDialect().supportsSimpleQueryGrouping() || !queryPart.hasOffsetOrFetchClause();\n\t}\n\n\t@Override\n\tpublic void visitAny(Any any) {\n\t\tthrow new UnsupportedOperationException( \"SingleStore doesn't support ANY clause\" );\n\t}\n\n\t@Override\n\tpublic void visitEvery(Every every) {\n\t\tthrow new UnsupportedOperationException( \"SingleStore doesn't support ALL clause\" );\n\t}\n\n\t@Override\n\tpublic void visitQueryGroup(QueryGroup queryGroup) {\n\t\tif ( shouldEmulateFetchClause( queryGroup ) ) {\n\t\t\temulateFetchOffsetWithWindowFunctions( queryGroup, true );\n\t\t}\n\t\telse {\n\t\t\tsuper.visitQueryGroup( queryGroup );\n\t\t}\n\t}\n\n\t@Override","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SingleStoreSqlAstTranslator.java#L204-L240","documentation":"SingleStoreSqlAstTranslator.visitAny() throws UnsupportedOperationException during SQL rendering because SingleStore does not support the ANY quantified-subquery comparison. When Hibernate's semantic model contains an Any node (HQL 'x = any(select ...)', 'x > any(select ...)' and the criteria equivalents), translation aborts before any statement reaches the database. The message text says ANY clause even though HQL spells it any().","triggerScenarios":"Executing HQL like 'select o from Order o where o.total > any(select b.limit from Budget b)' on SingleStore; criteria quantified comparisons built with any(); queries generated by shared query libraries that use quantifiers on every database.","commonSituations":"Porting queries from PostgreSQL, Oracle or SQL Server (all support ANY) to SingleStore; multi-database products where the same HQL runs against several backends; query DSLs that emit any() for set-membership style comparisons.","solutions":["Rewrite 'x > any(sub)' as 'x > (select min(s) from sub)' and 'x < any(sub)' as 'x < (select max(s) from sub)'","Rewrite the equality form with IN: 'x = any(sub)' is 'x in (sub)'","Rewrite 'x <> any(sub)' as 'exists (select 1 from sub where s <> x)'"],"exampleFix":"// before\nselect o from Order o where o.total > any(select b.limit from Budget b)\n\n// after\nselect o from Order o where o.total > (select min(b.limit) from Budget b)","handlingStrategy":"validation","validationCode":"static boolean usesAnyQuantifier(String hql) {\n    return hql.toLowerCase().matches('(?:[<>=!]\\s*=\\s*)?any\\s*\\\\(') || hql.toLowerCase().contains(' any(');\n}\n\nif (dialect instanceof SingleStoreDialect && usesAnyQuantifier(hql)) {\n    throw new UnsupportedOperationException(\n        'SingleStore does not support ANY; rewrite as min/max comparison or IN');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer min()/max() scalar subqueries over any() for portable HQL","Use IN for equality-quantifier semantics","Add a dialect-compatibility test suite for quantified queries"],"tags":["hibernate","singlestore","sql-translator","any","quantified-subquery","hql"],"backgroundTag":"unsupported-quantified-subquery","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}