supabase-community/postgres_lsp

Fix `SourceFileParser` for nested statements

Closed this issue · 0 comments

Right now, the SourceFileParser cuts a sql source into individual statements and comments. These are then passed into the StatementParser.

The lexer is regex-based. Right now, it mainly tries to cut at ;. This approach does not work with nested statements, especially create function statements that contain multiple statements in their parser. Unfortunately, due to upstream limitations, the regular expressions required to exclude ; that are within dollar-quoted strings do not work. We will have to find a way to cut the source into separate statements, even for a source that contain create function statements.