{"record":{"id":"a50c462304290dec","repo":"Tencent/APIJSON","slug":"column-value-value-expression","errorCode":null,"errorMessage":"@column:value 的 value 中字符串 {expression} 不合法！不允许传超过 100 个字符的函数或表达式！请用 @raw 简化传参！","messagePattern":"@column:value 的 value 中字符串 (.+?) 不合法！不允许传超过 100 个字符的函数或表达式！请用 @raw 简化传参！","errorType":"validation","errorClass":"UnsupportedOperationException","httpStatus":400,"severity":"error","filePath":"APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java","lineNumber":2472,"sourceCode":"\n\t\t\t\tif (containRaw) {  // 由于 HashMap 对 key 做了 hash 处理，所以 get 比 containsValue 更快\n\t\t\t\t\tif (\"\".equals(RAW_MAP.get(expression)) || RAW_MAP.containsValue(expression)) {  // newSQLConfig<T, M, L> 提前处理好的\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// 简单点， 后台配置就带上 AS\n\t\t\t\t\tint index = expression.lastIndexOf(\":\");\n\t\t\t\t\tString alias = expression.substring(index+1);\n\t\t\t\t\tboolean hasAlias = StringUtil.isName(alias);\n\t\t\t\t\tString pre = index > 0 && hasAlias ? expression.substring(0, index) : expression;\n\t\t\t\t\tif (RAW_MAP.containsValue(pre) || \"\".equals(RAW_MAP.get(pre))) {  // newSQLConfig<T, M, L> 提前处理好的\n\t\t\t\t\t\tkeys[i] = pre + (hasAlias ? gainAs() + q + alias + q : \"\");\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (expression.length() > 100) {\n\t\t\t\t\tthrow new UnsupportedOperationException(\"@column:value 的 value 中字符串 \" + expression + \" 不合法！\"\n\t\t\t\t\t\t\t+ \"不允许传超过 100 个字符的函数或表达式！请用 @raw 简化传参！\");\n\t\t\t\t}\n\t\t\t\tkeys[i] = parseSQLExpression(KEY_COLUMN, expression, containRaw, true\n\t\t\t\t\t\t, \"@column:\\\"column0,column1:alias1;function0(arg0,arg1,...);function1(...):alias2...\\\"\");\n\t\t\t}\n\n\t\t\tString c = StringUtil.get(keys);\n\t\t\tc = c + (StringUtil.isEmpty(joinColumn, true) ? \"\" : \", \" + joinColumn);//不能在这里改，后续还要用到:\n\t\t\treturn isMain() && isDistinct() ? PREFIX_DISTINCT + c : c;\n\t\tdefault:\n\t\t\tthrow new UnsupportedOperationException(\n\t\t\t\t\t\"服务器内部错误：getColumnString 不支持 \" + RequestMethod.getName(getMethod())\n\t\t\t\t\t+ \" 等 [GET,GETS,HEAD,HEADS,POST] 外的ReuqestMethod！\"\n\t\t\t\t\t);\n\t\t}\n\t}\n\n\t/**解析@column 中以“;”分隔的表达式（\"@column\":\"expression1;expression2;expression2;....\"）中的expression","sourceCodeStart":2454,"sourceCodeEnd":2490,"githubUrl":"https://github.com/Tencent/APIJSON/blob/5284052872898eddc449a58f629e5c8d588b8e22/APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java#L2454-L2490","documentation":"An UnsupportedOperationException from the GET/GETS branch of gainColumnString: any single ';'-separated expression inside @column:value longer than 100 characters is refused, with the message pointing to @raw as the escape hatch. The limit keeps client-supplied SQL surface small; long expressions must instead be defined server-side and referenced by a short alias.","triggerScenarios":"GET request with a long @column expression such as a deeply nested function call, a long CONCAT(...) chain, or a pasted SQL CASE expression exceeding 100 chars in one ';'-item.","commonSituations":"Frontend assembling formatting expressions dynamically until they grow past the limit; migrating raw SQL views into @column; upgrading APIJSON versions where this hard limit was introduced and previously-working long expressions start failing.","solutions":["Move the long expression into server-side RAW_MAP (e.g. in AbstractSQLConfig or your subclass) under a short key, then use \"@raw\":\"@column\" and put the short key in @column.","Split the expression at ';' into multiple shorter expressions where semantically valid.","Shorten by removing spaces and redundant parts.","If you own the backend, you may raise the limit by patching the length check, but prefer @raw for security."],"exampleFix":"// before\n{\"User\":{\"@column\":\"concat(concat(concat(concat(name,' - '),id),' - '),phone)}}\"}\n// after — server: RAW_MAP.put(\"nameLine\", \"concat(name,' - ',id,' - ',phone)\")\n{\"User\":{\"@column\":\"nameLine\",\"@raw\":\"@column\"}}","handlingStrategy":"validation","validationCode":"const items = (req.User['@column'] || '').split(';');\nif (items.some(i => i.length > 100)) throw new Error('expression too long; use @raw');","typeGuard":"null","tryCatchPattern":"catch UnsupportedOperationException; re-issue request with a @raw alias after backend registers the expression","preventionTips":["Keep client expressions short","Centralize long SQL snippets server-side in RAW_MAP","Watch this limit when upgrading APIJSON versions"],"tags":["apijson","sql","input-validation","length-limit","raw"],"backgroundTag":null,"analyzedSha":"5284052872898eddc449a58f629e5c8d588b8e22","analyzedAt":"2026-08-14T15:15:29.577Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}