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

sql parser errors #69

Closed
gadumitrachioaiei opened this issue Jul 27, 2014 · 4 comments
Closed

sql parser errors #69

gadumitrachioaiei opened this issue Jul 27, 2014 · 4 comments

Comments

@gadumitrachioaiei
Copy link

I have tried the sqlparser library and I get parsing errors on a few sql queries. Some examples:
DELETE FROM term_hierarchy AS th WHERE th.parent = 1015
Error at position 30: as

SELECT s1 FROM t1 WHERE s1 = ANY (SELECT s1 FROM t2)
Error at position 41: select

DELETE FROM t1, t2 USING t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.id=t2.id AND t2.id=t3.id
Error at position 16: ,

@sougou
Copy link
Contributor

sougou commented Jul 27, 2014

Hi gadumitrachioaiei,
Our initial intent was to only support the most common MySQL constructs. However, we are revisiting that decision. So, it's possible that we may decide to go all the way.
Until then, you'll have to rewrite the queries to a syntax that we support.

If you're trying to reuse the parser for something else, you should be able to fork and add the necessary constructs.
Just to contrast, our sql.y has 990 lines, while https://github.com/twitter/mysql/blob/master/sql/sql_yacc.yy has 14K lines :).
The grammar we use has been heuristically simplified to cover a pretty wide range of what MySQL allows, while still remaining intuitively readable.

PS: Among your suggested constructs, you could easily convince me to extend our grammar to support ANY (and SOME).
The table alias for DMLs is also something that's relatively easy to add.
However, the JOIN on DMLs is something we probably can't support easily due to other dependencies with vitess.

@nightlyone
Copy link

@sougou Not allowing joins has been a (great) design goal of of vitess, AFAIR. Is this design goal still valid?

@sougou
Copy link
Contributor

sougou commented Jul 28, 2014

I'm not sure why you think joins are bad. Can you clarify?

@gadumitrachioaiei
Copy link
Author

Thanks for the explanations. I had the intention of using vitess only for parsing sql queries.

@sougou sougou closed this as completed Jul 30, 2014
JiekerTime pushed a commit to JiekerTime/vitess that referenced this issue Oct 27, 2023
* 1.合并分支

* 1.测试用例 IN

* 1.roll back set WOffset

* 1.fix bind error 2.fix order by 1
ejortegau added a commit to ejortegau/vitess that referenced this issue Dec 15, 2023
… 2 (vitessio#69)

* Skip recalculating the rate in MaxReplicationLagModule when it can't be done

This defends against lag records with nil stats which can lead to segfaults.
See vitessio#12619

Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com>

* Address PR comments.

Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com>

* Make linter happy

Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com>

* Add support for criticality query directive, and have TxThrottler respect that

Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com>

* Remove unused variable

Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com>

* Fix CI pipeline

Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>

* Address PR comments.

Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com>

* Make linter happy & add extra test cases.

Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com>

* Address PR comments.

Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com>

* Fix circular import

Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com>

* Make linter happy

Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com>

* Address PR comments:

* Invalid criticality in query directive fails the query.

Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com>

* Fix executor.go

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>

* Fix go/vt/vtgate/executor.go again

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>

* Fix TestNewMaxReplicationLagModule_recalculateRate

* Fix go/vt/vtgate/executor_test.go

* Regen protos from linux

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>

---------

Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Co-authored-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants