joereynolds / sql-lint

An SQL linter
MIT License
431 stars 41 forks source link

Unable to lint query COMMIT #211

Closed mongeron closed 3 weeks ago

mongeron commented 2 years ago

SQL Lint recognized START TRANSACTION statement properly.

However, COMMIT statement to finish the transaction is not recognized.

joereynolds commented 2 years ago

Can you share the entire query please?

Thanks!

tjstub commented 1 year ago

Since a case wasn't shared, I'll just add my own here since I am running into the same issue and explain my case.

I am trying to lint migration files. A basic migration file looks like so (deploy/migrations/deploy/foo.sql).

-- Deploy proj:foo to mysql

BEGIN;

-- XXX Add DDLs here.

COMMIT;

This empty migration works and It doesn't really matter what is in this file (I have more complex migrations), sql-lint complains with with ticket's title.


>$ sql-lint deploy/migrations/deploy/foo.sql
sql-lint was unable to lint the following query "COMMIT;".This could be a bug with sql-lint. Visit this URL to create a bug report: https://github.com/joereynolds/sql-lint/issues/new?title=Unable%20to%20lint%20query&body=COMMIT;

I hope that helps.

joereynolds commented 3 weeks ago

Hello!

This has been fixed https://github.com/joereynolds/sql-lint/commit/d8d77cfbdab630dd427b4a931d13b0dcd42d4079

It's not been published via NPM yet though.

Thanks and sorry for the very long delay!