joereynolds / joereynolds/sql-lint

Error: Unable to categorise query: $$;

Open
#154 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
459
Forks
44
PR merge metrics
No merged PRs in 30d

Description

It seems that sql-lint is unable to parse SQL functions.

example.sql:
```
create function xor (a boolean, b boolean)
returns boolean
immutable language sql
as $$
select (a and not b) or (b and not a);
$$;
```

```
$ sql-lint -d postgres -v example.sql
node_modules/sql-lint/dist/src/lexer/lexer.js:13
throw new Error(`Unable to categorise query: ${query}. The query must start with one of ${Object.keys(keywords_1.Keyword)}`);
^

Error: Unable to categorise query: $$;. The query must start with one of Alter,Begin,Call,Create,Declare,Delete,Delimiter,Drop,Else,End,From,Having,If,Insert,Join,Leave,Limit,Replace,Return,Select,Set,Show,Truncate,Update,Use,Where,CommentHash,CommentDash,CommentMultiLineStart,CommentMultiLineEnd,Newline,WindowsNewline
at Object.categorise (node_modules/sql-lint/dist/src/lexer/lexer.js:13:11)
atnode_modules/sql-lint/dist/src/checker/checkerRunner.js:37:42
at Array.forEach ()
at CheckerRunner.run (node_modules/sql-lint/dist/src/checker/checkerRunner.js:34:20)
at Object. (node_modules/sql-lint/dist/src/main.js:85:8)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.