risingwavelabs/risingwave · error

invalid statement type for alter {alter_target}: {:?}

Error message

invalid statement type for alter {alter_target}: {:?}

What it means

resolve_streaming_job_id_for_alter only handles certain ALTER statement types (e.g. ALTER MATERIALIZED VIEW, ALTER SINK, ALTER TABLE) to resolve the streaming job id. Reaching the catch-all arm means the statement type is not a valid target for this alter operation, so it bails with the target and statement type.

Source

Thrown at src/frontend/src/handler/alter_utils.rs:101

            if !source.info.is_shared() {
                bail_invalid_input_syntax!(
                    "cannot alter {alter_target} of non-shared source.\n\
                     Use `ALTER MATERIALIZED VIEW` to alter the materialized view using the source instead."
                );
            }

            session.check_privilege_for_drop_alter(schema_name, &**source)?;
            source.id.as_share_source_job_id()
        }
        StatementType::ALTER_SINK => {
            let (sink, schema_name) =
                reader.get_any_sink_by_name(db_name, schema_path, &real_table_name)?;

            session.check_privilege_for_drop_alter(schema_name, &**sink)?;
            sink.id.as_job_id()
        }
        _ => bail!(
            "invalid statement type for alter {alter_target}: {:?}",
            alter_stmt_type
        ),
    };

    Ok(job_id)
}

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Issue the alter against a supported object (materialized view, sink, table/index-backed streaming job)
  2. Check the statement type in your SQL and target a streaming job that exists
  3. Upgrade RisingWave if the object type should be supported in newer versions

Example fix

-- before
ALTER INDEX idx SET PARALLELISM 4; -- invalid target
-- after
ALTER MATERIALIZED VIEW mv SET PARALLELISM 4;
Defensive patterns

Strategy: validation

Validate before calling

-- Verify the object is a streaming job before altering parallelism
SELECT name FROM rw_catalog.rw_materialized_views WHERE name = 'mv_name';

Prevention

When it happens

Trigger: Calling ALTER ... PARALLELISM / BACKFILL PARALLELISM / RESOURCE GROUP / SET CONFIG on a statement type not accepted, e.g. ALTER INDEX ... SET PARALLELISM, or mismatched statement routing.

Common situations: Users issuing parallelism or resource-group changes against objects (indexes, sources) that don't support them; SQL parsers accepting syntax for objects the resolver doesn't handle.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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