You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by bp...@apache.org on 2017/06/01 22:02:23 UTC
svn commit: r1797283 - in /db/derby/code/trunk/java:
engine/org/apache/derby/iapi/sql/dictionary/
engine/org/apache/derby/impl/sql/catalog/
engine/org/apache/derby/impl/sql/compile/
engine/org/apache/derby/impl/sql/execute/ optional/org/apache/derby/op...
Author: bpendleton
Date: Thu Jun 1 22:02:23 2017
New Revision: 1797283
URL: http://svn.apache.org/viewvc?rev=1797283&view=rev
Log:
DERBY-6903: ALTER TABLE ALTER COLUMN resets CYCLE option
DERBY-6904: Enhance ALTER TABLE to allow CYCLE option to be changed
DERBY-6905: Enhance SYS.SYSCOLUMNS to report the CYCLE value
DERBY-6906: Allow a GENERATED column to explicitly specify NO CYCLE
This patch was contributed by Harshvardhan Gupta (harshvardhan145 at gmail dot com)
The patch adds the CYCLE property as a fundamental property associated
with a column similar to current increment value, current increment step etc.
* SYS.SYSCOLUMNS extended to hold the cycle value of identity column.
* Extended the grammar to accept "cycle","no cycle" in alter clause
and changed the underlying column descriptor and sequencing objects.
* ALTER clause not involving cycle option (i.e increment and restart)
won't affect the cycle option.
The code flow for the upgrade handling was modelled after Derby-534
for introducing a new in column SYSTRIGGERS. There are new behaviors
for SYSCOLUMNS in both soft- and hard-upgrade scenarios.
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLUMNSRowFactory.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ColumnInfo.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateViewConstantAction.java
db/derby/code/trunk/java/optional/org/apache/derby/optional/dump/RawDBReader.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/IdentitySequenceTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SystemCatalogTest.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java Thu Jun 1 22:02:23 2017
@@ -66,6 +66,7 @@ public final class ColumnDescriptor exte
private long autoincStart;
private long autoincInc;
private long autoincValue;
+ private boolean autoincCycle;
//Following variable is used to see if the user is adding an autoincrement
//column, or if user is altering the existing autoincrement column to change
//the increment value or to change the start value. If none of the above,
@@ -102,11 +103,11 @@ public final class ColumnDescriptor exte
DefaultInfo columnDefaultInfo,
TableDescriptor table,
UUID defaultUUID, long autoincStart, long autoincInc,
- long userChangedWhat)
+ long userChangedWhat, boolean autoincCycle)
{
this(columnName, columnPosition, columnType, columnDefault,
columnDefaultInfo, table, defaultUUID, autoincStart,
- autoincInc);
+ autoincInc,autoincCycle);
autoinc_create_or_modify_Start_Increment = userChangedWhat;
}
@@ -132,7 +133,7 @@ public final class ColumnDescriptor exte
DataTypeDescriptor columnType, DataValueDescriptor columnDefault,
DefaultInfo columnDefaultInfo,
TableDescriptor table,
- UUID defaultUUID, long autoincStart, long autoincInc)
+ UUID defaultUUID, long autoincStart, long autoincInc, boolean autoincCycle)
{
this.columnName = columnName;
this.columnPosition = columnPosition;
@@ -153,6 +154,7 @@ public final class ColumnDescriptor exte
this.autoincStart = autoincStart;
this.autoincValue = autoincStart;
this.autoincInc = autoincInc;
+ this.autoincCycle = autoincCycle;
}
@@ -181,7 +183,7 @@ public final class ColumnDescriptor exte
DefaultInfo columnDefaultInfo,
UUID uuid,
UUID defaultUUID,
- long autoincStart, long autoincInc, long autoincValue)
+ long autoincStart, long autoincInc, long autoincValue, boolean autoincCycle)
{
this.columnName = columnName;
@@ -199,6 +201,7 @@ public final class ColumnDescriptor exte
this.autoincStart = autoincStart;
this.autoincValue = autoincValue;
this.autoincInc = autoincInc;
+ this.autoincCycle = autoincCycle;
}
/**
@@ -378,6 +381,11 @@ public final class ColumnDescriptor exte
{
return autoincStart;
}
+
+ public boolean getAutoincCycle()
+ {
+ return autoincCycle;
+ }
/**
* Get the Increment value given by the user for an autoincrement column
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java Thu Jun 1 22:02:23 2017
@@ -545,9 +545,15 @@ public class DD_Version implements Forma
{
// On upgrade from versions before 10.13, create system procedures
// added in 10.13.
- bootingDictionary.create_10_13_system_procedures( tc, newlyCreatedRoutines );
+ bootingDictionary.create_10_13_system_procedures( tc, newlyCreatedRoutines );
}
+ if (fromMajorVersionNumber <= DataDictionary.DD_VERSION_DERBY_10_13)
+ {
+ // On upgrade from versions before 10.13, add AUTOINCCYCLE column in SYSCOLUMNS
+ bootingDictionary.upgrade_SYSCOLUMNS_AUTOINCCYCLE(tc);
+ }
+
// Grant PUBLIC access to some system routines
bootingDictionary.grantPublicAccessToSystemRoutines(newlyCreatedRoutines, tc, aid);
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java Thu Jun 1 22:02:23 2017
@@ -777,7 +777,10 @@ public final class DataDictionaryImpl
authorizationDatabaseOwner = IdUtil.getUserAuthorizationId(userName);
HashSet<String> newlyCreatedRoutines = new HashSet<String>();
-
+
+ // log the current dictionary version. Moving this statement to top as SYSCOLUMNSRowFactory
+ // queries the version info. SEE Derby-6904
+ dictionaryVersion = softwareVersion;
// create any required tables.
createDictionaryTables(startParams, bootingTC, ddg);
//create procedures for network server metadata
@@ -788,8 +791,6 @@ public final class DataDictionaryImpl
create_SYSCS_procedures(bootingTC, newlyCreatedRoutines );
// now grant execute permission on some of these routines
grantPublicAccessToSystemRoutines( newlyCreatedRoutines, bootingTC, authorizationDatabaseOwner );
- // log the current dictionary version
- dictionaryVersion = softwareVersion;
/* Set properties for current and create time
* DataDictionary versions.
@@ -4372,7 +4373,7 @@ public final class DataDictionaryImpl
(DataValueDescriptor)parameterDefaults[index],
(DefaultInfo) null,
uuid,
- (UUID) null, 0, 0, 0);
+ (UUID) null, 0, 0, 0, false);
addDescriptor(cd, null, SYSCOLUMNS_CATALOG_NUM,
false, // no chance of duplicates here
@@ -8467,6 +8468,18 @@ public final class DataDictionaryImpl
}
/**
+ * Add autoinccycle columns to an SYSCOLUMNS system catalog
+ *
+ * @param tc Transaction controller.
+ *
+ * @exception StandardException Standard Derby error policy
+ */
+ void upgrade_SYSCOLUMNS_AUTOINCCYCLE(TransactionController tc) throws StandardException{
+ TabInfoImpl ti = coreInfo[SYSCOLUMNS_CORE_NUM];
+ upgrade_addColumns(ti.getCatalogRowFactory(),new int[]{10},tc);
+ }
+
+ /**
* Add invisible columns to an existing system catalog
*
* @param rowFactory Associated with this catalog.
@@ -9116,7 +9129,7 @@ public final class DataDictionaryImpl
return new ColumnDescriptor
(column.getName(), columnPosition, column.getType(), null, null, td,
(UUID) null, // No defaults yet for system columns
- 0, 0
+ 0, 0, false
);
}
@@ -9187,7 +9200,7 @@ public final class DataDictionaryImpl
lcoreInfo[SYSTABLES_CORE_NUM] =
new TabInfoImpl(new SYSTABLESRowFactory(luuidFactory, exFactory, dvf));
lcoreInfo[SYSCOLUMNS_CORE_NUM] =
- new TabInfoImpl(new SYSCOLUMNSRowFactory(luuidFactory, exFactory, dvf));
+ new TabInfoImpl(new SYSCOLUMNSRowFactory(this, luuidFactory, exFactory, dvf));
lcoreInfo[SYSCONGLOMERATES_CORE_NUM] =
new TabInfoImpl(new SYSCONGLOMERATESRowFactory(luuidFactory, exFactory, dvf));
lcoreInfo[SYSSCHEMAS_CORE_NUM] =
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLUMNSRowFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLUMNSRowFactory.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLUMNSRowFactory.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLUMNSRowFactory.java Thu Jun 1 22:02:23 2017
@@ -29,6 +29,7 @@ import org.apache.derby.catalog.UUID;
import org.apache.derby.catalog.types.DefaultInfoImpl;
import org.apache.derby.iapi.error.StandardException;
import org.apache.derby.iapi.reference.Property;
+import org.apache.derby.iapi.types.*;
import org.apache.derby.shared.common.sanity.SanityManager;
import org.apache.derby.iapi.services.uuid.UUIDFactory;
import org.apache.derby.iapi.sql.dictionary.CatalogRowFactory;
@@ -41,15 +42,6 @@ import org.apache.derby.iapi.sql.diction
import org.apache.derby.iapi.sql.execute.ExecRow;
import org.apache.derby.iapi.sql.execute.ExecutionFactory;
import org.apache.derby.iapi.store.raw.RawStoreFactory;
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-import org.apache.derby.iapi.types.DataValueDescriptor;
-import org.apache.derby.iapi.types.DataValueFactory;
-import org.apache.derby.iapi.types.SQLChar;
-import org.apache.derby.iapi.types.SQLInteger;
-import org.apache.derby.iapi.types.SQLLongint;
-import org.apache.derby.iapi.types.SQLVarchar;
-import org.apache.derby.iapi.types.TypeId;
-import org.apache.derby.iapi.types.UserType;
import org.apache.derby.impl.sql.compile.ColumnDefinitionNode;
/**
@@ -63,7 +55,7 @@ public class SYSCOLUMNSRowFactory extend
{
static final String TABLENAME_STRING = "SYSCOLUMNS";
- protected static final int SYSCOLUMNS_COLUMN_COUNT = 9;
+ protected static final int SYSCOLUMNS_COLUMN_COUNT = 10;
/* Column #s for syscolumns (1 based) */
//TABLEID is an obsolete name, it is better to use
@@ -78,6 +70,7 @@ public class SYSCOLUMNSRowFactory extend
protected static final int SYSCOLUMNS_AUTOINCREMENTVALUE = 7;
protected static final int SYSCOLUMNS_AUTOINCREMENTSTART = 8;
protected static final int SYSCOLUMNS_AUTOINCREMENTINC = 9;
+ protected static final int SYSCOLUMNS_AUTOINCREMENTINCCYCLE = 10;
//private static final String SYSCOLUMNS_INDEX1_NAME = "SYSCOLUMNS_INDEX1";
protected static final int SYSCOLUMNS_INDEX1_ID = 0;
@@ -115,16 +108,21 @@ public class SYSCOLUMNSRowFactory extend
// CONSTRUCTORS
//
/////////////////////////////////////////////////////////////////////////////
+
+ // SYSCOLUMNSRowFactory class needs to access the DD version to perform soft / hard upgrades if any.
+ private final DataDictionary dataDictionary;
- SYSCOLUMNSRowFactory(UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory dvf)
+
+ SYSCOLUMNSRowFactory(DataDictionary dd,UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory dvf)
{
- this(uuidf, ef, dvf, TABLENAME_STRING);
+ this(dd, uuidf, ef, dvf, TABLENAME_STRING);
}
- SYSCOLUMNSRowFactory(UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory dvf,
+ SYSCOLUMNSRowFactory(DataDictionary dd,UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory dvf,
String myName )
{
super(uuidf,ef,dvf);
+ this.dataDictionary = dd;
initInfo(SYSCOLUMNS_COLUMN_COUNT, myName, indexColumnPositions, uniqueness, uuids);
}
@@ -141,8 +139,18 @@ public class SYSCOLUMNSRowFactory extend
*
* @exception StandardException thrown on failure
*/
+ @Override
+ public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent)
+ throws StandardException{
+ return makeRow(td, getHeapColumnCount());
+ }
- public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent)
+ @Override
+ public ExecRow makeEmptyRowForCurrentVersion() throws StandardException {
+ return makeRow(null, SYSCOLUMNS_COLUMN_COUNT);
+ }
+
+ private ExecRow makeRow(TupleDescriptor td, int columnCount)
throws StandardException
{
ExecRow row;
@@ -156,6 +164,7 @@ public class SYSCOLUMNSRowFactory extend
long autoincStart = 0;
long autoincInc = 0;
long autoincValue = 0;
+ boolean autoincCycle = false;
//The SYSCOLUMNS table's autoinc related columns change with different
//values depending on what happened to the autoinc column, ie is the
//user adding an autoincrement column, or is user changing the existing
@@ -178,6 +187,8 @@ public class SYSCOLUMNSRowFactory extend
autoincInc = column.getAutoincInc();
autoincValue = column.getAutoincValue();
autoinc_create_or_modify_Start_Increment = column.getAutoinc_create_or_modify_Start_Increment();
+ autoincCycle = column.getAutoincCycle();
+
if (column.getDefaultInfo() != null)
{
defaultSerializable = column.getDefaultInfo();
@@ -200,7 +211,7 @@ public class SYSCOLUMNSRowFactory extend
*/
/* Build the row to insert */
- row = getExecutionFactory().getValueRow(SYSCOLUMNS_COLUMN_COUNT);
+ row = getExecutionFactory().getValueRow(columnCount);
/* 1st column is REFERENCEID (UUID - char(36)) */
row.setColumn(SYSCOLUMNS_REFERENCEID, new SQLChar(tabID));
@@ -247,15 +258,44 @@ public class SYSCOLUMNSRowFactory extend
new SQLLongint(autoincStart));
row.setColumn(SYSCOLUMNS_AUTOINCREMENTINC,
new SQLLongint(autoincInc));
+ if (row.nColumns() >= 10) {
+ // This column is present only if the data dictionary version is
+ // 10.14 or higher.
+ row.setColumn(SYSCOLUMNS_AUTOINCREMENTINCCYCLE,
+ new SQLBoolean(autoincCycle));
+ }
+
} else if (autoinc_create_or_modify_Start_Increment == ColumnDefinitionNode.MODIFY_AUTOINCREMENT_RESTART_VALUE)
{//user asked for restart with a new value, so don't change increment by and original start
//with values in the SYSCOLUMNS table. Just record the RESTART WITH value as the
//next value to be generated in the SYSCOLUMNS table
+
ColumnDescriptor column = (ColumnDescriptor)td;
row.setColumn(SYSCOLUMNS_AUTOINCREMENTVALUE, new SQLLongint(autoincStart));
row.setColumn(SYSCOLUMNS_AUTOINCREMENTSTART, new SQLLongint(autoincStart));
row.setColumn(SYSCOLUMNS_AUTOINCREMENTINC, new SQLLongint(
column.getTableDescriptor().getColumnDescriptor(colName).getAutoincInc()));
+ if (row.nColumns() >= 10) {
+ // This column is present only if the data dictionary version is
+ // 10.14 or higher.
+ row.setColumn(SYSCOLUMNS_AUTOINCREMENTINCCYCLE,
+ new SQLBoolean(autoincCycle));
+ }
+ }
+ else if(autoinc_create_or_modify_Start_Increment == ColumnDefinitionNode.MODIFY_AUTOINCREMENT_CYCLE_VALUE){
+ ColumnDescriptor column = (ColumnDescriptor)td;
+ row.setColumn(SYSCOLUMNS_AUTOINCREMENTVALUE, new SQLLongint(
+ column.getTableDescriptor().getColumnDescriptor(colName).getAutoincValue()));
+ row.setColumn(SYSCOLUMNS_AUTOINCREMENTSTART, new SQLLongint(
+ column.getTableDescriptor().getColumnDescriptor(colName).getAutoincStart()));
+ row.setColumn(SYSCOLUMNS_AUTOINCREMENTINC, new SQLLongint(
+ column.getTableDescriptor().getColumnDescriptor(colName).getAutoincInc()));
+ if (row.nColumns() >= 10) {
+ // This column is present only if the data dictionary version is
+ // 10.14 or higher.
+ row.setColumn(SYSCOLUMNS_AUTOINCREMENTINCCYCLE,
+ new SQLBoolean(autoincCycle));
+ }
}
else
{
@@ -265,6 +305,12 @@ public class SYSCOLUMNSRowFactory extend
new SQLLongint());
row.setColumn(SYSCOLUMNS_AUTOINCREMENTINC,
new SQLLongint());
+ if (row.nColumns() >= 10) {
+ // This column is present only if the data dictionary version is
+ // 10.14 or higher.
+ row.setColumn(SYSCOLUMNS_AUTOINCREMENTINCCYCLE,
+ new SQLBoolean(autoincCycle));
+ }
}
return row;
}
@@ -326,7 +372,14 @@ public class SYSCOLUMNSRowFactory extend
{
if (SanityManager.DEBUG)
{
- SanityManager.ASSERT(row.nColumns() == SYSCOLUMNS_COLUMN_COUNT,
+
+ int expectedCols =
+ dd.checkVersion(DataDictionary.DD_VERSION_DERBY_10_14, null)
+ ? SYSCOLUMNS_COLUMN_COUNT
+ : (SYSCOLUMNS_COLUMN_COUNT - 1);
+
+
+ SanityManager.ASSERT(row.nColumns() == expectedCols,
"Wrong number of columns for a SYSCOLUMNS row");
}
@@ -340,6 +393,7 @@ public class SYSCOLUMNSRowFactory extend
UUID uuid = null;
UUIDFactory uuidFactory = getUUIDFactory();
long autoincStart, autoincInc, autoincValue;
+ boolean autoincCycle = false;
DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
@@ -421,16 +475,24 @@ public class SYSCOLUMNSRowFactory extend
/* 9th column is AUTOINCREMENTINC (long) */
autoincInc = row.getColumn(SYSCOLUMNS_AUTOINCREMENTINC).getLong();
+ if (row.nColumns() >= 10){
+ DataValueDescriptor col = row.getColumn(SYSCOLUMNS_AUTOINCREMENTINCCYCLE);
+ autoincCycle = col.getBoolean();
+ }
+
+
DataValueDescriptor col = row.getColumn(SYSCOLUMNS_AUTOINCREMENTSTART);
autoincStart = col.getLong();
col = row.getColumn(SYSCOLUMNS_AUTOINCREMENTINC);
autoincInc = col.getLong();
+ // Hard upgraded tables <=10.13 come with a false autoincCyle before they are first
+ // explicitly set with cycle or no cycle command.
colDesc = new ColumnDescriptor(columnName, columnNumber,
dataTypeServices, defaultValue, defaultInfo, uuid,
defaultUUID, autoincStart, autoincInc,
- autoincValue);
+ autoincValue, autoincCycle);
return colDesc;
}
@@ -468,7 +530,18 @@ public class SYSCOLUMNSRowFactory extend
SystemColumnImpl.getColumn("AUTOINCREMENTVALUE", Types.BIGINT, true),
SystemColumnImpl.getColumn("AUTOINCREMENTSTART", Types.BIGINT, true),
SystemColumnImpl.getColumn("AUTOINCREMENTINC", Types.BIGINT, true),
+ SystemColumnImpl.getColumn("AUTOINCREMENTCYCLE", Types.BOOLEAN, true)
};
}
+
+ @Override
+ public int getHeapColumnCount() throws StandardException {
+ // The CYCLE clause (DERBY-6904) is only supported if the dictionary
+ // version is 10.14 or higher.
+ boolean supportsCycleClause = dataDictionary
+ .checkVersion(DataDictionary.DD_VERSION_DERBY_10_14, null);
+ int heapCols = super.getHeapColumnCount();
+ return supportsCycleClause ? heapCols : (heapCols - 1);
+ }
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java Thu Jun 1 22:02:23 2017
@@ -66,7 +66,7 @@ public class ColumnDefinitionNode extend
GenerationClauseNode generationClauseNode;
long autoincrementIncrement;
long autoincrementStart;
- long autoincrementCycle;
+ boolean autoincrementCycle;
//This variable tells if the autoincrement column is participating
//in create or alter table. And if it is participating in alter
//table, then it further knows if it is represting a change in
@@ -90,6 +90,7 @@ public class ColumnDefinitionNode extend
//alter table command to change the ALWAYS vs DEFAULT nature of an autoinc column
public static final int MODIFY_AUTOINCREMENT_ALWAYS_VS_DEFAULT = 3;
+ public static final int MODIFY_AUTOINCREMENT_CYCLE_VALUE = 4;
/**
* Constructor for a ColumnDefinitionNode
*
@@ -144,7 +145,7 @@ public class ColumnDefinitionNode extend
long[] aii = autoIncrementInfo;
autoincrementStart = aii[QueryTreeNode.AUTOINCREMENT_START_INDEX];
autoincrementIncrement = aii[QueryTreeNode.AUTOINCREMENT_INC_INDEX];
- autoincrementCycle = aii[QueryTreeNode.AUTOINCREMENT_CYCLE];
+ autoincrementCycle = aii[QueryTreeNode.AUTOINCREMENT_CYCLE] == 1 ? true : false;
//Parser has passed the info about autoincrement column's status in the
//following array element. It will tell if the autoinc column is part of
//a create table or if is a part of alter table. And if it is part of
@@ -357,7 +358,7 @@ public class ColumnDefinitionNode extend
*
* @return Autoincrement cycle value.
*/
- long getAutoincrementCycle()
+ boolean getAutoincrementCycle()
{
if (SanityManager.DEBUG)
{ SanityManager.ASSERT(isAutoincrement,
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java Thu Jun 1 22:02:23 2017
@@ -360,7 +360,7 @@ class CreateViewNode extends DDLStatemen
null,
null,
ColumnInfo.CREATE,
- 0, 0, 0, 0);
+ 0, 0, false, 0);
}
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java Thu Jun 1 22:02:23 2017
@@ -1987,7 +1987,7 @@ class FromVTI extends FromTable implemen
(
columnName, i+1, dtd,
(DataValueDescriptor) null, (DefaultInfo) null, (UUID) null, (UUID) null,
- 0L, 0L, 0L
+ 0L, 0L, 0L, false
);
rc.setColumnDescriptor( null, coldesc );
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java Thu Jun 1 22:02:23 2017
@@ -70,10 +70,9 @@ class ModifyColumnNode extends ColumnDef
DataTypeDescriptor dataTypeServices,
long[] autoIncrementInfo,
ContextManager cm) throws StandardException {
- super(name, defaultNode, dataTypeServices, autoIncrementInfo, cm);
- this.kind = kind;
- }
-
+ super(name, defaultNode, dataTypeServices, autoIncrementInfo, cm);
+ this.kind = kind;
+ }
/**
* Get the UUID of the old column default.
*
@@ -304,6 +303,9 @@ class ModifyColumnNode extends ColumnDef
ColumnDefinitionNode.MODIFY_AUTOINCREMENT_INC_VALUE) {
return ColumnInfo.MODIFY_COLUMN_DEFAULT_INCREMENT;
+ } else if (autoinc_create_or_modify_Start_Increment ==
+ ColumnDefinitionNode.MODIFY_AUTOINCREMENT_CYCLE_VALUE) {
+ return ColumnInfo.MODIFY_COLUMN_DEFAULT_CYCLE;
} else {
return ColumnInfo.MODIFY_COLUMN_DEFAULT_VALUE;
}
@@ -386,11 +388,20 @@ class ModifyColumnNode extends ColumnDef
}
}
if (autoinc_create_or_modify_Start_Increment ==
- ColumnDefinitionNode.MODIFY_AUTOINCREMENT_RESTART_VALUE)
+ ColumnDefinitionNode.MODIFY_AUTOINCREMENT_RESTART_VALUE){
autoincrementIncrement = cd.getAutoincInc();
+ autoincrementCycle = cd.getAutoincCycle();
+ }
if (autoinc_create_or_modify_Start_Increment ==
- ColumnDefinitionNode.MODIFY_AUTOINCREMENT_INC_VALUE)
+ ColumnDefinitionNode.MODIFY_AUTOINCREMENT_INC_VALUE){
autoincrementStart = cd.getAutoincStart();
+ autoincrementCycle = cd.getAutoincCycle();
+ }
+ if (autoinc_create_or_modify_Start_Increment ==
+ ColumnDefinitionNode.MODIFY_AUTOINCREMENT_CYCLE_VALUE){
+ autoincrementIncrement = cd.getAutoincInc();
+ autoincrementStart = cd.getAutoincStart();
+ }
/* Fill in the DataTypeServices from the DataDictionary */
type = cd.getType();
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java Thu Jun 1 22:02:23 2017
@@ -1003,7 +1003,7 @@ class ResultColumnList extends QueryTree
null,
(TableDescriptor) null,
null,
- 0, 0);
+ 0, 0, false);
rc.setColumnDescriptor(null, cd);
rc.setVirtualColumnId(index + 1);
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java Thu Jun 1 22:02:23 2017
@@ -455,7 +455,7 @@ class TableElementList extends QueryTree
columnName,
td.getColumnDescriptor( columnName ).getType(),
null, null, null, null, null,
- ColumnInfo.DROP, 0, 0, 0, 0);
+ ColumnInfo.DROP, 0, 0, false, 0);
break;
}
@@ -505,7 +505,7 @@ class TableElementList extends QueryTree
(coldef.isAutoincrementColumn() ?
coldef.getAutoincrementIncrement() : 0),
(coldef.isAutoincrementColumn() ?
- coldef.getAutoincrementCycle() : 0),
+ coldef.getAutoincrementCycle() : false),
(coldef.isAutoincrementColumn() ?
coldef.getAutoinc_create_or_modify_Start_Increment() : -1));
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj Thu Jun 1 22:02:23 2017
@@ -11586,8 +11586,14 @@ identityColumnOption(long[] autoIncremen
autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_CREATE_MODIFY] = ColumnDefinitionNode.CREATE_AUTOINCREMENT;
optionIndex = 1;}
|
- optionToken = <CYCLE> autoIncrementCycle = whetherCycle()
- {autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_CYCLE] = autoIncrementCycle;
+ optionToken = <CYCLE>
+ {autoIncrementCycle = 1;
+ autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_CYCLE] = autoIncrementCycle;
+ optionIndex = 2;}
+ |
+ optionToken = <NO> <CYCLE>
+ {autoIncrementCycle = 0;
+ autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_CYCLE] = autoIncrementCycle;
optionIndex = 2;}
|
<COMMA> ( LOOKAHEAD({getToken(1).kind == COMMA ||
@@ -13723,6 +13729,7 @@ columnAlterClause(String columnName) thr
ValueNode defaultNode;
long[] autoIncrementInfo = new long[5];
long autoIncrementIncrement = 1;
+ long autoIncrementCycle=0;
long autoIncrementRestartWith = 1;
DataTypeDescriptor typeDescriptor = null;
int alterKind;
@@ -13761,6 +13768,32 @@ columnAlterClause(String columnName) thr
return
new ModifyColumnNode(ModifyColumnNode.K_MODIFY_COLUMN_DEFAULT,
columnName,
+ null,
+ null,
+ autoIncrementInfo,
+ getContextManager());
+ }
+|
+ <CYCLE>
+ {
+ autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_CYCLE] = 1;
+ autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_CREATE_MODIFY] = ColumnDefinitionNode.MODIFY_AUTOINCREMENT_CYCLE_VALUE;
+ return
+ new ModifyColumnNode(ModifyColumnNode.K_MODIFY_COLUMN_DEFAULT,
+ columnName,
+ null,
+ null,
+ autoIncrementInfo,
+ getContextManager());
+ }
+|
+ <NO> <CYCLE>
+ {
+ autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_CYCLE] = 0;
+ autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_CREATE_MODIFY] = ColumnDefinitionNode.MODIFY_AUTOINCREMENT_CYCLE_VALUE;
+ return
+ new ModifyColumnNode(ModifyColumnNode.K_MODIFY_COLUMN_DEFAULT,
+ columnName,
null,
null,
autoIncrementInfo,
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java Thu Jun 1 22:02:23 2017
@@ -485,6 +485,8 @@ class AlterTableConstantAction extends D
ColumnInfo.MODIFY_COLUMN_DEFAULT_RESTART ||
columnInfo[ix].action ==
ColumnInfo.MODIFY_COLUMN_DEFAULT_INCREMENT ||
+ columnInfo[ix].action ==
+ ColumnInfo.MODIFY_COLUMN_DEFAULT_CYCLE ||
columnInfo[ix].action ==
ColumnInfo.MODIFY_COLUMN_DEFAULT_VALUE)
{
@@ -1233,7 +1235,8 @@ class AlterTableConstantAction extends D
defaultUUID,
columnInfo[ix].autoincStart,
columnInfo[ix].autoincInc,
- columnInfo[ix].autoinc_create_or_modify_Start_Increment
+ columnInfo[ix].autoinc_create_or_modify_Start_Increment,
+ columnInfo[ix].autoincCycle
);
dd.addDescriptor(columnDescriptor, td,
@@ -2058,7 +2061,8 @@ class AlterTableConstantAction extends D
td,
columnDescriptor.getDefaultUUID(),
columnInfo[ix].autoincStart,
- columnInfo[ix].autoincInc
+ columnInfo[ix].autoincInc,
+ columnInfo[ix].autoincCycle
);
@@ -2124,7 +2128,8 @@ class AlterTableConstantAction extends D
td,
columnDescriptor.getDefaultUUID(),
columnDescriptor.getAutoincStart(),
- columnDescriptor.getAutoincInc());
+ columnDescriptor.getAutoincInc(),
+ columnDescriptor.getAutoincCycle());
// Update the ColumnDescriptor with new default info
dd.dropColumnDescriptor(td.getUUID(), colName, tc);
@@ -2181,7 +2186,8 @@ class AlterTableConstantAction extends D
defaultUUID,
columnInfo[ix].autoincStart,
columnInfo[ix].autoincInc,
- columnInfo[ix].autoinc_create_or_modify_Start_Increment
+ columnInfo[ix].autoinc_create_or_modify_Start_Increment,
+ columnInfo[ix].autoincCycle
);
// Update the ColumnDescriptor with new default info
@@ -2201,12 +2207,13 @@ class AlterTableConstantAction extends D
{
dd.setAutoincrementValue(tc, td.getUUID(), columnInfo[ix].name,
columnInfo[ix].autoincStart, false);
- }
+ }
// else we are simply changing the default value
if (
(columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_INCREMENT) ||
- (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_RESTART)
+ (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_RESTART) ||
+ (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_CYCLE)
)
{
//
@@ -2219,7 +2226,7 @@ class AlterTableConstantAction extends D
// don't clobber the current value of the sequence generator if we
// are just changing the increment. see DERBY-6579.
- if ( columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_INCREMENT )
+ if ( (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_INCREMENT) || (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_CYCLE ))
{
currentValue = dd.peekAtIdentity( td.getSchemaName(), td.getName() );
}
@@ -2233,7 +2240,7 @@ class AlterTableConstantAction extends D
csca.executeConstantAction( activation );
// reset the current value of the sequence generator as necessary
- if ( columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_INCREMENT )
+ if ( (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_INCREMENT) || (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_CYCLE ) )
{
SequenceDescriptor sequence = dd.getSequenceDescriptor
( dd.getSystemSchemaDescriptor(), sequenceName );
@@ -2283,7 +2290,8 @@ class AlterTableConstantAction extends D
defaultUUID,
oldColumnDescriptor.getAutoincStart(),
oldColumnDescriptor.getAutoincInc(),
- ColumnDefinitionNode.MODIFY_AUTOINCREMENT_ALWAYS_VS_DEFAULT
+ ColumnDefinitionNode.MODIFY_AUTOINCREMENT_ALWAYS_VS_DEFAULT,
+ oldColumnDescriptor.getAutoincCycle()
);
// Update the ColumnDescriptor with new default info
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ColumnInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ColumnInfo.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ColumnInfo.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ColumnInfo.java Thu Jun 1 22:02:23 2017
@@ -75,7 +75,7 @@ public class ColumnInfo implements Forma
// autoinc columns.
long autoincStart;
long autoincInc;
- long autoincCycle;
+ boolean autoincCycle;
//if this is an autoincrement column, then following variable will have CREATE or
//MODIFY_COLUMN_DEFAULT_RESTART or MODIFY_COLUMN_DEFAULT_INCREMENT. Otherwise,
//this variable will be set to -1.
@@ -96,6 +96,7 @@ public class ColumnInfo implements Forma
public static final int MODIFY_COLUMN_GENERATED_ALWAYS = 8;
public static final int MODIFY_COLUMN_GENERATED_BY_DEFAULT = 9;
+ public static final int MODIFY_COLUMN_DEFAULT_CYCLE = 10;
// CONSTRUCTORS
/**
@@ -131,7 +132,7 @@ public class ColumnInfo implements Forma
int action,
long autoincStart,
long autoincInc,
- long autoincCycle,
+ boolean autoincCycle,
long autoinc_create_or_modify_Start_Increment)
{
this.name = name;
@@ -144,7 +145,7 @@ public class ColumnInfo implements Forma
this.action = action;
this.autoincStart = autoincStart;
this.autoincInc = autoincInc;
- this.autoincCycle = autoincCycle;
+ this.autoincCycle = autoincCycle;
this.autoinc_create_or_modify_Start_Increment = autoinc_create_or_modify_Start_Increment;
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java Thu Jun 1 22:02:23 2017
@@ -287,7 +287,8 @@ class CreateTableConstantAction extends
defaultUUID,
columnInfo[ix].autoincStart,
columnInfo[ix].autoincInc,
- columnInfo[ix].autoinc_create_or_modify_Start_Increment
+ columnInfo[ix].autoinc_create_or_modify_Start_Increment,
+ columnInfo[ix].autoincCycle
);
//
@@ -313,7 +314,8 @@ class CreateTableConstantAction extends
td,
defaultUUID,
columnInfo[ix].autoincStart,
- columnInfo[ix].autoincInc
+ columnInfo[ix].autoincInc,
+ columnInfo[ix].autoincCycle
);
}
@@ -420,7 +422,7 @@ class CreateTableConstantAction extends
boolean cycling=false;
- if(info.autoincCycle==1)
+ if(info.autoincCycle)
cycling=true;
return new CreateSequenceConstantAction
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateViewConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateViewConstantAction.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateViewConstantAction.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateViewConstantAction.java Thu Jun 1 22:02:23 2017
@@ -187,7 +187,8 @@ class CreateViewConstantAction extends D
td,
(UUID) null,
columnInfo[ix].autoincStart,
- columnInfo[ix].autoincInc
+ columnInfo[ix].autoincInc,
+ columnInfo[ix].autoincCycle
);
cdlArray[ix] = columnDescriptor;
}
Modified: db/derby/code/trunk/java/optional/org/apache/derby/optional/dump/RawDBReader.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/optional/org/apache/derby/optional/dump/RawDBReader.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/optional/org/apache/derby/optional/dump/RawDBReader.java (original)
+++ db/derby/code/trunk/java/optional/org/apache/derby/optional/dump/RawDBReader.java Thu Jun 1 22:02:23 2017
@@ -245,7 +245,7 @@ public class RawDBReader implements O
conn,
controlSchema,
"SYSCOLUMNS",
- "( referenceid char(36), columnname varchar(128), columnnumber int, columndatatype serializable, columndefault serializable, columndefaultid char(36), autoincrementvalue bigint, autoincrementstart bigint, autoincrementinc bigint )",
+ "( referenceid char(36), columnname varchar(128), columnnumber int, columndatatype serializable, columndefault serializable, columndefaultid char(36), autoincrementvalue bigint, autoincrementstart bigint, autoincrementinc bigint, autoincrementcycle boolean )",
"c90.dat",
corruptDBLocation,
encryptionAttributes,
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/IdentitySequenceTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/IdentitySequenceTest.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/IdentitySequenceTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/IdentitySequenceTest.java Thu Jun 1 22:02:23 2017
@@ -658,10 +658,11 @@ public class IdentitySequenceTest extend
// Syntax error.
expectCompilationError( conn,"42X01" ,"create table t( a int generated always as identity(START WITH 47 ,))" );
- // Does not support cycle option after altering the table.
+ // Support cycle option after altering the table.
goodStatement( conn, "create table t( a int generated always as identity(start with 2147483647 cycle), b int)" );
goodStatement( conn, "alter table t alter column a set increment by 4" );
- expectExecutionError( conn,"2200H" ,"insert into t( b ) values ( 1 ), ( 2 )" );
+ goodStatement( conn ,"insert into t( b ) values ( 1 ), ( 2 )" );
+
goodStatement( conn, "drop table t" );
// Alter table works fine without cycling with cycle option in the syntax.
@@ -684,10 +685,10 @@ public class IdentitySequenceTest extend
);
goodStatement( conn, "drop table t" );
- // Does not support cycle option after altering the table.
+ // supports cycle option after altering the table.
goodStatement( conn, "create table t( a int generated always as identity(increment by 2 cycle), b int)" );
goodStatement( conn, "alter table t alter column a restart with 2147483647" );
- expectExecutionError( conn,"2200H" ,"insert into t( b ) values ( 1 ), ( 2 )" );
+ goodStatement( conn ,"insert into t( b ) values ( 1 ), ( 2 )" );
goodStatement( conn, "drop table t" );
// Alter table works fine without cycling with cycle option in the syntax.
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SystemCatalogTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SystemCatalogTest.java?rev=1797283&r1=1797282&r2=1797283&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SystemCatalogTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SystemCatalogTest.java Thu Jun 1 22:02:23 2017
@@ -197,6 +197,7 @@ public class SystemCatalogTest extends B
{"SYSCOLPERMS", "GRANTOR", "3", "VARCHAR(128) NOT NULL"},
{"SYSCOLPERMS", "TABLEID", "4", "CHAR(36) NOT NULL"},
{"SYSCOLPERMS", "TYPE", "5", "CHAR(1) NOT NULL"},
+ {"SYSCOLUMNS", "AUTOINCREMENTCYCLE", "10", "BOOLEAN"},
{"SYSCOLUMNS", "AUTOINCREMENTINC", "9", "BIGINT"},
{"SYSCOLUMNS", "AUTOINCREMENTSTART", "8", "BIGINT"},
{"SYSCOLUMNS", "AUTOINCREMENTVALUE", "7", "BIGINT"},