{"record":{"id":"623b5abad6e5a136","repo":"hibernate/hibernate-orm","slug":"unsupported-pad-specification-ctx-gettext","errorCode":null,"errorMessage":"Unsupported pad specification [{ctx.getText()}]","messagePattern":"Unsupported pad specification \\[(.+?)\\]","errorType":"exception","errorClass":"ParsingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":5502,"sourceCode":"\t\t\t\tctx.padCharacter() != null\n\t\t\t\t\t\t? visitPadCharacter( ctx.padCharacter() )\n\t\t\t\t\t\t: null;\n\t\treturn getFunctionDescriptor(\"pad\").generateSqmExpression(\n\t\t\t\tpadChar != null\n\t\t\t\t\t\t? asList( source, length, padSpec, padChar )\n\t\t\t\t\t\t: asList( source, length, padSpec ),\n\t\t\t\tnull,\n\t\t\t\tqueryEngine()\n\t\t);\n\t}\n\n\t@Override\n\tpublic SqmTrimSpecification visitPadSpecification(HqlParser.PadSpecificationContext ctx) {\n\t\tfinal var symbol = ((TerminalNode) ctx.getChild( 0 )).getSymbol();\n\t\treturn switch ( symbol.getType() ) {\n\t\t\tcase HqlParser.LEADING -> new SqmTrimSpecification( TrimSpec.LEADING, nodeBuilder() );\n\t\t\tcase HqlParser.TRAILING -> new SqmTrimSpecification( TrimSpec.TRAILING, nodeBuilder() );\n\t\t\tdefault -> throw new ParsingException( \"Unsupported pad specification [\" + ctx.getText() + \"]\" );\n\t\t};\n\t}\n\n\t@Override\n\tpublic SqmLiteral<Character> visitPadCharacter(HqlParser.PadCharacterContext ctx) {\n\t\tfinal String padCharText = ctx.STRING_LITERAL().getText();\n\t\tif ( padCharText.length() != 3 ) {\n\t\t\tthrow new SemanticException( \"Pad character for pad() function must be single character, found '\"\n\t\t\t\t\t+ padCharText + \"'\",\n\t\t\t\t\tquery );\n\t\t}\n\t\treturn new SqmLiteral<>(\n\t\t\t\tpadCharText.charAt( 1 ),\n\t\t\t\tnodeBuilder().getCharacterType(),\n\t\t\t\tnodeBuilder()\n\t\t);\n\t}\n","sourceCodeStart":5484,"sourceCodeEnd":5520,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L5484-L5520","documentation":"Error \"Unsupported pad specification [{ctx.getText()}]\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An invalid keyword/field is used in a datetime, pad, or trim expression: Unsupported pad specification [<value>]","commonSituations":"HQL queries using extract(), pad(), or trim() with a field/specification keyword that is not one of the documented values.","solutions":["The pad specification is not supported. Use LEADING or TRAILING in the pad() function call."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}