Bug 392112 - Deleted physical tables still visible in project navigator
Summary: Deleted physical tables still visible in project navigator
Status: CLOSED FIXED
Alias: None
Product: KEXI
Classification: Applications
Component: Tables (show other bugs)
Version: 3.1.0
Platform: Other Linux
: NOR normal
Target Milestone: 3.2
Assignee: Jarosław Staniek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-20 21:20 UTC by Jarosław Staniek
Modified: 2023-09-03 20:47 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 3.2.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jarosław Staniek 2018-03-20 21:20:38 UTC
Deleted physical table is still visible in project navigator.

To reproduce (example for sqlite3):

1. Create a new table in a KEXI project, save and close the project.
2. Delete the table in low-level tool such as sqlite3 or sqlite browser
3. Re-open the project in KEXI

Actual result: table entry is visible and empty grid is opened on click, queries based on the table can be designed and raise error "table not found" in data view

Expected: the table entry is no longer visible in the navigator.
Comment 1 Jarosław Staniek 2018-03-20 21:34:09 UTC
Possible solution at KDb level: on first call to KDbConnection::tableNames() obtain list of physical tables and compare with tables from kexi__objects metadata.
Comment 2 Jarosław Staniek 2018-03-21 13:36:42 UTC
Update: additional fix is needed in KEXI itself in the code loading part items because it's for some reasons separate from KDb.
Comment 3 Jarosław Staniek 2018-04-09 09:54:22 UTC
Git commit 26203c294764c5a388d61836e9baf2fd3b68876f by Jaroslaw Staniek.
Committed on 26/03/2018 at 22:22.
Pushed by staniek into branch 'master'.

Add KDbConnection::drv_getTableNames for low level list of table names, make tableNames() skip names with non-existing physical tables

This change is backward compatible since metadata without physical table is not usable anyway.

FIXED-IN:3.2.0

M  +44   -2    src/KDbConnection.cpp
M  +20   -1    src/KDbConnection.h
M  +5    -0    src/KDbConnectionProxy.cpp
M  +5    -0    src/KDbConnectionProxy.h
M  +10   -1    src/KDbDriverBehavior.h
M  +4    -3    src/drivers/mysql/MysqlDriver.cpp
M  +3    -0    src/drivers/postgresql/PostgresqlDriver.cpp
M  +2    -0    src/drivers/sqlite/SqliteDriver.cpp

https://commits.kde.org/kdb/26203c294764c5a388d61836e9baf2fd3b68876f
Comment 4 Jarosław Staniek 2018-04-09 09:54:22 UTC
Git commit 219c02d1bb58fde744e9150c35914cc594ad3138 by Jaroslaw Staniek.
Committed on 26/03/2018 at 22:22.
Pushed by staniek into branch 'master'.

Add KDbConnection::drv_getTableNames for low level list of table names, make tableNames() skip names with non-existing physical tables

Summary:
- KDbTestUtils: add convenience APIs for connecting and using db, support connection options, use it in parser test
- Add KDbConnection::drv_getTableNames for low level list of table names, make tableNames() skip names with non-existing physical tables
- This change is backward compatible since metadata without physical table is not usable anyway.
FIXED-IN:3.2.0

+ Add autotest for handling missing physical tables

Test Plan: Run ctest

Reviewers: piggz

Tags: #kdb

Differential Revision: https://phabricator.kde.org/D11547

M  +3    -0    autotests/CMakeLists.txt
A  +84   -0    autotests/MissingTableTest.cpp     [License: LGPL (v2+)]
A  +-    --    autotests/data/missingTableTest.kexi

https://commits.kde.org/kdb/219c02d1bb58fde744e9150c35914cc594ad3138
Comment 5 Jarosław Staniek 2018-06-05 22:32:41 UTC
Git commit 83a672c348ca9d263e9739bb3ee5566ca8d5d702 by Jaroslaw Staniek.
Committed on 05/06/2018 at 22:32.
Pushed by staniek into branch 'master'.

Skip table name if physical table is non-existing, use the new tableNames API in migration

Summary:
FIXED-IN:3.2.0

Note: functionality of migration is not affected, it's just the code cleanup thanks to the new API.

Test Plan: Open kdb.git/autotests/data/missingTableTest.kexi, it should not list persons table anymore.

Reviewers: piggz

Tags: #kexi

Differential Revision: https://phabricator.kde.org/D11549

M  +1    -1    CMakeLists.txt
M  +37   -11   src/core/kexiproject.cpp
M  +3    -15   src/migration/KexiSqlMigrate.cpp
M  +0    -3    src/migration/KexiSqlMigrate.h
M  +0    -1    src/migration/mysql/mysqlmigrate.cpp
M  +0    -1    src/migration/postgresql/PostgresqlMigrate.cpp

https://commits.kde.org/kexi/83a672c348ca9d263e9739bb3ee5566ca8d5d702
Comment 6 Jarosław Staniek 2019-01-06 21:23:57 UTC
Git commit 9978d76a494ca4dc6760158ef742660e2b4989cb by Jaroslaw Staniek.
Committed on 06/01/2019 at 21:14.
Pushed by staniek into branch '3.2'.

Add KDbConnection::drv_getTableNames for low level list of table names, make tableNames() skip names with non-existing physical tables

Summary:
- KDbTestUtils: add convenience APIs for connecting and using db, support connection options, use it in parser test
- Add KDbConnection::drv_getTableNames for low level list of table names, make tableNames() skip names with non-existing physical tables
- This change is backward compatible since metadata without physical table is not usable anyway.
FIXED-IN:3.2.0

+ Add autotest for handling missing physical tables

Test Plan: Run ctest

Reviewers: piggz

Tags: #kdb

Differential Revision: https://phabricator.kde.org/D11547

M  +3    -0    autotests/CMakeLists.txt
A  +84   -0    autotests/MissingTableTest.cpp     [License: LGPL (v2+)]
A  +-    --    autotests/data/missingTableTest.kexi

https://commits.kde.org/kdb/9978d76a494ca4dc6760158ef742660e2b4989cb
Comment 7 Jarosław Staniek 2019-01-06 21:23:57 UTC
Git commit e5c3a99d939e9176da8a3d8809a6f48c8186bed8 by Jaroslaw Staniek.
Committed on 06/01/2019 at 21:14.
Pushed by staniek into branch '3.2'.

Add KDbConnection::drv_getTableNames for low level list of table names, make tableNames() skip names with non-existing physical tables

This change is backward compatible since metadata without physical table is not usable anyway.

FIXED-IN:3.2.0

M  +44   -2    src/KDbConnection.cpp
M  +20   -1    src/KDbConnection.h
M  +5    -0    src/KDbConnectionProxy.cpp
M  +5    -0    src/KDbConnectionProxy.h
M  +10   -1    src/KDbDriverBehavior.h
M  +4    -3    src/drivers/mysql/MysqlDriver.cpp
M  +3    -0    src/drivers/postgresql/PostgresqlDriver.cpp
M  +2    -0    src/drivers/sqlite/SqliteDriver.cpp

https://commits.kde.org/kdb/e5c3a99d939e9176da8a3d8809a6f48c8186bed8
Comment 8 Jarosław Staniek 2019-01-06 21:50:07 UTC
Git commit bcebf0787f0e75de019ba92e7730fc57c2b23a30 by Jaroslaw Staniek.
Committed on 06/01/2019 at 21:41.
Pushed by staniek into branch '3.2'.

Skip table name if physical table is non-existing, use the new tableNames API in migration

Summary:
FIXED-IN:3.2.0

Note: functionality of migration is not affected, it's just the code cleanup thanks to the new API.

Test Plan: Open kdb.git/autotests/data/missingTableTest.kexi, it should not list persons table anymore.

Reviewers: piggz

Tags: #kexi

Differential Revision: https://phabricator.kde.org/D11549

# Conflicts:
#	CMakeLists.txt

M  +37   -11   src/core/kexiproject.cpp
M  +3    -15   src/migration/KexiSqlMigrate.cpp
M  +0    -3    src/migration/KexiSqlMigrate.h
M  +0    -1    src/migration/mysql/mysqlmigrate.cpp
M  +0    -1    src/migration/postgresql/PostgresqlMigrate.cpp

https://commits.kde.org/kexi/bcebf0787f0e75de019ba92e7730fc57c2b23a30