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
SimpleSQLGrammar issue with anti slashes at the end of simple quoted string #5854
Comments
I've got some other things I have to look into and get sorted, but I will try to take a look at this as well. I'm also having some issues with my setup right now so I can't do this, but it might be worth doing a quick test of chging the definition of |
No it breaks some tests:
|
Ah, yup, that makes sense. The grammar was designed to think If you need a work around in the meantime @jgarec , you can switch your strings to use the oracle q quoting syntax since it will move the insert into MY_TABLE(MY_COLUMN) values(q'[\D:\]');insert into MY_TABLE(MY_COLUMN) values(q'[D:\]'); Basically, the first Not ideal having to change your code, but wanted to at least provide a work around if you need one! |
Hi @jgarec and @jasonlyle88, thank you for reporting this issue and for the insightful discussion. For MySQL, For Oracle, the error is not with the escaped character, but with the statements not being split. Running the generated @jgarec I see that you're willing to submit a PR. Feel free to do so, and you can ask any questions you may have to our development team. Please include some test cases to verify that the fix doesn't break for other DBs - the 4 I mentioned above would be enough to begin with. Thank you! |
Hello @tati-qalified, yes I was interested to submit a PR but I think it's too complicated for me to fix this. |
Hey @tati-qalified , Unfortunately, the problem is more nuanced than your observations. If you take a look at the
So MySQL can accept that as a way to escape a single quote (or not) depending on a setting for the database. Unfortunately syntax highlighting isn't a good indicator here. And while you are correct that the Oracle error being presented is because the statements are not split correctly, you are actually addressing a symptom (the failure to split the statement correctly), and not the root cause. The root cause here is that the parsing engine is not considering the first This can be seen if you add @jgarec 's example to the unit tests in the For all of these reasons, this is why I suggested the core liquibase team needs to get involved here to decide on a course of action. While the easiest solution is to say that the The more correct, yet more complicated to implement solution, is a grammar that is DBMS aware as I stated above and @jgarec believes may be necessary as well based on his response. But how should this be implemented? Should it be a generic grammar that has overrides just for specific DBMS systems? or should it be fully defined grammars for each DBMS? Or a generic grammar that is used for all DBMS systems unless a full grammar is specifically created for a given DBMS? With the grammar being a very core part of liquibase, these decisions can have long standing impacts on the product going forward. And while I have worked on this section of the code previously, I am not comfortable making a decision about what could be potentially such a large impact on the product as a whole. Because of all these reasons, I'd love for the team to have some discussion here and additionally I don't believe the Let me know if there are any further questions or concerns! |
@jasonlyle88 thank you for your feedback. Firstly I want to reassure you that the
Yes, I was presenting the problems with the output, that are caused by the bug, as it is a blocker for Oracle. I've found it's useful to mention what databases are affected and how. I apologize if my comment wasn't clear. Usually the technical details about the fix are discussed in the submitted PR, though I understand if in this case it should happen before submitting it. Our development team is aware of this issue and willing to discuss it further. Let me know if you have any other questions or concerns. Thank you, |
Search first
Description
Multiple SQL statements with anti slashes In simple quoted string are not splitted as expected.
Steps To Reproduce
Considering this simple sql file :
and this changeset :
Liquibase won't split the 2 statements. It seems not to be a problem for postgresql but it fails for Oracle :
ORA-00933: SQL command not properly ended
Expected/Desired Behavior
Multiple statements splitted correctly
Liquibase Version
4.27.0
Database Vendor & Version
Oracle
Liquibase Integration
cli
Liquibase Extensions
No response
OS and/or Infrastructure Type/Provider
No response
Additional Context
UpdateSQL log shows a block of multiple statements :
Trying to do some debug, here is the result of the parser :
If I remove one specific anti slash, it's ok :
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: