Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix regex parser for parsing functions having SQL body with language sql (PG 15 feature) #2201
Fix regex parser for parsing functions having SQL body with language sql (PG 15 feature) #2201
Changes from 1 commit
860e99a
f4e04a9
80de2d6
ff7fb07
6df033f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the current code will not be covering the below cases:
BEGIN ATOMIC
orEND
being on same line, different line, something on same line and rest on the next line.Posibility of different casing(smallcase, mixed case) used for
BEGIN ATOMIC ... END;
Using regexp here would be right way to go here, given there are N number of posibilities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This automatically works with the current code, added unit test case for that.
Fixed the casing by using the BEGIN ATOMIC with regexp but END with string lower upper both
Not trying to cover a lot of cases given that we should use the pg-parser anyways but having this meanwhile to atleast able to detect the SQL body case for this PR #2165
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt we are going to have pg-parser soon for breaking the sqlfile into sql statements.
Also for oracle cases where syntax is off, (not fully converted to PG), there the parser will fail, so we could either use current approach or mix of both.
I would say lets cover most of it if we can with small efforts.
Since this SQL body thing is a part of DDL, and our import schema can also break.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the SQL BODY, I have tried to cover most of the cases on the PG docs https://www.postgresql.org/docs/11/sql-createfunction.html (fixed one panic in IsEndOFSQL function). The only todo is that I am using the ToLOWER and END for codeDelimiter for SQL where we could use regex but should be okay I think.
do you have any other case in mind that I might be missing?