Skip to content
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

Merged
merged 4 commits into from
Sep 16, 2022
Merged

AlterSequence: include NOORDER clause ordered="false" is specified #1044

merged 4 commits into from
Sep 16, 2022

Conversation

LeBezout
Copy link
Contributor

@LeBezout LeBezout commented Mar 19, 2020

  • Fix the isOrdereddescription
  • Fix the ordered attribute in the statement generator

@datical-jenkins datical-jenkins added Status:Discovery RiskMedium Changes that require more testing or that affect many different code paths. labels Mar 19, 2020
@SteveDonie
Copy link
Contributor

@nvoxland please review. If risk is low, please re-label.

Copy link
Contributor

@SteveDonie SteveDonie left a 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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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:

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.

Copy link
Contributor

@SteveDonie SteveDonie left a 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.

@ro-rah ro-rah added RiskLow Trivial changes in spelling, documentation changes, focused bug fixes, etc. and removed RiskMedium Changes that require more testing or that affect many different code paths. labels Apr 9, 2020
@ro-rah
Copy link

ro-rah commented Apr 9, 2020

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.

@kataggart kataggart added this to To Do in Conditioning++ via automation Jul 28, 2022
@nvoxland nvoxland added the SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions label Aug 31, 2022
Copy link
Contributor

@nvoxland nvoxland left a 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"

@github-actions
Copy link

Unit Test Results

  4 620 files  ±0    4 620 suites  ±0   37m 57s ⏱️ + 2m 25s
  4 619 tests ±0    4 404 ✔️ ±0     215 💤 ±0  0 ±0 
54 600 runs  ±0  49 580 ✔️ ±0  5 020 💤 ±0  0 ±0 

Results for commit 7878176. ± Comparison against base commit 4f7e725.

@FBurguer
Copy link

FBurguer commented Sep 8, 2022

For this PR, I made 2 tests:

  1. Create a sequence with ordered="true" attribute and then use an alter sequence to change ordered="false": PASS
    Changsets:
<changeSet  author="Create-Seq"  id="1">  
    <createSequence    
            incrementBy="2"  
            maxValue="1000"  
            minValue="10"  
            ordered="true"   
            sequenceName="seq_id"  
            startValue="11"/>  
</changeSet>
<changeSet  author="Alter-Seq"  id="2">  
    <alterSequence   
            ordered="false"  
            sequenceName="seq_id"/> 
</changeSet>

UpdateSQL output:

-- Changeset LeBezout/changelog.xml::1::Create-Seq
CREATE SEQUENCE LBUSER2.seq_id START WITH 11 INCREMENT BY 2 MINVALUE 10 MAXVALUE 1000 ORDER;

-- Changeset LeBezout/changelog.xml::2::Alter-Seq
ALTER SEQUENCE LBUSER2.seq_id NOORDER;
  1. Create a sequence with ordered="false" attribute and then use an alter sequence to change ordered="true": PASS
    Changsets:
<changeSet  author="Create-Seq2"  id="3">  
    <createSequence    
            incrementBy="2"  
            maxValue="1000"  
            minValue="10"  
            ordered="false"   
            sequenceName="seq_id2"  
            startValue="11"/>  
</changeSet>
<changeSet  author="Alter-Seq2"  id="4">  
    <alterSequence   
            ordered="true"  
            sequenceName="seq_id2"/> 
</changeSet>

UpdateSQL output:

-- Changeset LeBezout/changelog.xml::3::Create-Seq2
CREATE SEQUENCE LBUSER2.seq_id2 START WITH 11 INCREMENT BY 2 MINVALUE 10 MAXVALUE 1000 NOORDER;

-- Changeset LeBezout/changelog.xml::4::Alter-Seq2
ALTER SEQUENCE LBUSER2.seq_id2 ORDER;

TEST Environment:
Windows 10
Java 8
oracle container, oracle image: gvenzl/oracle-xe:18.4.0-full

@nvoxland nvoxland changed the title AlterSequence : fix documentation & NOORDER AlterSequence: include NOORDER clause ordered="false" is specified Sep 16, 2022
@nvoxland nvoxland merged commit d87b435 into liquibase:master Sep 16, 2022
@kataggart kataggart added this to the NEXT milestone Sep 19, 2022
@tabbyf00
Copy link

Thanks for your PR submission! Your contribution has been included in Liquibase 4.17.0 released on October 10, 2022.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DBAll IntegrationAny RiskLow Trivial changes in spelling, documentation changes, focused bug fixes, etc. SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions sprint2022-34 ThemeDBObjects TypeEnhancement
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet