dbsrgits / sql-translator

SQL::Translator (SQLFairy)
http://sqlfairy.sourceforge.net/
82 stars 91 forks source link

MySQL Parser understands VIEWs with a field list. #87

Open adherzog opened 7 years ago

adherzog commented 7 years ago

Updates the MySQL parser to properly parse CREATE VIEW statements that contain a field list after the view name. This allows the parser to understand statements created by the MySQL producer.

Prior to this change, this statement would be parsed properly:

CREATE
  VIEW view_foo AS
    SELECT id, name FROM thing;

But this one would not:

CREATE
  VIEW view_foo (id, name) AS
    SELECT id, name FROM thing;

(The latter statement is the same one added to the tests in this PR. It's taken directly from the mysql producer tests.)

adherzog commented 7 years ago

@ilmari Thanks for the review/feedback. I've updated the PR as you requested. Let me know if you seen any other errors or omissions.