/[Apache-SVN]
ViewVC logotype

Revision 1756287


Jump to revision: Previous Next
Author: bpendleton
Date: Sat Aug 13 17:07:58 2016 UTC (7 years, 7 months ago)
Changed paths: 9
Log Message:
DERBY-6852: Allow identity columns to cycle

This patch was contributed by Danoja Dias (danojadias at gmail dot com)

This change introduces the new CYCLE keyword to the syntax of a
generated identity column. The CYCLE keyword, if specified, causes Derby
to select the CYCLE option in the sequence object that is created
internally to implement the identity column.

In turn, this means that values can be generated for the identity column
beyond the maximum value for the column's datatype; when that maximum
is reached, the sequence "cycles" and begins over again, (re-)generating
the values all over again.

Note that, as part of this change, when a Derby sequence cycles, it now
cycles to its minimum/maximum value (depending on whether it has a 
positive increment or a negative increment) rather than to its start
value; we believe this is improved behavior and is still standards-compliant.

With this change, the basic behavior is operational and there are tests
to demonstrate this. Various syntax checks are made, and the underlying
sequence is created correctly.

There is follow-up work to be done, which will be addressed possibly as
separate projects; we believe the basic feature is certainly usable
as of this change (and once we add documentation for it).


Changed paths

Path Details
Directorydb/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SequenceGenerator.java modified , text changed
Directorydb/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java modified , text changed
Directorydb/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java modified , text changed
Directorydb/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java modified , text changed
Directorydb/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java modified , text changed
Directorydb/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj modified , text changed
Directorydb/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ColumnInfo.java modified , text changed
Directorydb/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java modified , text changed
Directorydb/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/IdentitySequenceTest.java modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26