-
Notifications
You must be signed in to change notification settings - Fork 590
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
More bugs when binding insert
with unaligned source schema
#9036
Comments
I don't see a solution under current design and maybe some discussion is needed 🥲, together with #9012 |
Good point. Actually, I think it's okay that we only support a subset of the DML syntax from Postgres. For example, not supporting only providing the values for a prefix of columns. However, it makes no sense that the second statement cannot be executed. 😄 Would you mind issuing a fix for this? |
Yes I'd love to, yet I haven't figured out a way.😭 Can we pad manual |
I think this is a side effect of #8770. This PR actually forced the input schema to be aligned with the table schema (by align I mean the field at corresponding index can be casted), while it shouldn't, if the input is a query rather than values. Above is a failed case while I find one more interesting one: dev=> create table t2 (v1 int, v2 int);
CREATE_TABLE
dev=> insert into t2 values (1, 2);
INSERT 0 1
dev=> insert into t2 (v1) select * from t2;
INSERT 0 1
dev=> select * from t2;
v1 | v2
----+----
1 | 2
1 | 2
(2 rows) |
My idea is that risingwave/src/frontend/src/binder/insert.rs Lines 315 to 326 in 5a61944
values shall be recovered. Do you have any concerns or points to add? @xxchan @broccoliSpicy
|
Actually I'd prefer postpone the logic of padding nulls to the executor and the binder just gives a list of column indices that need to filled with null (or maybe other non-null default value as I'm working on😇). Otherwise I don't see a way to solve the insert from query case. cc. @BugenZhao |
I don't see how schema alignment gets involved here... |
Describe the bug
We may need to better deal with unaligned source and insert schema.
To Reproduce
Expected behavior
The two
insert
should be executed per Postgres.Additional context
No response
The text was updated successfully, but these errors were encountered: