[ 
https://issues.apache.org/jira/browse/DERBY-6962?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-6962:
---------------------------------
    Attachment: derby-6962-01-aa-forbidSetCycleOn10_10.diff

Attaching derby-6962-01-aa-forbidSetCycleOn10_10.diff. This patch prevents 
changes to the cycling behavior of identity columns in soft-upgraded databases 
at level 10.10 and earlier. The upgrade tests ran cleanly against the following 
releases:

  10.1.1.0
  10.1.2.1
  10.1.3.1
  10.2.1.6
  10.2.2.0
  10.2.2.1
  10.3.3.0
  10.4.1.3
  10.4.2.0
  10.4.2.1
  10.5.1.1
  10.5.3.0
  10.6.1.0
  10.6.2.1
  10.7.1.1
  10.8.1.2
  10.8.2.2
  10.9.1.0
  10.10.1.1
  10.10.1.2
  10.10.1.3
  10.10.2.0
  10.11.1.1
  10.12.1.1
  10.13.1.1

I will run full regression tests now.

Touches the following files:

----------------------

M       java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj

Raise an error at parse time if someone tries to change the cycling behavior of 
an identity column in a database at level 10.10 or earlier.

----------------------

M       
java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_13.java

Upgrade test for this change.


> Forbid ALTER TABLE ... SET CYCLE on identity columns in pre-10.12 databases
> ---------------------------------------------------------------------------
>
>                 Key: DERBY-6962
>                 URL: https://issues.apache.org/jira/browse/DERBY-6962
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.14.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>             Fix For: 10.14.0.0
>
>         Attachments: derby-6962-01-aa-forbidSetCycleOn10_10.diff
>
>
> The
>   ALTER TABLE ALTER COLUMN $columnName SET CYCLE
> command does not raise an error even on identity columns in pre-10.12 
> databases. Those identity columns are not backed by sequence generators. 
> Afterwards, the columns do not cycle, even though the ALTER TABLE command 
> appeared to run successfully. This should be easy to fix. The parser just 
> needs to forbid the ALTER TABLE...SET CYCLE command in pre-10.12 databases. 
> The following scripts show this behavior:
> {noformat}
> -- run the following script with version 10.10.1.1:
> connect 'jdbc:derby:db;create=true';
> create table t1(a int generated always as identity (start with 2147483646), b 
> int);
> insert into t1(b) values (1);
> insert into t1(b) values (2);
> -- fails as expected
> insert into t1(b) values (3);
> select * from t1 order by b;
> create table t2(a int generated always as identity (start with 2147483646), b 
> int);
> -- now run the following script with 10.14
> connect 'jdbc:derby:db';
> -- succeeds but should not
> alter table t2 alter column a set cycle;
> insert into t2(b) values (1);
> insert into t2(b) values (2);
> -- fails because the cycling behavior did not change
> insert into t2(b) values (3);
> select * from t2 order by b;
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to