Skip to content

Commit 2fa6457

Browse files
authored
Merge pull request #654 from kuba--/fix-651/join-panic
Fix natural join panic for subqueries
2 parents 69d7d2e + 60a4914 commit 2fa6457

File tree

10 files changed

+89
-8
lines changed

10 files changed

+89
-8
lines changed

Gopkg.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[[constraint]]
22
name = "gopkg.in/src-d/go-mysql-server.v0"
3-
revision = "12091f663c6224024dd4b3c10d2a8c1349f046d4"
3+
revision = "b8d84bffc83447b4f8f283e07b4ef2b97c4b22e3"
44

55
[[constraint]]
66
name = "github.com/jessevdk/go-flags"

docs/using-gitbase/functions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,4 @@ Also, if you want to retrieve values from a non common property, you can pass it
9595
9696
## Standard functions
9797

98-
You can check standard functions in [`go-mysql-server` documentation](https://github.com/src-d/go-mysql-server/tree/12091f663c6224024dd4b3c10d2a8c1349f046d4#custom-functions).
98+
You can check standard functions in [`go-mysql-server` documentation](https://github.com/src-d/go-mysql-server/tree/b8d84bffc83447b4f8f283e07b4ef2b97c4b22e3#custom-functions).

docs/using-gitbase/indexes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ and for the second query also two indexes will be used and the result will be a
2626

2727
You can find some more examples in the [examples](./examples.md#create-an-index-for-columns-on-a-table) section.
2828

29-
See [go-mysql-server](https://github.com/src-d/go-mysql-server/tree/12091f663c6224024dd4b3c10d2a8c1349f046d4#indexes) documentation for more details
29+
See [go-mysql-server](https://github.com/src-d/go-mysql-server/tree/b8d84bffc83447b4f8f283e07b4ef2b97c4b22e3#indexes) documentation for more details
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
## Supported clients
22

3-
To see the supported MySQL clients and examples about how to use them, take a look [here](https://github.com/src-d/go-mysql-server/blob/12091f663c6224024dd4b3c10d2a8c1349f046d4/SUPPORTED_CLIENTS.md).
3+
To see the supported MySQL clients and examples about how to use them, take a look [here](https://github.com/src-d/go-mysql-server/blob/b8d84bffc83447b4f8f283e07b4ef2b97c4b22e3/SUPPORTED_CLIENTS.md).
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
## Supported syntax
22

3-
To see the SQL subset currently supported take a look at [this list](https://github.com/src-d/go-mysql-server/blob/12091f663c6224024dd4b3c10d2a8c1349f046d4/SUPPORTED.md) from [src-d/go-mysql-server](https://github.com/src-d/go-mysql-server).
3+
To see the SQL subset currently supported take a look at [this list](https://github.com/src-d/go-mysql-server/blob/b8d84bffc83447b4f8f283e07b4ef2b97c4b22e3/SUPPORTED.md) from [src-d/go-mysql-server](https://github.com/src-d/go-mysql-server).

integration_test.go

+19
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,25 @@ func TestIntegration(t *testing.T) {
243243
{"go/example.go", int32(1)},
244244
},
245245
},
246+
{
247+
`
248+
SELECT language, COUNT(repository_id) AS repository_count
249+
FROM (
250+
SELECT DISTINCT r.repository_id, LANGUAGE(t.tree_entry_name, b.blob_content) AS language
251+
FROM refs r
252+
JOIN commits c ON r.commit_hash = c.commit_hash
253+
NATURAL JOIN commit_trees
254+
NATURAL JOIN tree_entries t
255+
NATURAL JOIN blobs b
256+
WHERE language IS NOT NULL
257+
) AS q1
258+
GROUP BY language
259+
ORDER BY repository_count DESC
260+
`,
261+
[]sql.Row{
262+
{"Text", int32(1)},
263+
},
264+
},
246265
}
247266

248267
runTests := func(t *testing.T) {

vendor/gopkg.in/src-d/go-mysql-server.v0/sql/analyzer/optimization_rules.go

+24-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/gopkg.in/src-d/go-mysql-server.v0/sql/expression/function/registry.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/gopkg.in/src-d/go-mysql-server.v0/sql/expression/function/time.go

+38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)