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

Unexpected Result when Querying with CONCAT #7261

Closed
suyZhong opened this issue Jan 5, 2024 · 1 comment · Fixed by dolthub/go-mysql-server#2246
Closed

Unexpected Result when Querying with CONCAT #7261

suyZhong opened this issue Jan 5, 2024 · 1 comment · Fixed by dolthub/go-mysql-server#2246
Labels
analyzer bug Something isn't working correctness We don't return the same result as MySQL customer issue

Comments

@suyZhong
Copy link

suyZhong commented Jan 5, 2024

Considering the test case below:

CREATE TABLE t0(c0 INT, PRIMARY KEY(c0));
INSERT INTO t0 (c0) VALUES (0);

SELECT c0 FROM t0; -- 0
SELECT c0 > (CONCAT(-0.5)) FROM t0; -- 1
SELECT c0 FROM t0 WHERE (c0>(CONCAT(-0.5)));
-- Expected: 0
-- Actual: empty

The third SELECT returns an empty result, which is surprising: If the result of second query is 1 (TRUE), the value of the CONCAT should be less than c0, and thus the third query should return the row in t0.

These test cases works well in MySQL, however not in dolt.

I originally find this by building dolt from source version 2d0a2ed. It could also be reproduced in 1.29.7

@timsehn timsehn added bug Something isn't working analyzer correctness We don't return the same result as MySQL labels Jan 5, 2024
@max-hoffman
Copy link
Contributor

Thanks for the report @suyZhong! @jycor this one is kind of interesting, I thought we standardized the ConvertToBool logic but we must have missed something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer bug Something isn't working correctness We don't return the same result as MySQL customer issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants