{"record":{"id":"8f0707e8168ee8a1","repo":"risingwavelabs/risingwave","slug":"system-table-has-no-unaligned-join","errorCode":null,"errorMessage":"system table has no unaligned_join","messagePattern":"system table has no unaligned_join","errorType":"error_code","errorClass":"NotSupported","httpStatus":null,"severity":"error","filePath":"src/frontend/src/handler/alter_streaming_enable_unaligned_join.rs","lineNumber":50,"sourceCode":"            let mut binder = Binder::new_for_system(&session);\n            Binder::validate_cross_db_reference(&session.database(), &name)?;\n            let not_found_err = CatalogError::not_found(\"stream job\", name.to_string());\n\n            if let Ok(relation) = binder.bind_catalog_relation_by_object_name(&name, true) {\n                match relation {\n                    Relation::Source(s) => {\n                        if s.is_shared() {\n                            s.catalog.id.as_share_source_job_id()\n                        } else {\n                            bail!(ErrorCode::NotSupported(\n                                \"source has no unaligned_join\".to_owned(),\n                                \"Please only target materialized views or sinks\".to_owned(),\n                            ));\n                        }\n                    }\n                    Relation::BaseTable(t) => t.table_catalog.id.as_job_id(),\n                    Relation::SystemTable(_t) => {\n                        bail!(ErrorCode::NotSupported(\n                            \"system table has no unaligned_join\".to_owned(),\n                            \"Please only target materialized views or sinks\".to_owned(),\n                        ));\n                    }\n                    Relation::Share(_s) => {\n                        bail!(ErrorCode::NotSupported(\n                            \"view has no unaligned_join\".to_owned(),\n                            \"Please only target materialized views or sinks\".to_owned(),\n                        ));\n                    }\n                    _ => {\n                        // Other relation types (Subquery, Join, etc.) are not directly describable.\n                        return Err(not_found_err.into());\n                    }\n                }\n            } else if let Ok(sink) = binder.bind_sink_by_name(name.clone()) {\n                sink.sink_catalog.id.as_job_id()\n            } else {","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/frontend/src/handler/alter_streaming_enable_unaligned_join.rs#L32-L68","documentation":"ALTER STREAMING ENABLE UNALIGNED JOIN can only be applied to stream jobs that have a sync log store job id (materialized views, sinks, tables, shared sources). System tables (e.g. pg_* / rw_* internal catalogs) are not streaming jobs, so the handler bails with a NotSupported error before touching the meta client. The library throws it to prevent meaningless ALTER calls on read-only catalog relations.","triggerScenarios":"Running `ALTER STREAMING ... ENABLE|DISABLE UNALIGNED JOIN` naming a system table such as `pg_catalog.pg_tables` or any `rw_*` internal catalog relation, which binds to Relation::SystemTable in handle_alter_streaming_enable_unaligned_join.","commonSituations":"Scripts that iterate over all relations in a schema (including system catalogs) and blindly apply the ALTER; autocomplete or ORM-generated DDL that resolved an unqualified name to a system table; typos that accidentally match a catalog name in a search_path.","solutions":["Target a materialized view, sink, table, or shared source instead of a system table.","Fully qualify the object name (e.g. my_schema.my_mv) so search_path does not resolve it to a system catalog.","Filter system/catalog relations out of any batch script before issuing the ALTER."],"exampleFix":"// before\nALTER STREAMING ENABLE UNALIGNED JOIN pg_catalog.pg_tables;\n// after\nALTER STREAMING ENABLE UNALIGNED JOIN my_schema.my_mv;","handlingStrategy":"validation","validationCode":"-- Check the relation type before altering:\nSELECT relation_type FROM rw_catalog.rw_relations WHERE name = 'my_rel';\n-- Only proceed if relation_type IN ('materialized-view','sink','table');\n-- System tables live in pg_catalog / rw_catalog and must be excluded.","typeGuard":"// Rust-side narrowing before invoking the handler\nfn is_alterable(relation: &Relation) -> bool {\n    matches!(relation, Relation::Source(s) if s.is_shared())\n        || matches!(relation, Relation::BaseTable(_))\n}","tryCatchPattern":null,"preventionTips":["Exclude pg_catalog/rw_catalog schemas from batch ALTER scripts.","Fully qualify relation names to avoid search_path surprises.","Check the relation type with rw_relations (or SHOW / DESCRIBE) before ALTER."],"tags":["risingwave","sql","not-supported","system-table"],"backgroundTag":"unsupported-operation","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"}