-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
AlterSequence: include NOORDER clause ordered="false" is specified #1044
Conversation
@nvoxland please review. If risk is low, please re-label. |
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 needs a more detailed review.
@@ -68,7 +68,9 @@ public ValidationErrors validate(AlterSequenceStatement alterSequenceStatement, | |||
|
|||
if (statement.getOrdered() != null) { | |||
if (statement.getOrdered()) { | |||
buffer.append(" ORDER"); | |||
buffer.append(" ORDER "); | |||
} else { |
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.
It appears that there is at least one platform (MS SQL Server) that does not allow an ORDER clause, which could cause a problem. Could be protected by statement.getOrdered() always returning null for certain platforms?
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.
Hi, thanks for review.
You're right, so the liquibase documentation is wrong (says that "mssql" supports this) in:
- https://www.liquibase.org/documentation/changes/create_sequence.html
- https://www.liquibase.org/documentation/changes/alter_sequence.html
But my fix is just on NOORDER. Alter the sequence to switch from ORDER to NOORDER like it's already done for CYCLE/NOCYCLE or CACHE/NOCACHE.
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.
Will need at least a comment change.
Hi @LeBezout! I reviewed this internally and I think this is a low risk PR. So, I am going to move it along the queue. Thanks so much for your contributions, targeting Q2 release. |
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.
The change seems good to me. We have the separate validation check for whether "ordered" is supported in general and what that list should be can be out of the scope of this ticket. Looking a bit, I wonder if only Oracle really supports order/noorder in general?
Given that maybe only oracle can really take advantage of the ordered attribute regardless, I'm good with asssuming that NOORDER is the correct syntax for ordered="false" when the database supports it. It is an improvment either way over ordered="false" doing nothing.
We still continue to not set anything when ordered is not set, so this only impacts people explicitly asking for ordered="false"
For this PR, I made 2 tests:
UpdateSQL output:
UpdateSQL output:
TEST Environment: |
Thanks for your PR submission! Your contribution has been included in Liquibase 4.17.0 released on October 10, 2022. |
isOrdered
descriptionordered
attribute in the statement generator