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

Incorrect results for virtual column in WHERE or ORDER BY #8323

Open
nicktobey opened this issue Sep 4, 2024 · 0 comments
Open

Incorrect results for virtual column in WHERE or ORDER BY #8323

nicktobey opened this issue Sep 4, 2024 · 0 comments
Labels
bug Something isn't working correctness We don't return the same result as MySQL

Comments

@nicktobey
Copy link
Contributor

nicktobey commented Sep 4, 2024

Example 1:

create table test(pk int primary key, j int, value int as (pk*pk));
insert into test(pk, j) values (-1, 1), (2, 1), (-3, 1);
select value from test order by value;

Expected output:

+-------+
| value |
+-------+
| 1     |
| 4     |
| 9     |
+-------+

Actual output:

+-------+
| value |
+-------+
| NULL  |
| NULL  |
| NULL  |
+-------+

Example 2:

create table test(pk int primary key, j int, k int, value int as (pk*pk));
insert into test(pk, j) values (-1, 1, 2), (2, 1, 2), (-3, 1, 2);
select value from test order by value;

Expected output:

+-------+
| value |
+-------+
| 1     |
| 4     |
| 9     |
+-------+

Actual output:
unable to find field with index 2 in row of 2 columns

In both cases, columns j and k are unused, but affect the outcome. If there are no non-virtual value columns, the query behaves correctly. Adding a second virtual column causes queries on both virtual columns to behave correctly.

@timsehn timsehn added bug Something isn't working correctness We don't return the same result as MySQL labels Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctness We don't return the same result as MySQL
Projects
None yet
Development

No branches or pull requests

2 participants