{"record":{"id":"d2da5b30e6eff66e","repo":"risingwavelabs/risingwave","slug":"alter-sink-rate-limit-is-not-for-sink-into-table","errorCode":null,"errorMessage":"ALTER SINK_RATE_LIMIT is not for sink into table","messagePattern":"ALTER SINK_RATE_LIMIT is not for sink into table","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/frontend/src/handler/alter_streaming_rate_limit.rs","lineNumber":117,"sourceCode":"        }\n        (PbThrottleTarget::Table, PbThrottleType::Backfill) => {\n            let reader = session.env().catalog_reader().read_guard();\n            let table =\n                check_table_mismatch(&reader, &session, db_name, schema_path, &real_table_name)?;\n            if table.cdc_table_type.is_none() {\n                return Err(ErrorCode::InvalidInputSyntax(format!(\n                    \"\\\"{table_name}\\\" is not a CDC table\",\n                ))\n                .into());\n            }\n            (StatementType::ALTER_TABLE, table.id.as_raw_id())\n        }\n        (PbThrottleTarget::Sink, PbThrottleType::Sink) => {\n            let reader = session.env().catalog_reader().read_guard();\n            let (sink, schema_name) =\n                reader.get_any_sink_by_name(db_name, schema_path, &real_table_name)?;\n            if sink.target_table.is_some() {\n                bail!(\"ALTER SINK_RATE_LIMIT is not for sink into table\")\n            }\n            session.check_privilege_for_drop_alter(schema_name, &**sink)?;\n            (StatementType::ALTER_SINK, sink.id.as_raw_id())\n        }\n        (PbThrottleTarget::Sink, PbThrottleType::Backfill) => {\n            let reader = session.env().catalog_reader().read_guard();\n            let (sink, schema_name) =\n                reader.get_any_sink_by_name(db_name, schema_path, &real_table_name)?;\n            session.check_privilege_for_drop_alter(schema_name, &**sink)?;\n            (StatementType::ALTER_SINK, sink.id.as_raw_id())\n        }\n        _ => bail!(\n            \"Unsupported throttle target: {:?} and throttle type: {:?}\",\n            throttle_target,\n            throttle_type\n        ),\n    };\n    execute_with_long_running_notification(","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/frontend/src/handler/alter_streaming_rate_limit.rs#L99-L135","documentation":"`ALTER SINK ... SINK_RATE_LIMIT` throttles the sink's own egress writing to an external system. When the sink's target is another RisingWave table (sink.target_table is Some), its downstream is internal and does not use the external sink writer path that this throttle controls, so the handler rejects it.","triggerScenarios":"Running `ALTER SINK s SINK_RATE_LIMIT ...` where s is a sink created with `INTO table_name` (sink into table), i.e. sink.target_table is set, in handle_alter_streaming_rate_limit.","commonSituations":"Applying sink egress throttling to an internal table sink, e.g. to stage data into a table before external export; scripts that enumerate all sinks and apply SINK_RATE_LIMIT uniformly without checking the sink target type.","solutions":["Use `ALTER SINK s BACKFILL_RATE_LIMIT ...` or adjust throttling on the target table instead (e.g. DML rate limit on the target table).","Only apply SINK_RATE_LIMIT to external sinks (Kafka, etc.) that do not target a table.","If throttling the internal write is required, throttle the target table's DML rate limit rather than the sink."],"exampleFix":"// before\nALTER SINK table_sink SINK_RATE_LIMIT 100;\n// after\nALTER TABLE table_sink DML_RATE_LIMIT 100;","handlingStrategy":"validation","validationCode":"-- Skip sinks that target a table before applying SINK_RATE_LIMIT:\nSELECT name, target_table\nFROM rw_catalog.rw_sinks\nWHERE name = 'my_sink';\n-- If target_table IS NOT NULL, throttle the target table's DML rate limit instead.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["SINK_RATE_LIMIT applies only to external sinks; internal (INTO table) sinks are out of scope.","Check the sink's target_table column in rw_sinks before applying the throttle.","For table sinks, use ALTER TABLE ... DML_RATE_LIMIT on the target table instead."],"tags":["risingwave","sql","rate-limit","sink","invalid-target"],"backgroundTag":"invalid-argument-value","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}