Skip to content

LEFT JOIN works wrong #852

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

Closed
zurk opened this issue Jun 4, 2019 · 1 comment · Fixed by #847
Closed

LEFT JOIN works wrong #852

zurk opened this issue Jun 4, 2019 · 1 comment · Fixed by #847
Assignees
Labels
blocked Some other issue is blocking this bug Something isn't working

Comments

@zurk
Copy link

zurk commented Jun 4, 2019

using last gitbase v0.20.0 and v0.20.0-demo1 too I am trying to execute the following query:

SELECT COUNT(*)
FROM repositories
LEFT JOIN (
    SELECT repository_id, commit_hash
    FROM refs
    WHERE ref_name = "refs/heads/master"
) q ON repositories.repository_id = q.repository_id 

I filter by ref_name so I expect to get the number not more than rows in repositories table, but I get much more. Here is my output:

Result
+----------------+----------------+------------------------------------------+
| repository_id  | repository_id  | commit_hash                              |
+----------------+----------------+------------------------------------------+
| lookout        | lookout        | ce3a0851d061ade416d33d00bc94b086fadd0f40 |
| lookout        |                |                                          |
| lookout        |                |                                          |
| lookout        |                |                                          |
| lookout        |                |                                          |
| lookout        |                |                                          |
| lookout        |                |                                          |
| lookout        |                |                                          |
| lookout        |                |                                          |
| lookout        |                |                                          |
| lookout        |                |                                          |
| lookout        |                |                                          |
| apollo         |                |                                          |
| apollo         | apollo         | 89fd232ff250f1500ba88d4066531a47f0726aca |
| apollo         |                |                                          |
| apollo         |                |                                          |
| apollo         |                |                                          |
| apollo         |                |                                          |
| apollo         |                |                                          |
| apollo         |                |                                          |
| apollo         |                |                                          |
| apollo         |                |                                          |
| apollo         |                |                                          |
| apollo         |                |                                          |
| lookout-sdk    |                |                                          |
| lookout-sdk    |                |                                          |
| lookout-sdk    | lookout-sdk    | 16c3f752a712574f492c922cab897aa5b3709d9d |
| lookout-sdk    |                |                                          |
| lookout-sdk    |                |                                          |
| lookout-sdk    |                |                                          |
| lookout-sdk    |                |                                          |
| lookout-sdk    |                |                                          |
| lookout-sdk    |                |                                          |
| lookout-sdk    |                |                                          |
| lookout-sdk    |                |                                          |
| lookout-sdk    |                |                                          |
| lookout-sdk-ml |                |                                          |
| lookout-sdk-ml |                |                                          |
| lookout-sdk-ml |                |                                          |
| lookout-sdk-ml | lookout-sdk-ml | cfedddaadf0acb4851a7b788467a3727343d7456 |
| lookout-sdk-ml |                |                                          |
| lookout-sdk-ml |                |                                          |
| lookout-sdk-ml |                |                                          |
| lookout-sdk-ml |                |                                          |
| lookout-sdk-ml |                |                                          |
| lookout-sdk-ml |                |                                          |
| lookout-sdk-ml |                |                                          |
| lookout-sdk-ml |                |                                          |
| meteor         |                |                                          |
| meteor         |                |                                          |
| meteor         |                |                                          |
| meteor         |                |                                          |
| meteor         |                |                                          |
| meteor         |                |                                          |
| meteor         |                |                                          |
| meteor         |                |                                          |
| meteor         |                |                                          |
| meteor         |                |                                          |
| meteor         |                |                                          |
| meteor         | meteor         | 38c1e5c7d6747a282312ed69626b762040a15e75 |
| minutes        |                |                                          |
| minutes        |                |                                          |
| minutes        |                |                                          |
| minutes        |                |                                          |
| minutes        | minutes        | ee25389ed171820485747e31170f5470b7b43604 |
| minutes        |                |                                          |
| minutes        |                |                                          |
| minutes        |                |                                          |
| minutes        |                |                                          |
| minutes        |                |                                          |
| minutes        |                |                                          |
| minutes        |                |                                          |
| ml             |                |                                          |
| ml             |                |                                          |
| ml             |                |                                          |
| ml             |                |                                          |
| ml             |                |                                          |
| ml             | ml             | aee649edfb0c53ede2346e7180e014679caf0656 |
| ml             |                |                                          |
| ml             |                |                                          |
| ml             |                |                                          |
| ml             |                |                                          |
| ml             |                |                                          |
| ml             |                |                                          |
| ml-core        |                |                                          |
| ml-core        |                |                                          |
| ml-core        |                |                                          |
| ml-core        |                |                                          |
| ml-core        |                |                                          |
| ml-core        |                |                                          |
| ml-core        | ml-core        | b2daa138531e9f8da8c76c62f9841190c52396bb |
| ml-core        |                |                                          |
| ml-core        |                |                                          |
| ml-core        |                |                                          |
| ml-core        |                |                                          |
| ml-core        |                |                                          |
| style-analyzer |                |                                          |
| style-analyzer |                |                                          |
| style-analyzer |                |                                          |
| style-analyzer |                |                                          |
| style-analyzer |                |                                          |
| style-analyzer |                |                                          |
| style-analyzer |                |                                          |
| style-analyzer |                |                                          |
| style-analyzer | style-analyzer | 206cb5c1e923dc7a5217a88f68107e52ea5b967c |
| style-analyzer |                |                                          |
| style-analyzer |                |                                          |
| style-analyzer |                |                                          |
| modelforge     |                |                                          |
| modelforge     |                |                                          |
| modelforge     |                |                                          |
| modelforge     |                |                                          |
| modelforge     |                |                                          |
| modelforge     |                |                                          |
| modelforge     |                |                                          |
| modelforge     | modelforge     | bb3b722e2e8178c15bbd86e710bf40fda41927d1 |
| modelforge     |                |                                          |
| modelforge     |                |                                          |
| modelforge     |                |                                          |
| modelforge     |                |                                          |
| tmsc           |                |                                          |
| tmsc           |                |                                          |
| tmsc           |                |                                          |
| tmsc           |                |                                          |
| tmsc           |                |                                          |
| tmsc           |                |                                          |
| tmsc           |                |                                          |
| tmsc           |                |                                          |
| tmsc           |                |                                          |
| tmsc           | tmsc           | f236aa8d61a89cdc48ee5f884da3bbf5a2b7890f |
| tmsc           |                |                                          |
| tmsc           |                |                                          |
| vecino         |                |                                          |
| vecino         |                |                                          |
| vecino         |                |                                          |
| vecino         |                |                                          |
| vecino         |                |                                          |
| vecino         |                |                                          |
| vecino         |                |                                          |
| vecino         |                |                                          |
| vecino         |                |                                          |
| vecino         |                |                                          |
| vecino         | vecino         | e21973a5de73e982feaed6c94181481986a3e94e |
| vecino         |                |                                          |
+----------------+----------------+------------------------------------------+
144 rows in set (3.00 sec)  
`SELECT * FROM repositories` Gives
+----------------+
| repository_id  |
+----------------+
| lookout        |
| apollo         |
| lookout-sdk    |
| lookout-sdk-ml |
| meteor         |
| minutes        |
| ml             |
| modelforge     |
| ml-core        |
| style-analyzer |
| tmsc           |
| vecino         |
+----------------+
12 rows in set (0.04 sec)

So I get 12*12 rows for some reason.

@ajnavarro ajnavarro added bug Something isn't working question Further information is requested labels Jun 4, 2019
@erizocosmico erizocosmico self-assigned this Jun 4, 2019
@erizocosmico erizocosmico removed the question Further information is requested label Jun 4, 2019
@erizocosmico erizocosmico added the blocked Some other issue is blocking this label Jun 4, 2019
@erizocosmico
Copy link
Contributor

erizocosmico commented Jun 4, 2019

Will be fixed once src-d/go-mysql-server#742 is merged and go-mysql-server updated here. Will keep the issue open until then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Some other issue is blocking this bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants