-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
I've got a table with a Composite PK comprising of 3 columns PRIMARY KEY(`REPORT_DATE`,`PRODUCT`,`TID`)
and it's done as a WITHOUT ROWID
table, since that provides no value in my case.
When I'm browsing the table's data, the SQL Log shows it as:
SELECT `REPORT_DATE`,* FROM `tablename` ORDER BY `REPORT_DATE` ASC LIMIT 0, 50000;
This should be doing the SELECT using all 3 parts of the PK as well as for the ORDER BY clause:
SELECT `REPORT_DATE`,`PRODUCT`,`TID`,* FROM `tablename` ORDER BY `REPORT_DATE` ASC, `PRODUCT` ASC, `TID` ASC LIMIT 0, 50000;
Even more horrifyingly, when I update data in column X of one row via the data browser, it only uses that first PK column REPORT_DATE in its query. So all rows (45k) with that date have the modified data for the column X where I put the change. 😱
UPDATE `tablename` SET `COL_X`=? WHERE REPORT_DATE='2016-05-04';
I've also tested 'Delete Record' and it does the same thing - only using the first column of the PK, so all the rows with that date got deleted. (Yay for no auto commit.)
DELETE FROM `tablename` WHERE `REPORT_DATE` IN ('2016-05-04');
As an aside, there's also a Performance issue: the data browser seems really really slow (53 secs) compared to if I execute either of the 2 SELECT's above (1.1 secs) in the 'Execute SQL' tab.
I'm opening this issue because:
- DB4S is crashing
- DB4S has a bug
- DB4S needs a feature
- DB4S has another problem
I'm using DB4S on:
- Windows: ( version: 7 )
- Linux: ( distro: ___ )
- Mac OS: ( version: ___ )
- Other: ___
I'm using DB4S version:
- 3.10.0-beta1
- 3.9.1
- Other: ___
I have also:
- Tried out the latest nightly version: https://github.com/sqlitebrowser/sqlitebrowser#nightly-builds
- Searched for an existing similar issue: https://github.com/sqlitebrowser/sqlitebrowser/issues?utf8=%E2%9C%93&q=is%3Aissue%20