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

Fix insert select planner crash #7912

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

c2main
Copy link
Contributor

@c2main c2main commented Feb 27, 2025

The following query was crashing the backend:

INSERT INTO field_indirection_test_1 (
  int_col, ct1_col.int_1,ct1_col.int_2
) SELECT 0, 1, 2;
-- crash

En passant, added more tests with sublink in distributed_types and found another query with wrong behavior:

INSERT INTO domain_indirection_test (f1,f3.if1) SELECT 0, 1;
ERROR:  could not find a conversion path from type 23 to 17619
-- not the expected ERROR

Fixed them by using strip_implicit_coercions() on target entry expression before checking for the presence of a subscript or fieldstore, else we fail to find the existing ones and wrongly accept to execute unsafe query.

The following query was crashing the backend:

```
INSERT INTO field_indirection_test_1 (
  int_col, ct1_col.int_1,ct1_col.int_2
) SELECT 0, 1, 2;
-- crash
```

En passant, added more tests with sublink in distributed_types and found another
query with wrong behavior:

```
INSERT INTO domain_indirection_test (f1,f3.if1) SELECT 0, 1;
ERROR:  could not find a conversion path from type 23 to 17619
-- not the expected ERROR
```

Fixed them by using strip_implicit_coercions() on target entry expression
before checking for the presence of a subscript or fieldstore, else we
fail to find the existing ones and wrongly accept to execute unsafe
query.
Fixing complaints from CI.
VALUES() is more flexible now (does not require an alias)
It is ok now, but I didn't bissect to known when it was fixed precisely.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant