public class GeneratedColumnsTest extends GeneratedColumnsHelper
Test generated columns. See DERBY-481.
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
_clearingProcName |
private static int |
_minusCounter |
private static java.util.ArrayList<java.lang.String> |
_triggerReports |
private java.lang.String |
_triggerReportVTIName |
private static java.lang.String |
IMPORT_FILE_NAME |
BAD_BEFORE_TRIGGER, BAD_CAST, BAD_FOREIGN_KEY_ACTION, CANT_CONTAIN_NULLS, CANT_MODIFY_IDENTITY, CANT_OVERRIDE_GENERATION_CLAUSE, CANT_REFERENCE_GENERATED_COLUMN, CASCADED_COLUMN_DROP_WARNING, COLUMN_OUT_OF_SCOPE, CONSTRAINT_DROPPED_WARNING, CONSTRAINT_VIOLATION, DUPLICATE_CLAUSE, FORBIDDEN_DROP_TRIGGER, FORBIDDEN_ORDERING_OPERATION, FOREIGN_KEY_VIOLATION, GRANT_REVOKE_NOT_ALLOWED, ILLEGAL_ADD_DEFAULT, ILLEGAL_AGG, ILLEGAL_AGGREGATE, ILLEGAL_COMPARISON, ILLEGAL_DUPLICATE, ILLEGAL_RENAME, ILLEGAL_STORAGE, ILLEGAL_UDT_CLASS, JAVA_EXCEPTION, LACK_COLUMN_PRIV, LACK_EXECUTE_PRIV, LACK_TABLE_PRIV, LACK_USAGE_PRIV, LANG_INVALID_USE_OF_DEFAULT, LEXICAL_ERROR, LOCK_TIMEOUT, MISSING_OBJECT, NEED_EXPLICIT_DATATYPE, NO_GENERIC_PERMISSION, NO_SELECT_OR_UPDATE_PERMISSION, NO_TABLE_PERMISSION, NON_EMPTY_SCHEMA, NONEXISTENT_OBJECT, NOT_IMPLEMENTED, NOT_NULL_NEEDS_DATATYPE, NOT_NULL_VIOLATION, OBJECT_DOES_NOT_EXIST, OPERATION_FORBIDDEN, REDUNDANT_CLAUSE, ROUTINE_CANT_ISSUE_SQL, ROUTINE_DEPENDS_ON_TYPE, STRING_TRUNCATION, SYNTAX_ERROR, TABLE_DEPENDS_ON_TYPE, TOO_MUCH_CONTENTION, TRIGGER_DROPPED_WARNING, UNSTABLE_RESULTS, VIEW_DEPENDENCY
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
GeneratedColumnsTest(java.lang.String name)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
private void |
assertDefaultInfo(java.sql.Connection conn,
java.lang.String tableName,
java.lang.String columnName,
java.lang.String[] expectedReferenceColumns,
java.lang.String expectedDefaultText)
Assert that a column has the expected generation clause.
|
private void |
assertTriggerStatus(java.sql.Connection conn,
java.lang.String query,
java.lang.String[][] rows)
Assert that triggers fire correctly
|
static void |
clearTriggerReports() |
org.apache.derby.catalog.DefaultInfo |
getColumnDefault(java.sql.Connection conn,
java.lang.String tableName,
java.lang.String columnName)
Returns the column default for a column.
|
static java.lang.Integer |
minus(java.lang.Integer a) |
static int |
readMinusCounter() |
private int |
readMinusCounter(java.sql.Connection conn) |
static void |
showValues(java.lang.String tag,
java.lang.Integer a,
java.lang.Integer b,
java.lang.Integer c) |
static void |
showValues(java.lang.String tag,
java.lang.Integer old_a,
java.lang.Integer old_b,
java.lang.Integer old_c,
java.lang.Integer new_a,
java.lang.Integer new_b,
java.lang.Integer new_c) |
static int |
signum(int i) |
static junit.framework.Test |
suite()
Construct top level suite in this JUnit test
|
void |
test_001_determinism_of_stored_system_routines()
Test that the stored system procedures and functions are non-deterministic.
|
void |
test_002_determinism_positive()
Basic positive tests for DETERMINISTIC keyword.
|
void |
test_003_determinism_redundantClause()
Verify that we get errors when there is more than one determinism clause
in a routine declaration.
|
void |
test_004_basicParser()
Verify basic parse/bind logic for declaring generated columns.
|
void |
test_005_basicInsert()
Verify basic insert behavior for generated columns.
|
void |
test_006_basicUpdate()
Verify basic update behavior for generated columns.
|
void |
test_007_basicTriggers()
Verify basic trigger interaction with generated columns
|
void |
test_008_basicForeignKeys()
Verify basic interaction of foreign keys with generated columns
|
void |
test_009_basicDefaultInfo()
Verify that column defaults look good for generated columns.
|
void |
test_010_updateDefaultLiteral()
Various tests involving the DEFAULT literal in UPDATE statements.
|
void |
test_011_basicAlter()
Basic tests for altering a table and adding a generated column.
|
void |
test_012_referencedColumns()
Verify that generated columns can't refer to one another.
|
void |
test_013_badReferences()
Various miscellaneous illegal create/alter table statements.
|
void |
test_014_assignment()
Test that the declared datatype of a generated column can be anything that the
generation clause can be assigned to.
|
void |
test_015_foreignKeyActions()
Test that delete/update referential actions don't override generated columns.
|
void |
test_016_notNull()
Test NOT NULL constraints on generated columns.
|
void |
test_017_padding()
Test padding and truncation of character and fixed decimal data.
|
void |
test_018_alterDatatype()
Test datatype alteration
|
void |
test_019_dropColumn()
Test ALTER TABLE DROP COLUMN
|
void |
test_020_alterColumn()
Test ALTER TABLE ALTER COLUMN
|
void |
test_021_dropFunction()
Test that generation clauses block the dropping of routines that they
depend on.
|
void |
test_022_omitDatatype()
Test that CREATE/ALTER TABLE can omit the column datatype if there is a
generation clause.
|
void |
test_023_drivingSelect()
Test that you cannot override the value of a generated column via
a driving SELECT--except where the value in the driving SELECT is the
DEFAULT literal.
|
void |
test_024_beforeTriggers()
Test that the NEW variables of BEFORE triggers do not mention generated columns.
|
void |
test_025_basicUpdatableResultSets()
Test that you can't use updatable ResultSets to corrupt generated columns.
|
void |
test_026_onDeleteSetNull()
Test that we correctly handle foreign keys with ON DELETE SET NULL
clauses.
|
void |
test_027_constraintsNoDatatype()
Test that we can put constraints on generated columns when we omit the datatype.
|
void |
test_028_bulkImport()
Test that bulk import works with generated columns.
|
void |
test_029_derby_4145()
Test that we don't get a null pointer exception when generation clauses
have forward references to other generated columns.
|
void |
test_030_derby_4146()
Test that a generated column can refer to an identity column.
|
void |
test_031_derby_4413()
Test INSERT INTO .. select distinct in presence of generated column.
|
void |
test_6361_compilationSchemaDeleted()
Verify that generated columns work even if the compilation schema at
the time of adding the generated columns is dropped.
|
void |
test_6361_compilationSchemaDoesNotExist()
Verify that generated columns can be used even if the schema in which
the generated column was added does not exist.
|
void |
test_6880_return_keys() |
void |
test_derby_4425() |
void |
test_derby_4779() |
void |
test_derby_5749() |
void |
test_derby_6346() |
void |
testDerby_4426()
Test for DERBY-4426
|
void |
testDerby_4448_4451()
Test for DERBY-4448 and DERBY-4451: removal of explicitly given values
for generated column failed if there is more than one row in the VALUES
clause.
|
void |
testDerby_6414()
DERBY-6414 - support updating identity columns with DEFAULT keyword.
|
static java.sql.ResultSet |
triggerReport() |
assertColumnTypes, assertDeterministic, expectExecutionWarning, expectExecutionWarnings, expectInsertRowError, expectNoWarning, expectUpdateRowError, fill, verifyRestrictedDrop, verifyRevokePrivilege
assertCallError, assertCheckTable, assertCommitError, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertResults, assertResults, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, chattyPrepare, chattyPrepareCall, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, dumpRs, dumpRs, emptyStatementCache, executeQuery, expectCompilationError, expectCompilationError, expectExecutionError, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, goodStatement, goodUpdate, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runBare, runBareOverridable, runScript, runScript, runSQLCommands, setAutoCommit, tearDown, usingDB2Client, usingDerbyNetClient, usingEmbedded
alarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSameNullness, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, newAssertionFailedError, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemErr, setSystemOut, setSystemProperty, sleep, sleepAtLeastOneTick, traceit, vmAtLeast
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, setUp, toString
private static final java.lang.String IMPORT_FILE_NAME
private static int _minusCounter
private static java.util.ArrayList<java.lang.String> _triggerReports
private java.lang.String _clearingProcName
private java.lang.String _triggerReportVTIName
public GeneratedColumnsTest(java.lang.String name)
public static junit.framework.Test suite()
public void testDerby_6414() throws java.sql.SQLException
java.sql.SQLException
public void testDerby_4448_4451() throws java.sql.SQLException
java.sql.SQLException
public void testDerby_4426() throws java.sql.SQLException
java.sql.SQLException
public void test_001_determinism_of_stored_system_routines() throws java.lang.Exception
Test that the stored system procedures and functions are non-deterministic. If you want a particular procedure/function to be deterministic, add some logic here.
Also test that, by default, user-defined routines are created as NOT DETERMINISTIC.
java.lang.Exception
public void test_002_determinism_positive() throws java.lang.Exception
Basic positive tests for DETERMINISTIC keyword.
java.lang.Exception
public void test_003_determinism_redundantClause() throws java.lang.Exception
Verify that we get errors when there is more than one determinism clause in a routine declaration.
java.lang.Exception
public void test_004_basicParser() throws java.lang.Exception
Verify basic parse/bind logic for declaring generated columns.
java.lang.Exception
public void test_005_basicInsert() throws java.lang.Exception
Verify basic insert behavior for generated columns.
java.lang.Exception
public void test_006_basicUpdate() throws java.lang.Exception
Verify basic update behavior for generated columns.
java.lang.Exception
public void test_007_basicTriggers() throws java.lang.Exception
Verify basic trigger interaction with generated columns
java.lang.Exception
public void test_008_basicForeignKeys() throws java.lang.Exception
Verify basic interaction of foreign keys with generated columns
java.lang.Exception
public void test_009_basicDefaultInfo() throws java.lang.Exception
Verify that column defaults look good for generated columns.
java.lang.Exception
public void test_010_updateDefaultLiteral() throws java.lang.Exception
Various tests involving the DEFAULT literal in UPDATE statements.
java.lang.Exception
public void test_011_basicAlter() throws java.lang.Exception
Basic tests for altering a table and adding a generated column.
java.lang.Exception
public void test_012_referencedColumns() throws java.lang.Exception
Verify that generated columns can't refer to one another.
java.lang.Exception
public void test_013_badReferences() throws java.lang.Exception
Various miscellaneous illegal create/alter table statements.
java.lang.Exception
public void test_014_assignment() throws java.lang.Exception
Test that the declared datatype of a generated column can be anything that the generation clause can be assigned to. The legal assignments are described in the Reference Guide in the section titled "Data type assignments and comparison, sorting, and ordering". Note that this is a subset of the legal casts described for the CAST operator. Here we are verifying the behavior described in the SQL standard, Part 2, section 11.4, syntax rule 9.
java.lang.Exception
public void test_015_foreignKeyActions() throws java.lang.Exception
Test that delete/update referential actions don't override generated columns.
java.lang.Exception
public void test_016_notNull() throws java.lang.Exception
Test NOT NULL constraints on generated columns.
java.lang.Exception
public void test_017_padding() throws java.lang.Exception
Test padding and truncation of character and fixed decimal data.
java.lang.Exception
public void test_018_alterDatatype() throws java.lang.Exception
Test datatype alteration
java.lang.Exception
public void test_019_dropColumn() throws java.lang.Exception
Test ALTER TABLE DROP COLUMN
java.lang.Exception
public void test_020_alterColumn() throws java.lang.Exception
Test ALTER TABLE ALTER COLUMN
java.lang.Exception
public void test_021_dropFunction() throws java.lang.Exception
Test that generation clauses block the dropping of routines that they depend on.
java.lang.Exception
public void test_022_omitDatatype() throws java.lang.Exception
Test that CREATE/ALTER TABLE can omit the column datatype if there is a generation clause.
java.lang.Exception
public void test_023_drivingSelect() throws java.lang.Exception
Test that you cannot override the value of a generated column via a driving SELECT--except where the value in the driving SELECT is the DEFAULT literal. Make sure that generation clauses behave like autoincrement columns in this respect.
java.lang.Exception
public void test_024_beforeTriggers() throws java.lang.Exception
Test that the NEW variables of BEFORE triggers do not mention generated columns.
java.lang.Exception
TriggerWhenClauseTest.testGeneratedColumns()
public void test_025_basicUpdatableResultSets() throws java.lang.Exception
Test that you can't use updatable ResultSets to corrupt generated columns.
java.lang.Exception
public void test_026_onDeleteSetNull() throws java.lang.Exception
Test that we correctly handle foreign keys with ON DELETE SET NULL clauses. DERBY-3964.
java.lang.Exception
public void test_027_constraintsNoDatatype() throws java.lang.Exception
Test that we can put constraints on generated columns when we omit the datatype. DERBY-3969.
java.lang.Exception
public void test_028_bulkImport() throws java.lang.Exception
Test that bulk import works with generated columns.
java.lang.Exception
public void test_029_derby_4145() throws java.lang.Exception
Test that we don't get a null pointer exception when generation clauses have forward references to other generated columns.
java.lang.Exception
public void test_030_derby_4146() throws java.lang.Exception
Test that a generated column can refer to an identity column.
java.lang.Exception
public void test_031_derby_4413() throws java.lang.Exception
java.lang.Exception
public void test_derby_4425() throws java.lang.Exception
java.lang.Exception
public void test_derby_4779() throws java.lang.Exception
java.lang.Exception
public void test_derby_5749() throws java.lang.Exception
java.lang.Exception
public void test_derby_6346() throws java.lang.Exception
java.lang.Exception
public void test_6880_return_keys() throws java.sql.SQLException
java.sql.SQLException
public void test_6361_compilationSchemaDoesNotExist() throws java.sql.SQLException
java.sql.SQLException
public void test_6361_compilationSchemaDeleted() throws java.sql.SQLException
java.sql.SQLException
private int readMinusCounter(java.sql.Connection conn) throws java.lang.Exception
java.lang.Exception
private void assertTriggerStatus(java.sql.Connection conn, java.lang.String query, java.lang.String[][] rows) throws java.lang.Exception
java.lang.Exception
private void assertDefaultInfo(java.sql.Connection conn, java.lang.String tableName, java.lang.String columnName, java.lang.String[] expectedReferenceColumns, java.lang.String expectedDefaultText) throws java.lang.Exception
Assert that a column has the expected generation clause.
java.lang.Exception
public org.apache.derby.catalog.DefaultInfo getColumnDefault(java.sql.Connection conn, java.lang.String tableName, java.lang.String columnName) throws java.sql.SQLException
Returns the column default for a column.
java.sql.SQLException
public static java.lang.Integer minus(java.lang.Integer a)
public static int readMinusCounter()
public static int signum(int i)
public static void clearTriggerReports()
public static java.sql.ResultSet triggerReport()
public static void showValues(java.lang.String tag, java.lang.Integer a, java.lang.Integer b, java.lang.Integer c)
public static void showValues(java.lang.String tag, java.lang.Integer old_a, java.lang.Integer old_b, java.lang.Integer old_c, java.lang.Integer new_a, java.lang.Integer new_b, java.lang.Integer new_c)
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.