You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Browse Data table returns ascending order by _rowid_ first time but descending order afterwards #641
When opening the "Browse Data" tab the first time, then selecting a table from the drop down, it automatically shows the data for the table in ascending order by 'rowid'.
I can tell by watching the SQL log window, it shows these SQL statements:
SELECT COUNT() FROM (SELECT _rowid_, FROM ConfigInfo ORDER BY _rowid_ ASC);
SELECT _rowid_,* FROM ConfigInfo ORDER BY _rowid_ ASC LIMIT 0, 50000;
If I then click on the "Execute SQL" tab, then click back to the "Browse Data" tab, it shows the data for the table in descending order by 'rowid'
The SQL log window now shows these five new statements:
SELECT type,name,sql,tbl_name FROM sqlite_master UNION SELECT type,name,sql,tbl_name FROM sqlite_temp_master;
SELECT COUNT() FROM (SELECT _rowid_, FROM ConfigInfo ORDER BY _rowid_ ASC);
SELECT _rowid_,* FROM ConfigInfo ORDER BY _rowid_ ASC LIMIT 0, 50000;
SELECT COUNT() FROM (SELECT _rowid_, FROM ConfigInfo ORDER BY _rowid_ DESC);
SELECT _rowid_,* FROM ConfigInfo ORDER BY _rowid_ DESC LIMIT 0, 50000;
You can see the last one was ordering 'DESC'.
I believe it should not be changing the order like this, and just use 'ASC' order.
@revolter Just tried here with the latest build too, loading a table, then going to Browse Data, then running a UNION SELECT query on it via the Execute SQL tab, then going back to Browse Data.
The ordering is keeping constant for me.
@ejohn54 If you can spare the time to check the latest nightly build, it would really help. If you need a Win64 package, then this one from earlier today (solving a different issue, but it's good) has our latest code:
Again I can see it changing the order by to DESC in the SQL log window.
SELECT type,name,sql,tbl_name FROM sqlite_master UNION SELECT type,name,sql,tbl_name FROM sqlite_temp_master;
SELECT COUNT() FROM (SELECT _rowid_, FROM BinaryFile ORDER BY _rowid_ ASC);
SELECT _rowid_,* FROM BinaryFile ORDER BY _rowid_ ASC LIMIT 0, 50000;
SELECT COUNT() FROM (SELECT _rowid_, FROM BinaryFile ORDER BY _rowid_ DESC);
SELECT _rowid_,* FROM BinaryFile ORDER BY _rowid_ DESC LIMIT 0, 50000;
The Win32 version just does not execute these last two SQL statements, but the Win64 version does.
We'd probably need to look at our SQL statement generation code, and look at what controls the ASC/DESC piece. It could be something like a bitmask going wrong, or maybe a variable being overwritten when it shouldn't be? They sound like the potential data type screw ups that might happen with 32→64 bit.
Hmmm, Qt has some ability to "Set a watch on a variable" doesn't it? That might be the go?
Activity
justinclift commentedon Jul 8, 2016
Well, that definitely sounds like a bug. 😉
Btw, which version is this on?
ejohn54 commentedon Jul 8, 2016
It was with version 3.8.0, 64 bit version for Windows. Sorry I haven't tried any nightly build.
revolter commentedon Jul 15, 2016
I can't reproduce this with the latest build.
@justinclift, Wasn't it fixed after
3.8.0?@ejohn54, Could you please try the latest nightly build?
justinclift commentedon Jul 15, 2016
@revolter Just tried here with the latest build too, loading a table, then going to Browse Data, then running a UNION SELECT query on it via the Execute SQL tab, then going back to Browse Data.
The ordering is keeping constant for me.
@ejohn54 If you can spare the time to check the latest nightly build, it would really help. If you need a Win64 package, then this one from earlier today (solving a different issue, but it's good) has our latest code:
http://nightlies.sqlitebrowser.org/win64-onceoffs/sqlitebrowser-win64-issue621v3-201607151423.exe
ejohn54 commentedon Jul 15, 2016
Hi I just tried these two nightly versions.
The Win64 version from http://nightlies.sqlitebrowser.org/win64-onceoffs/ still has this issue occur.
The Win32 version from http://sqlitebrowser.oldsch00l.com/sqlitebrowser.exe.zip seems to work fine.
Again I can see it changing the order by to DESC in the SQL log window.
SELECT type,name,sql,tbl_name FROM sqlite_master UNION SELECT type,name,sql,tbl_name FROM sqlite_temp_master;
SELECT COUNT() FROM (SELECT
_rowid_, FROMBinaryFileORDER BY_rowid_ASC);SELECT
_rowid_,* FROMBinaryFileORDER BY_rowid_ASC LIMIT 0, 50000;SELECT COUNT() FROM (SELECT
_rowid_, FROMBinaryFileORDER BY_rowid_DESC);SELECT
_rowid_,* FROMBinaryFileORDER BY_rowid_DESC LIMIT 0, 50000;The Win32 version just does not execute these last two SQL statements, but the Win64 version does.
justinclift commentedon Jul 15, 2016
@ejohn54 Thanks! 😄
@revolter Looks like we still have the problem then. 😦
revolter commentedon Jul 15, 2016
Is it a 64bit related issue? I have no idea what 64 implies (and breaks) related to code.
justinclift commentedon Jul 15, 2016
Yeah... same here. 😦
We'd probably need to look at our SQL statement generation code, and look at what controls the ASC/DESC piece. It could be something like a bitmask going wrong, or maybe a variable being overwritten when it shouldn't be? They sound like the potential data type screw ups that might happen with 32→64 bit.
Hmmm, Qt has some ability to "Set a watch on a variable" doesn't it? That might be the go?
revolter commentedon Jul 15, 2016
@innermous Any idea / hints with this one?
vtronko commentedon Jul 15, 2016
@revolter I am working on another rowid issue right now, can't help much.
chrisjlocke commentedon Aug 25, 2022
Closing as this issue has been resolved.