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

Dolt Panic when creating view #2980

Closed
avaitla opened this issue Mar 14, 2022 · 3 comments
Closed

Dolt Panic when creating view #2980

avaitla opened this issue Mar 14, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@avaitla
Copy link
Contributor

avaitla commented Mar 14, 2022

 /*!50001 CREATE VIEW `some_view` AS SELECT 1 AS `x`*/
2022-03-14T17:57:09-05:00 ERROR [conn %!d(<nil>)] mysql_server caught panic:
runtime error: slice bounds out of range [54:53]
runtime/panic.go:118 (0x10340f4)
github.com/dolthub/go-mysql-server@v0.11.1-0.20220311194643-f7ae1605f60b/sql/parse/parse.go:1607 (0x1eaa619)
github.com/dolthub/go-mysql-server@v0.11.1-0.20220311194643-f7ae1605f60b/sql/parse/parse.go:861 (0x1ea34fc)
github.com/dolthub/go-mysql-server@v0.11.1-0.20220311194643-f7ae1605f60b/sql/parse/parse.go:178 (0x1e9db4d)
github.com/dolthub/go-mysql-server@v0.11.1-0.20220311194643-f7ae1605f60b/sql/parse/parse.go:136 (0x1e9d53b)
github.com/dolthub/go-mysql-server@v0.11.1-0.20220311194643-f7ae1605f60b/sql/parse/parse.go:95 (0x23278ae)
github.com/dolthub/go-mysql-server@v0.11.1-0.20220311194643-f7ae1605f60b/server/handler.go:287 (0x232784a)
github.com/dolthub/go-mysql-server@v0.11.1-0.20220311194643-f7ae1605f60b/server/handler.go:527 (0x2329ee7)
github.com/dolthub/go-mysql-server@v0.11.1-0.20220311194643-f7ae1605f60b/server/handler.go:149 (0x2326288)
github.com/dolthub/vitess@v0.0.0-20220310224229-3e7f4e04f4a5/go/mysql/conn.go:1286 (0x1500a31)
github.com/dolthub/vitess@v0.0.0-20220310224229-3e7f4e04f4a5/go/mysql/conn.go:930 (0x14fd3d8)
github.com/dolthub/vitess@v0.0.0-20220310224229-3e7f4e04f4a5/go/mysql/server.go:479 (0x1516733)
runtime/asm_amd64.s:1581 (0x106aa60)
@timsehn
Copy link
Contributor

timsehn commented Mar 14, 2022

This has something to do with the comment. This works:

test-comments $ dolt sql -q "CREATE VIEW some_view AS SELECT 1 AS x"
test-comments $ dolt diff
diff --dolt a/dolt_schemas b/dolt_schemas
added table

@zachmu
Copy link
Member

zachmu commented Mar 14, 2022

There's code in the parser that captures the start and end positions of the view definition query in the original query string, and it appears to not work correctly when embedded in a MySQL flag comment. James to investigate.

@fulghum
Copy link
Contributor

fulghum commented Mar 30, 2022

I tested this with the latest code from main and confirmed that Dolt can process this statement correctly now. The next release (later today or tomorrow) will include this fix. Thanks for reporting this one!

@fulghum fulghum closed this as completed Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants