sqlitebrowser icon indicating copy to clipboard operation
sqlitebrowser copied to clipboard

Brackets in CHECK-statement confuses database structure view

Open imolb opened this issue 6 years ago • 2 comments

Details for the issue

What did you do?

Execute the following SQL-Statement in a new created database in the "Execute SQL" tab.

CREATE TABLE "TestTableOk" (
                    "TestDate"               REAL CONSTRAINT TestDate_is_valid
                                                CHECK((TestDate IS NULL) OR 
                                                    (TestDate IS NULL AND TestDate IS NULL))
                );
CREATE TABLE "TestTableFailure" (
                    "TestDate"               REAL CONSTRAINT TestDate_is_valid
                                                CHECK(TestDate IS NULL OR 
                                                    (TestDate IS NULL AND TestDate IS NULL))
                )

It's twice the same table, just the brackets in the CHECK statement are different.

What did you expect to see?

I'd expect to see in the tab "Database Structure" the structure for both tables.

What did you see instead?

Only the structure for the table TestTableOk is shown, but not for TestTableFailure.

Useful extra information

DB4S v3.11.2 [built for x86_64-little_endian-lp64] on Ubuntu 20.04.1 LTS (linux/5.4.0-48-generic) [x86_64] using SQLite Version 3.31.1 and Qt 5.12.5

imolb avatar Oct 24 '20 18:10 imolb

This sounds like our SQL parser fails to parse the TestTableFailure structure. The good news is that we have rewritten the parser to fix these issues. I have just tried your example with the latest version and both tables work as expected. Unfortunately Ubuntu only seems to ship DB4S 3.11.2 at the moment. You could use this PPA though to install DB4S 3.12.0 which should fix your problem: https://github.com/sqlitebrowser/sqlitebrowser#ubuntu-and-derivatives Does that work for you? Let us know if you need any assistance with this :smile:

MKleusberg avatar Oct 25 '20 10:10 MKleusberg

I can confirm with the update to DB4S 3.12.0. the defect is fixed. Thanks for the very fast problem solution!

imolb avatar Oct 28 '20 09:10 imolb