Fixed
Status Update
Comments
yb...@google.com <yb...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 11a3cb30e7c9067a27eb10bf96e89afdc283ba2e
Author: pingxuanli <pingxuanli@google.com>
Date: Mon Aug 22 13:03:03 2022
Adding error message check in EntityUpsertionAdapter.
Bug: 243039555
Test: Tests are in EntityUpsertionAdapterTest file. By using toy, can check for foreign key constraint. (FK violation is commented out to prevent crash but the errors were thrown correctly)
Relnote: restrict the minimum version that supports Upsert to at least 16
Change-Id: I5f67f2ab5d41a313c48dac42f485f8345f74c1b1
M room/room-common/api/current.txt
M room/room-runtime/api/restricted_current.txt
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/DaoConflictStrategyTest.java
M room/room-common/src/main/java/androidx/room/Upsert.kt
M room/room-common/api/public_plus_experimental_current.txt
M room/room-runtime/api/current.txt
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/LiveDataQueryTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/EntityUpsertionAdapterTest.java
M room/room-runtime/api/public_plus_experimental_current.txt
M room/room-runtime/src/main/java/androidx/room/EntityUpsertionAdapter.kt
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/vo/Toy.java
M room/room-common/api/restricted_current.txt
https://android-review.googlesource.com/2191947
Branch: androidx-main
commit 11a3cb30e7c9067a27eb10bf96e89afdc283ba2e
Author: pingxuanli <pingxuanli@google.com>
Date: Mon Aug 22 13:03:03 2022
Adding error message check in EntityUpsertionAdapter.
Bug: 243039555
Test: Tests are in EntityUpsertionAdapterTest file. By using toy, can check for foreign key constraint. (FK violation is commented out to prevent crash but the errors were thrown correctly)
Relnote: restrict the minimum version that supports Upsert to at least 16
Change-Id: I5f67f2ab5d41a313c48dac42f485f8345f74c1b1
M room/room-common/api/current.txt
M room/room-runtime/api/restricted_current.txt
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/DaoConflictStrategyTest.java
M room/room-common/src/main/java/androidx/room/Upsert.kt
M room/room-common/api/public_plus_experimental_current.txt
M room/room-runtime/api/current.txt
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/LiveDataQueryTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/EntityUpsertionAdapterTest.java
M room/room-runtime/api/public_plus_experimental_current.txt
M room/room-runtime/src/main/java/androidx/room/EntityUpsertionAdapter.kt
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/vo/Toy.java
M room/room-common/api/restricted_current.txt
ba...@lamelcolor.ch <ba...@lamelcolor.ch> #3
This bug was linked in a change in the following release(s):
androidx.room:room-common:2.5.0-beta01
androidx.room:room-runtime:2.5.0-beta01
el...@google.com <el...@google.com> #4
This fix is also preventing the update when there is a uniqueness conflict on an index (code 2067 SQLITE_CONTRAINT_UNIQUE). In this case `checkUniquenessException(ex)` rethrows the exception. Is it expected ?
ba...@lamelcolor.ch <ba...@lamelcolor.ch> #5
Thanks for the comment, indeed checkUniquenessException
should not throw for SQLITE_CONSTRAINT_UNIQUE
as per the SQLite docs:
The special UPSERT processing happens only for uniqueness constraint on the table that is receiving the INSERT. A "uniqueness constraint" is an explicit UNIQUE or PRIMARY KEY constraint within the CREATE TABLE statement, or a unique index. UPSERT does not intervene for failed NOT NULL or foreign key constraints or for constraints that are implemented using triggers.
In
We'll make a fix to includes SQLITE_CONSTRAINT_UNIQUE
as part of the 'uniqueness constraint' that will lead to an UPDATE
.
ev...@gmail.com <ev...@gmail.com> #6
Thanks for the update, really appreciate it !
ba...@lamelcolor.ch <ba...@lamelcolor.ch> #7
Hello,
I've just hit this issue and I would like to know what's the status on handling 2067 SQLITE_CONSTRAINT_UNIQUE the same way and proceed to an update. I was very surprised upsert wasn't working.
Thanks
I've just hit this issue and I would like to know what's the status on handling 2067 SQLITE_CONSTRAINT_UNIQUE the same way and proceed to an update. I was very surprised upsert wasn't working.
Thanks
el...@google.com <el...@google.com> #8
Thanks for the bump, we'll resolve this issue asap.
el...@google.com <el...@google.com> #9
Project: platform/frameworks/support
Branch: androidx-main
commit 01002bedc549e0264a5f920dc554ed7dd7785cfe
Author: elifbilgin <elifbilgin@google.com>
Date: Tue Aug 01 05:53:50 2023
Handle special case SQLite exception during upsert.
When 2067 SQLITE_CONSTRAINT_UNIQUE is thrown during an upsert, upsert should perform an update.
Bug: 243039555
Test: EntityUpsertionAdapterTest.java
Change-Id: If28499c59443f590ac456924eff03b18f1a87e4f
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/EntityUpsertionAdapterTest.java
M room/room-runtime/src/main/java/androidx/room/EntityUpsertionAdapter.kt
https://android-review.googlesource.com/2686153
Branch: androidx-main
commit 01002bedc549e0264a5f920dc554ed7dd7785cfe
Author: elifbilgin <elifbilgin@google.com>
Date: Tue Aug 01 05:53:50 2023
Handle special case SQLite exception during upsert.
When 2067 SQLITE_CONSTRAINT_UNIQUE is thrown during an upsert, upsert should perform an update.
Bug: 243039555
Test: EntityUpsertionAdapterTest.java
Change-Id: If28499c59443f590ac456924eff03b18f1a87e4f
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/EntityUpsertionAdapterTest.java
M room/room-runtime/src/main/java/androidx/room/EntityUpsertionAdapter.kt
ba...@lamelcolor.ch <ba...@lamelcolor.ch> #10
It is to say it's not a error by oversight.
el...@google.com <el...@google.com> #11
Could you share the AutoMigration implementation that is getting generated? It should be located somewhere in the /build/generated/ap_generated_sources/ directory.
ap...@google.com <ap...@google.com> #12
Project: platform/frameworks/support
Branch: androidx-main
commit 87c1e43b72f3eaa6342fe7afe9136e4994b8d055
Author: Elif Bilgin <elifbilgin@google.com>
Date: Mon Jul 19 10:05:33 2021
Resolving Auto-Migration error when a new column is added to an embedded Entity between versions.
This fix is particularly for the issue when the nullability of a column that is in an embedded entity is misinterpreted, generating an auto migration with missing default values.
Bug: 193798291
Test: AutoMigrationTest.java
Change-Id: I5fcb1bcf6bf0af9763ed90aea6ec4f25581ca63d
A room/integration-tests/testapp/schemas/androidx.room.integration.testapp.migration.EmbeddedAutoMigrationDb/2.json
A room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/migration/EmbeddedAutoMigrationDb.java
M room/room-compiler/src/main/kotlin/androidx/room/writer/AutoMigrationWriter.kt
A room/integration-tests/testapp/schemas/androidx.room.integration.testapp.migration.EmbeddedAutoMigrationDb/1.json
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/migration/AutoMigrationTest.java
https://android-review.googlesource.com/1771292
Branch: androidx-main
commit 87c1e43b72f3eaa6342fe7afe9136e4994b8d055
Author: Elif Bilgin <elifbilgin@google.com>
Date: Mon Jul 19 10:05:33 2021
Resolving Auto-Migration error when a new column is added to an embedded Entity between versions.
This fix is particularly for the issue when the nullability of a column that is in an embedded entity is misinterpreted, generating an auto migration with missing default values.
Bug: 193798291
Test: AutoMigrationTest.java
Change-Id: I5fcb1bcf6bf0af9763ed90aea6ec4f25581ca63d
A room/integration-tests/testapp/schemas/androidx.room.integration.testapp.migration.EmbeddedAutoMigrationDb/2.json
A room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/migration/EmbeddedAutoMigrationDb.java
M room/room-compiler/src/main/kotlin/androidx/room/writer/AutoMigrationWriter.kt
A room/integration-tests/testapp/schemas/androidx.room.integration.testapp.migration.EmbeddedAutoMigrationDb/1.json
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/migration/AutoMigrationTest.java
Description
Component used: Room auto migration Version used: 2.4.0-alpha02 Devices/Android versions reproduced on: Samsung xcover 4s / android 10
This problem occur when I have add a new column in a entity. Auto migration add this columns for the entity, but it is not pass to the entity where the object entity is embedded.
For make this error try to make auto migration when you add a new columns to a embedded entity.
This error not occur because I have no change my db version.