risingwavelabs/risingwave · error · ParserError

proctime(), now(), number or string

Error message

proctime(), now(), number or string

What it means

Raised while parsing a temporal filter `FOR SYSTEM_TIME AS OF ...` clause: after AS OF, the parser accepts proctime(), now(), an integer literal, or a single-quoted string; anything else fails `.expect("proctime(), now(), number or string")`. It indicates the AS OF timestamp expression is not one of the supported forms.

Solutions

  1. Replace the expression with one of: `proctime()`, `now()`, an integer timestamp literal, or a single-quoted timestamp string.
  2. Compute complex timestamps in the client and inline them as literals.
  3. Check the AS OF clause is present and not truncated after SYSTEM_TIME.

Example fix

// before
SELECT * FROM t JOIN s FOR SYSTEM_TIME AS OF t.ts;
// after
SELECT * FROM t JOIN s FOR SYSTEM_TIME AS OF '2024-01-01 00:00:00';
Defensive patterns

Strategy: validation

Validate before calling

function validAsOf(expr) {
  return /^(proctime\(\)|now\(\))$/.test(expr) || /^\d+$/.test(expr) || (/^'.*'$/.test(expr));
}

Prevention

When it happens

Trigger: Parsing `... FOR SYSTEM_TIME AS OF <expr>` where expr is a column reference, a function other than proctime()/now(), a double-quoted string, or missing entirely.

Common situations: Joins against a table written with dynamic timestamp expressions from application code; porting temporal-query syntax from other engines; templated SQL where the timestamp placeholder was substituted with an unsupported expression.

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/94dda92dc14fc182. Report an issue: GitHub.

Appendix: source

Thrown at src/sqlparser/src/parser.rs:4508

                        (
                            Self::parse_identifier.verify(|ident| ident.real_value() == "now"),
                            cut_err(Token::LParen),
                            cut_err(Token::RParen),
                        )
                            .value(AsOf::ProcessTimeWithInterval((
                                "0".to_owned(),
                                DateTimeField::Second,
                            ))),
                        (
                            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"

View on GitHub (pinned to 6469eb736d)