risingwavelabs/risingwave · error · ParserError
number or string
Error message
number or string
What it means
Raised while parsing a `FOR SYSTEM_VERSION AS OF ...` clause: only an integer literal or a single-quoted string is accepted after AS OF, and `.expect("number or string")` fires otherwise. It reports that the version argument of a system-version query is missing or of an unsupported form.
Solutions
- Provide an integer version number or a single-quoted version string after AS OF, e.g. `AS OF 42` or `AS OF 'v3'`.
- Resolve version expressions in the client and inline the literal.
- Verify the clause is not truncated at the end of the statement.
Example fix
// before SELECT * FROM t FOR SYSTEM_VERSION AS OF CURRENT_VERSION; // after SELECT * FROM t FOR SYSTEM_VERSION AS OF 3;
Defensive patterns
Strategy: validation
Validate before calling
function validVersionAsOf(v) { return /^\d+$/.test(v) || (/^'.*'$/.test(v)); } Prevention
- Resolve version expressions to literals before generating the query.
- Never inject column references or function calls into SYSTEM_VERSION AS OF.
- Guard against empty placeholders in templated time-travel queries.
When it happens
Trigger: Parsing `... FOR SYSTEM_VERSION AS OF <expr>` where expr is a column, a function call, a double-quoted string, or the clause ends immediately after AS OF.
Common situations: Time-travel queries built from application variables that inject expressions instead of literals; dialect porting from engines with different snapshot/version syntax; truncated SQL.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/b8676738fbf06c6c.
Report an issue: GitHub.
Appendix: source
Thrown at src/sqlparser/src/parser.rs:4518
Self::parse_identifier.verify(|ident| ident.real_value() == "proctime"),
cut_err(Token::LParen),
cut_err(Token::RParen),
)
.value(AsOf::ProcessTime),
literal_i64.map(AsOf::TimestampNum),
single_quoted_string.map(AsOf::TimestampString),
))
.expect("proctime(), now(), number or string"),
),
),
preceded(
(Keyword::SYSTEM_VERSION, Keyword::AS, Keyword::OF),
cut_err(
alt((
literal_i64.map(AsOf::VersionNum),
single_quoted_string.map(AsOf::VersionString),
))
.expect("number or string"),
),
),
))
.parse_next(self)
}
/// Parse a possibly qualified, possibly quoted identifier, e.g.
/// `foo` or `myschema."table"
pub fn parse_object_name(&mut self) -> ModalResult<ObjectName> {
let mut idents = vec![];
loop {
idents.push(self.parse_identifier()?);
if !self.consume_token(&Token::Period) {
break;
}
}
Ok(ObjectName(idents))
}View on GitHub (pinned to 6469eb736d)