sqlfluff / sqlfluff

A modular SQL linter and auto-formatter with support for multiple dialects and templated code.

Home Page:https://www.sqlfluff.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MySQL: error in parsing CALL statement

dudukakz opened this issue Β· comments

Search before asking

  • I searched the issues and found no similar issues.

What Happened

SQLFluff doesn't take into account that routines may be called in the db.routine form https://dev.mysql.com/doc/refman/8.0/en/create-procedure.html . Error occurs while testing CALL db.routine(); SQL requests. Example below.

Expected Behaviour

Successful parsing.

Observed Behaviour

Linter throws an exception.

How to reproduce

$ cat test.sql 
CALL testfunc(123);
CALL testdb.testfunc(123);
$ sqlfluff lint --dialect mysql test.sql
== [test.sql] FAIL                                                                                                                                                                                          
L:   2 | P:   1 |  PRS | Line 2, Position 1: Found unparsable section: 'CALL
                       | testdb.testfunc(123);'
WARNING: Parsing errors found and dialect is set to 'mysql'. Have you configured your dialect correctly?
All Finished πŸ“œ πŸŽ‰!

as you can see, the first line is fine, the second one is considered invalid. Escaping with ticks has no effect.

Dialect

mysql

Version

$sqlfluff --version
sqlfluff, version 3.0.3
$ python3 --version
Python 3.10.12

Configuration

no additional config

Are you willing to work on and submit a PR to address the issue?

  • Yes I am willing to submit a PR!

Code of Conduct