Skip to content

Browse Data table returns ascending order by _rowid_ first time but descending order afterwards #641

Closed

Description

@ejohn54

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.

Activity

  1. justinclift commented on Jul 8, 2016

    @justinclift
    Member

    Well, that definitely sounds like a bug. 😉

    Btw, which version is this on?

  2. added
    bugConfirmed bugs or reports that are very likely to be bugs.
    on Jul 8, 2016
  3. ejohn54 commented on Jul 8, 2016

    @ejohn54
    Author

    It was with version 3.8.0, 64 bit version for Windows. Sorry I haven't tried any nightly build.

  4. revolter commented on Jul 15, 2016

    @revolter
    Member

    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?

  5. justinclift commented on Jul 15, 2016

    @justinclift
    Member

    @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

  6. ejohn54 commented on Jul 15, 2016

    @ejohn54
    Author

    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_, 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.

  7. justinclift commented on Jul 15, 2016

    @justinclift
    Member

    @ejohn54 Thanks! 😄

    @revolter Looks like we still have the problem then. 😦

  8. revolter commented on Jul 15, 2016

    @revolter
    Member

    Is it a 64bit related issue? I have no idea what 64 implies (and breaks) related to code.

  9. justinclift commented on Jul 15, 2016

    @justinclift
    Member

    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?

  10. revolter commented on Jul 15, 2016

    @revolter
    Member

    @innermous Any idea / hints with this one?

  11. vtronko commented on Jul 15, 2016

    @vtronko
    Member

    @revolter I am working on another rowid issue right now, can't help much.

  12. chrisjlocke commented on Aug 25, 2022

    @chrisjlocke
    Member

    Closing as this issue has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed bugs or reports that are very likely to be bugs.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions