rssguard icon indicating copy to clipboard operation
rssguard copied to clipboard

[BUG]: Articles cannot be deleted from database

Open TopologicalPhonon opened this issue 10 months ago • 4 comments

Brief description of the issue

Table 'Messages' has a foreign key relationship with table 'backup_Accounts' which does not exist. Attemping to delete rows using sqlite browser, for instance, results in "no such table: main.backup_Accounts". This was probably introduced when db_update_sqlite_1_2.sql renamed the Accounts table.

Tables Categories, Labels, and MessageFiltersInFeeds also have a FK to 'backup_Accounts'.

How to reproduce the bug?

Open database.db in sqlite browser. Select the Messages table. Select a row. Press delete button.

What was the expected result?

The row would be deleted.

What actually happened?

Error deleting record: Result: no such table: main.backup_Accounts

Debug log

N/A

Operating system and version

OS: Linux (Devuan Daedalus) RSS Guard version: 4.8.3 (locally compiled & installed). The database was likely created by v4.0.4.

TopologicalPhonon avatar May 26 '25 16:05 TopologicalPhonon

It seems this would also mean that when an Account is deleted, "child" rows are not cascade-deleted as intended.

TopologicalPhonon avatar May 26 '25 17:05 TopologicalPhonon

"backup_*" tables are generated when automatica DB schema migration happens. In your case, some bug or error probably happened when migration was running and was not completed properly, therefore your DB file now is inconsistent. Use backups which are automatically generated (before each migration happens) in the folder with your database file.

martinrotter avatar May 27 '25 05:05 martinrotter

When Account was renamed to backup_Account, that changed the FK relationships too. Creating a new Account table doesn't change those relationships back. See sections 2 & 7 here.

TopologicalPhonon avatar May 27 '25 11:05 TopologicalPhonon

I did alter table Accounts rename to backup_Accounts; and then alter table backup_Accounts rename to Accounts; and it fixed the FK relationships. This works even if an account had been deleted while the FK relationships were broken. In that case sqlite's foreign_key_check will show all the orphaned rows.

TopologicalPhonon avatar Jun 04 '25 13:06 TopologicalPhonon

RSS Guard 5.0 will have completely new DB schema and yes, this kind of error could be there, but when foreign_key_check is explicitly turned off and then on after migration between 4.x line DB metaversions, it should all be fine.

I will close this and make sure to double test when there are any DB migrations in the future, thanks.

martinrotter avatar Oct 01 '25 07:10 martinrotter