News for hackers. Stuff that matters.
Re:Sqlfluff the SQL Linter for Humans by ErunamoJAZZ on Wednesday October 06, 2021 @10:17AM (#28773473)
I wanted to use this linter, but they don't support many things that are used in real production code. By example, a simple postgres function like this one can't be parsed:

  CREATE OR REPLACE FUNCTION public.setof_test()
   RETURNS SETOF text
   LANGUAGE sql
   STABLE STRICT
  AS $function$
    select unnest(array['hi', 'test'])
  $function$
  ;
Re:Sqlfluff the SQL Linter for Humans by munro on Wednesday October 06, 2021 @11:24AM (#28774255)
The code looks really great [1], very declarative, looks like it should be pretty easy to add better PostgreSQL support. I also wonder if how easy it would be to plug it into VS Code, and build in an auto formatter (♥ω♥ ). At a glance it looks like it's parsing AST, which is really hard to find for SQL, so auto formatter could be possible to build from this. I notice SQLite could use some improving too, seems like a great project to coalesce around.

[1] https://github.com/sqlfluff/sqlfluff/blob/main/src/sqlfluff/...

Re:Sqlfluff the SQL Linter for Humans by amshank on Wednesday October 06, 2021 @11:36AM (#28774399)
Auto-formatter is already built in for some simple violations: https://docs.sqlfluff.com/en/stable/cli.html#sqlfluff-fix
Re:Sqlfluff the SQL Linter for Humans by tunetheweb on Wednesday October 06, 2021 @02:11PM (#28776289)
Re:Sqlfluff the SQL Linter for Humans by tunetheweb on Wednesday October 06, 2021 @01:19PM (#28775694)
Looks like we didn't support SETOF.

Added this here: https://github.com/sqlfluff/sqlfluff/pull/1522

Demonstrating how easy it is to add this sort of thing to the project thanks to how the code is structured! :-)

Re:Sqlfluff the SQL Linter for Humans by munk-a on Wednesday October 06, 2021 @01:03PM (#28775480)
I really personally dislike how you fail to shout the keywords in the above function "that actually matter" - all the set dressing and obvious stuff is capitalized - but then the meat of the function is all in lowercase hiding in the middle.