Difference in behavior between sqlfluff.fix versus running fix on the command line
jjjchens235 opened this issue · comments
Take this SQL code
SELECT CountryId
,Country
FROM dbo.DimCountry dc
WHERE dc.RecordUpdateStamp >= DATE_TRUNC('DAY', DATEADD(D, -1, GETDATE()) );
If you run :CocCommand sqlfluff.fix
none of the issues are fixed.
However, if you run this on the command line sqlfluff fix test_file.sql --force
and then open the file, the errors are fixed.
:CocCommand sqlfluff.fix
works however, if you update the code to any of the following variations prior to running it:
SELECT CountryId
,Country
FROM DimCountry dc
WHERE dc.RecordUpdateStamp >= DATE_TRUNC('DAY', DATEADD(D, -1, GETDATE()) );
SELECT CountryId
,Country
FROM dbo.DimCountry dc
WHERE dc.RecordUpdateStamp
>= DATE_TRUNC('DAY', DATEADD(D, -1, GETDATE()) );
I tried it in my environment, but could not reproduce the problem. :(
coc-sqlfluff-issue7-1.mp4
Thanks for sharing this video, the side by side was really neat. I'm not sure why mine isn't working, but my workaround of targeting only specific rules should do for now, ie
:CocCommand sqlfluff.fix --rules L011,L012
Thanks again for looking into this.