diff options
author | Narayan Kamath <narayan@google.com> | 2020-07-20 14:10:18 +0100 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-07-20 23:03:12 +0000 |
commit | b21f5630533911b4266578c0895ddfdc5ff25c7f (patch) | |
tree | da137b6faff73a01a14139802fb23b1797188422 | |
parent | 5e54310bd4c503c34441ac505b707403feea0cc6 (diff) | |
download | cts-b21f5630533911b4266578c0895ddfdc5ff25c7f.tar.gz |
Assert that legacy alter table behaviour is the default.
Bug: 147928666
Test: atest SQLiteDatabaseTest
Change-Id: I67a2dedfbe20641459e8796627d1fd39e7d6fbc0
(cherry picked from commit b12e2c7711f3b25eea20d64876cdf3e712ef285c)
-rw-r--r-- | tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java b/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java index 32609e97d37..3856d1d95dc 100644 --- a/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java +++ b/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java @@ -1948,4 +1948,17 @@ public class SQLiteDatabaseTest extends AndroidTestCase { + patchLevel, patchLevel >= EXPECTED_MIN_PATCH_LEVEL); } + // http://b/147928666 + public void testDefaultLegacyAlterTableEnabled() { + mDatabase.beginTransaction(); + mDatabase.execSQL("CREATE TABLE \"t1\" (\"c1\" INTEGER, PRIMARY KEY(\"c1\"));"); + mDatabase.execSQL("CREATE TABLE \"t2\" (\"c1\" INTEGER);"); + mDatabase.execSQL("CREATE VIEW \"v1\" AS SELECT c1 from t1;"); + mDatabase.execSQL("DROP TABLE t1;"); + // The following statement will fail to execute without the legacy flag because + // we have a view in the schema with a dangling reference to a table that doesn't + // exist any more. + mDatabase.execSQL("ALTER TABLE \"t2\" RENAME TO \"t1\";"); + mDatabase.endTransaction(); + } } |