risingwavelabs/risingwave · error · ParserError
variable
Error message
variable
What it means
Raised while parsing `SET TIME ZONE <value>`: the value must be a literal (LOCAL/DEFAULT handled earlier, a parsed value, or an identifier); any other token triggers `.expect("variable")`. It reports that the time zone argument is missing or is not a supported value form.
Solutions
- Provide a supported value: `SET TIME ZONE 'UTC'` or an identifier like `SET TIME ZONE UTC`.
- Use LOCAL/DEFAULT keywords if that is the intent: `SET TIME ZONE LOCAL`.
- Check the statement is complete and the zone value's quoting survived templating/shell processing.
Example fix
// before SET TIME ZONE "America/New_York"; // after SET TIME ZONE 'America/New_York';
Defensive patterns
Strategy: try-catch
Validate before calling
function validTimeZoneValue(v) {
return ['LOCAL','DEFAULT'].includes(v.toUpperCase()) || /^[A-Za-z_][A-Za-z0-9_\/+-]*$/.test(v) || (/^'.*'$/.test(v));
} Try / catch
try { run(sql); } catch (e) { if (String(e).includes('variable') && /TIME ZONE/i.test(sql)) { sql = sql.replace(/TIME ZONE\s*$/, "TIME ZONE 'UTC'"); run(sql); } else { throw e; } } Prevention
- Always quote time zone names as single-quoted strings.
- Ensure template placeholders for the zone are non-empty before execution.
- Port INTERVAL-style zone syntax from other engines to a quoted zone name.
When it happens
Trigger: Parsing `SET TIME ZONE <bad>` where the argument is an expression, a double-quoted identifier, a number that is not a valid literal form, or missing (statement ends after ZONE).
Common situations: Session setup scripts ported from other databases (e.g. `SET TIME ZONE INTERVAL '+00:00'` forms); templated SQL where the tz placeholder expanded to nothing; quoting differences losing the zone name.
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/8270c46b1e922631.
Report an issue: GitHub.
Appendix: source
Thrown at src/sqlparser/src/parser.rs:5176
Expr::Value(v) => match v {
Value::Interval { value, .. } => {
if value != "+00:00" {
return Err(StrError("only support \"+00:00\" ".into()));
}
Ok(SetTimeZoneValue::Ident(Ident::with_quote_unchecked(
'\'',
"UTC".to_owned(),
)))
}
_ => Err(StrError("expect Value::Interval".into())),
},
_ => Err(StrError("expect Expr::Value".into())),
})),
),
Self::parse_identifier.map(SetTimeZoneValue::Ident),
Self::ensure_parse_value.map(SetTimeZoneValue::Literal),
))
.expect("variable")
.parse_next(self)?;
Ok(Statement::SetTimeZone {
local: modifier == Some(Keyword::LOCAL),
value,
})
} else if self.parse_keyword(Keyword::CHARACTERISTICS) && modifier == Some(Keyword::SESSION)
{
self.expect_keywords(&[Keyword::AS, Keyword::TRANSACTION])?;
Ok(Statement::SetTransaction {
modes: self.parse_transaction_modes()?,
snapshot: None,
session: true,
})
} else if self.parse_keyword(Keyword::TRANSACTION) && modifier.is_none() {
if self.parse_keyword(Keyword::SNAPSHOT) {
let snapshot_id = self.ensure_parse_value()?;
return Ok(Statement::SetTransaction {View on GitHub (pinned to 6469eb736d)