risingwavelabs/risingwave · error

Invalid Postgres CDC table name '{}'. Expected 'schema.table

Error message

Invalid Postgres CDC table name '{}'. Expected 'schema.table'.

What it means

The Postgres CDC table-name parser (`parse_postgres_cdc_external_table_name`) walks the string char-by-char supporting double-quoted identifiers; a '.' encountered while `current` is empty (e.g. a leading dot or 'schema..table') is invalid because it would produce an empty identifier segment.

Source

Thrown at src/frontend/src/handler/create_table.rs:1141

    while let Some(ch) = chars.next() {
        if in_quote {
            if ch == '"' {
                if chars.peek() == Some(&'"') {
                    current.push('"');
                    chars.next();
                } else {
                    in_quote = false;
                    just_closed_quote = true;
                }
            } else {
                current.push(ch);
            }
        } else {
            match ch {
                '.' => {
                    if current.is_empty() {
                        return Err(anyhow!(
                            "Invalid Postgres CDC table name '{}'. Expected 'schema.table'.",
                            external_table_name
                        )
                        .into());
                    }
                    parts.push(std::mem::take(&mut current));
                    just_closed_quote = false;
                }
                '"' if current.is_empty() => {
                    in_quote = true;
                }
                '"' => {
                    return Err(anyhow!(
                        "Invalid Postgres CDC table name '{}'. Expected 'schema.table'.",
                        external_table_name
                    )
                    .into());
                }

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Remove empty segments: use exactly one dot between two non-empty identifiers.
  2. If an identifier part starts with a dot by accident (string concat), fix the concatenation.
  3. For quoted identifiers, ensure quotes wrap whole segments: '"my schema".table'.
  4. Verify the final string has the 'schema.table' shape before passing it to RisingWave.

Example fix

// before
let name = format!("{}.{}", schema_or_empty, table); // '.public.users'
// after
assert!(!schema.is_empty());
let name = format!("{}.{}", schema, table); // 'public.users'
Defensive patterns

Strategy: validation

Validate before calling

const segs = name.split('.');
if (segs.some(s => s.length === 0)) throw new Error(`Postgres CDC table name has empty segment: ${name}`);

Type guard

const hasNoEmptySegments = (n) => n.split('.').every(s => s.length > 0);

Prevention

When it happens

Trigger: table_name = '.public.table' or 'public..table' or '".t"' patterns in a postgres-cdc CREATE TABLE option.

Common situations: Templated DDL inserting an empty variable ('{schema}.{table}' with empty schema); accidental extra dot when concatenating schema and table strings.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/7cc11ba340d60552. Report an issue: GitHub.