{"record":{"id":"01c06b837eace332","repo":"vitessio/vitess","slug":"only-integer-literals-are-supported","errorCode":null,"errorMessage":"only integer literals are supported","messagePattern":"only integer literals are supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vttablet/tabletserver/vstreamer/planbuilder.go","lineNumber":902,"sourceCode":"\t\t\t// This function is used when transforming datetime\n\t\t\t// values between the source and target.\n\t\t\tcolnum, err := findColumn(plan.Table, aliased.As)\n\t\t\tif err != nil {\n\t\t\t\treturn ColExpr{}, err\n\t\t\t}\n\t\t\tfield := plan.Table.Fields[colnum]\n\t\t\tplan.setColumnFuncExpr(field.Name, inner)\n\t\t\treturn ColExpr{\n\t\t\t\tColNum: colnum,\n\t\t\t\tField:  field,\n\t\t\t}, nil\n\t\tdefault:\n\t\t\treturn ColExpr{}, fmt.Errorf(\"unsupported function: %v\", sqlparser.String(inner))\n\t\t}\n\tcase *sqlparser.Literal:\n\t\t// allow only intval 1\n\t\tif inner.Type != sqlparser.IntVal {\n\t\t\treturn ColExpr{}, errors.New(\"only integer literals are supported\")\n\t\t}\n\t\tnum, err := strconv.ParseInt(string(inner.Val), 0, 64)\n\t\tif err != nil {\n\t\t\treturn ColExpr{}, err\n\t\t}\n\t\tif num != 1 {\n\t\t\treturn ColExpr{}, errors.New(\"only the integer literal 1 is supported\")\n\t\t}\n\t\treturn ColExpr{\n\t\t\tField: &querypb.Field{\n\t\t\t\tName:    \"1\",\n\t\t\t\tType:    querypb.Type_INT64,\n\t\t\t\tCharset: collations.CollationBinaryID,\n\t\t\t\tFlags:   uint32(querypb.MySqlFlag_NOT_NULL_FLAG | querypb.MySqlFlag_NUM_FLAG),\n\t\t\t},\n\t\t\tColNum:     -1,\n\t\t\tFixedValue: sqltypes.NewInt64(num),\n\t\t}, nil","sourceCodeStart":884,"sourceCodeEnd":920,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletserver/vstreamer/planbuilder.go#L884-L920","documentation":"The VReplication planbuilder's analyzeExpr only supports a very restricted WHERE-clause grammar; inside a *sqlparser.Literal case it requires the literal type to be sqlparser.IntVal. Any non-integer literal (string, float, hex) used in the filter's where expression yields \"only integer literals are supported\".","triggerScenarios":"Writing a VReplication filter with a where clause containing a string or other non-integer literal, e.g. where: \"col = 'abc'\" or a float constant, in keyspace/table filters for VStream.","commonSituations":"Users configuring move-tables / resharding filters expecting full SQL where-clause support; copying an SQL WHERE into a VReplication filter's json where field.","solutions":["Rewrite the filter where clause to use only expressions the planbuilder supports (in/equality on columns, integer literals like 1).","Replace string literals with supported constructs, e.g. use in: lists or keyrange-based filters instead of string comparisons.","Filter on the column(s) directly rather than constant literals other than the supported 1."],"exampleFix":"// before\nfilter := \"{\" \"where\": \"col = 'value'\" \"}\" // string literal unsupported\n// after\nfilter := \"{\" \"keyrange\": \"-80\", \"in_keyrange\": true \"}\" // supported filter form","handlingStrategy":"validation","validationCode":"// ensure filter where clause only uses supported expressions\n// allowed: column comparisons / in() with integer literals; the only constant allowed is 1\nif strings.Contains(whereClause, \"'\") { return errors.New(\"string literals are not supported in VReplication filter where\") }","typeGuard":"func isIntLiteral(lit sqlparser.Literal) bool { return lit.Type == sqlparser.IntVal }","tryCatchPattern":"if err := startStream(...); err != nil && strings.Contains(err.Error(), \"only integer literals are supported\") {\n  return fmt.Errorf(\"filter where clause invalid: %w\", err)\n}","preventionTips":["Review the planbuilder grammar before writing custom VReplication filter where clauses.","Prefer keyrange or in() based filters over arbitrary SQL predicates.","Validate filter JSON against supported constructs before applying workflows."],"tags":["vitess","vstreamer","planbuilder","sql-parsing"],"backgroundTag":"unsupported-expression","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}