Feature #1821
Errors in a schema upgrade script that contains multiple SQL statements are not detected
0%
Description
I created a schema upgrade script with multiple statements in one file. When the upgrade started, one of the statements failed with an error visible in the PostgreSQL log, but quasselcore didn't show any errors and just finished the upgrade and increased the schemaversion number in the database anyway.
I believe this is due to the use of watchQuery https://github.com/quassel/quassel/blob/4251006ea8f4433e1c139d380cd6c748b0dfcc84/src/core/abstractsqlstorage.cpp#L272
which calls 'query.lastError().isValid()' just once, which may return the status of one of the successfully-executed statements inside the entire multi-statement query while it has not yet finished executing.
I believe it is not written to work with multi-statement upgrade scripts, each statement must be broken out into a separate file.
History
#2 Updated by Kimberlypark 3 months ago
If a schema upgrade script contains multiple SQL statements, errors in the script may not be detected, which can result in unexpected behavior or data loss during the upgrade process. It is important to carefully review and test all schema upgrade scripts before executing them in a production environment. https://www.skywardalpine.com/
#3 Updated by Lucas5324 about 1 month ago
Description. The SQL AND condition and OR condition can be combined to test for multiple conditions in a SELECT, INSERT, UPDATE, or DELETE statement. When combining these conditions, it is important to use parentheses so that the database knows what order to evaluate each condition. https://www.myallsaversconnect.net/