Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPDATE subquery panics #19301

Open
xxchan opened this issue Nov 8, 2024 · 2 comments · May be fixed by #19305
Open

UPDATE subquery panics #19301

xxchan opened this issue Nov 8, 2024 · 2 comments · May be fixed by #19305
Labels
type/bug Something isn't working
Milestone

Comments

@xxchan
Copy link
Member

xxchan commented Nov 8, 2024

Describe the bug

No response

Error message/log

No response

To Reproduce

dev=> create table t1(x int, y int);
CREATE_TABLE
dev=> create table t2(x int, y int);
CREATE_TABLE
dev=> update t1 set x = (select x from  (select x,y from t2) as subquery where subquery.y=t1.y)
dev-> ;
ERROR:  Panicked when handling the request: internal error: entered unreachable code: Subquery Subquery { kind: Scalar, query: BoundQuery { body: Select(BoundSelect { distinct: All, select_items: [$0], aliases: [Some("x")], from: Some(Subquery(BoundSubquery { query: BoundQuery { body: Select(BoundSelect { distinct: All, select_items: [$0, $1], aliases: [Some("x"), Some("y")], from: Some(BaseTable(BoundBaseTable { table_id: TableId { table_id: 10 }, table_catalog: TableCatalog { id: TableId { table_id: 10 }, associated_source_id: None, name: "t2", dependent_relations: [], columns: [ColumnCatalog { column_desc: ColumnDesc { data_type: Int32, column_id: #1, name: "x", field_descs: [], type_name: "", generated_or_default_column: None, description: None, additional_column: AdditionalColumn { column_type: None }, version: Pr13707 }, is_hidden: false }, ColumnCatalog { column_desc: ColumnDesc { data_type: Int32, column_id: #2, name: "y", field_descs: [], type_name: "", generated_or_default_column: None, description: None, additional_column: AdditionalColumn { column_type: None }, version: Pr13707 }, is_hidden: false }, ColumnCatalog { column_desc: ColumnDesc { data_type: Serial, column_id: #0, name: "_row_id", field_descs: [], type_name: "", generated_or_default_column: None, description: None, additional_column: AdditionalColumn { column_type: None }, version: Pr13707 }, is_hidden: true }], pk: [$2 ASC], stream_key: [2], table_type: Table, distribution_key: [2], append_only: false, cardinality: Cardinality { lo: 0, hi: Unlimited }, owner: 1, retention_seconds: None, fragment_id: 6, dml_fragment_id: Some(7), vnode_col_index: None, row_id_index: Some(2), value_indices: [0, 1, 2], definition: "CREATE TABLE t2 (x INT, y INT)", conflict_behavior: Overwrite, version_column_index: None, read_prefix_len_hint: 1, version: Some(TableVersion { version_id: 0, next_column_id: #3 }), watermark_columns: FixedBitSet { data: [0], length: 3 }, dist_key_in_pk: [], created_at_epoch: Some(Epoch(7458118959104000)), initialized_at_epoch: Some(Epoch(7458118959104000)), cleaned_by_watermark: false, create_type: Foreground, stream_job_status: Created, description: None, incoming_sinks: [], created_at_cluster_version: Some("PostgreSQL 13.14.0-RisingWave-2.2.0-alpha (unknown)"), initialized_at_cluster_version: Some("PostgreSQL 13.14.0-RisingWave-2.2.0-alpha (unknown)"), cdc_table_id: None, vnode_count: Set(256) }, table_indexes: [], as_of: None })), where_clause: None, group_by: GroupKey([]), having: None, schema: Schema { fields: [x:Int32, y:Int32] } }), order: [], limit: None, offset: None, with_ties: false, extra_order_exprs: [] }, lateral: false })), where_clause: Some(($1 = CorrelatedInputRef { index: 1, correlated_id: 0 })), group_by: GroupKey([]), having: None, schema: Schema { fields: [x:Int32] } }), order: [], limit: None, offset: None, with_ties: false, extra_order_exprs: [] } } has not been unnested
This is a bug. We would appreciate a bug report at:
  https://github.com/risingwavelabs/risingwave/issues/new?labels=type%2Fbug&template=bug_report.yml

Expected behavior

No response

How did you deploy RisingWave?

No response

The version of RisingWave

No response

Additional context

found by customer https://risingwave-labs.slack.com/archives/C07G5HHDU31/p1731033287039829

@xxchan xxchan added the type/bug Something isn't working label Nov 8, 2024
@github-actions github-actions bot added this to the release-2.2 milestone Nov 8, 2024
@chenzl25
Copy link
Contributor

chenzl25 commented Nov 8, 2024

Risingwave doesn't support subquery in the update set lists. Maybe we should detect it and throw an error instead of panic.

@BugenZhao
Copy link
Member

Can be traced back to #2672

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants