-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Quote CONDITION whenever necessary for JDBC #3687
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
Quote CONDITION whenever necessary for JDBC #3687
Conversation
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 fixed a few typos in the migration guide.
| + " values (?, ?, 0, 0, ?, ?)"), | ||
|
|
||
| UPDATE_MESSAGE_GROUP("UPDATE %PREFIX%MESSAGE_GROUP set UPDATED_DATE=?, CONDITION=? " + | ||
| UPDATE_MESSAGE_GROUP("UPDATE %PREFIX%MESSAGE_GROUP set UPDATED_DATE=?, GROUP_CONDITION=? " + |
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 is a big breaking change in a point release; I think it's ok to change the scripts but I think this code needs to be made conditional on a property (defaulting to CONDITION in the point release and GROUP_CONDITION in 6.0).
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.
OK. How about to make it "smart" conditional: based on vendor derived from the provided DataSource?
All those which have this condition as a reserved word are not going to work anyway.
So, we change the word exactly in their scripts and check for them in the JdbcMessageStore.
This way we would leave the rest of supported vendors working as before this change.
|
I have reproduced the issue with MySQL under Testcontainers: This fixes the problem: Now looking for the possible fix in the rest of scripts and |
7dd07c3 to
7cc9ff4
Compare
SO: https://stackoverflow.com/questions/70286480/how-can-spring-integration-5-5-x-use-mysql-as-message-store Turns out the condition word is reserved in many SQL DB vendors, e.g.: https://dev.mysql.com/doc/refman/8.0/en/keywords.html * Fix SQL scripts for quoting `CONDITION` column name for those vendors which have it as a reserved word * Fix `JdbcMessageStore` to have a `CONDITION` quoted to `""` by default and replaced to "`" for MySQL * Add `MySqlContainerTest` to test against MySQL Docker container * Looks like quoted identifiers work well even if they are not reserved words in the SQL vendor
7cc9ff4 to
f712be5
Compare
CONDITION to GROUP_CONDITION|
Pushed the fix which is more flexible according the current state of things:
|
SO: https://stackoverflow.com/questions/70286480/how-can-spring-integration-5-5-x-use-mysql-as-message-store
Turns out the condition word is reserved in many SQL DB vendors, e.g.:
https://dev.mysql.com/doc/refman/8.0/en/keywords.html
CONDITIONcolumn name forthose vendors which have it as a reserved word
JdbcMessageStoreto have aCONDITIONquoted to""by default andreplaced to "`" for MySQL
MySqlContainerTestto test against MySQL Docker container