Alecaddd / sequeler

SQL Client built in Vala

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't show data from a table with a dash in the name.

pcoccoli opened this issue · comments

Using sqlite3, I created a table named "test-table" like this:

CREATE TABLE IF NOT EXISTS "test-table"(id INT PRIMARY KEY, name TEXT);
INSERT INTO "test-table" VALUES(1,'pcoccoli');
COMMIT;

When I open it in Sequeler, I get error popup that says near "-": syntax error

I can see the structure of the table in the GUI, but clicking the "Content" button shows the same error.

I assume that the code is not wrapping the table name in double quotes. All identifiers should be wrapped in double quotes when using sqlite3. See https://www.sqlite.org/lang_keywords.html for more information about quoting.

Forgot to mention what version I'm using:

$ flatpak info com.github.alecaddd.sequeler

Sequeler - Friendly SQL Client

          ID: com.github.alecaddd.sequeler
         Ref: app/com.github.alecaddd.sequeler/x86_64/stable
        Arch: x86_64
      Branch: stable
     Version: 0.8.0
     License: GPL-3.0+
      Origin: flathub
  Collection: org.flathub.Stable
Installation: system
   Installed: 157.4 MB
     Runtime: org.gnome.Platform/x86_64/3.36
         Sdk: org.gnome.Sdk/x86_64/3.36

      Commit: 402d4f6672601651d0522b628e810c0a8dcd13ccb5e4bd44b44c8470cc55ec59
      Parent: cb598c1d2705915b40c67ed74c3050692100cfe345fb3091df907ab4d2071edc
     Subject: Release 0.8.0 (8208ea20)
        Date: 2020-10-02 08:36:54 +0000

On RHEL8

I get error near "values": syntax error when opening an SQLite database with the values table. Looks like the same issue.
I guess you should add quotes to entity names in internal SQL queries, so that they don't mess up with keywords.

$ flatpak info com.github.alecaddd.sequeler

Sequeler - Friendly SQL Client

          ID: com.github.alecaddd.sequeler
         Ref: app/com.github.alecaddd.sequeler/x86_64/stable
        Arch: x86_64
      Branch: stable
     Version: 0.8.0
     License: GPL-3.0+
      Origin: flathub
  Collection: org.flathub.Stable
Installation: system
   Installed: 157,4 MB
     Runtime: org.gnome.Platform/x86_64/3.36
         Sdk: org.gnome.Sdk/x86_64/3.36

      Commit: 402d4f6672601651d0522b628e810c0a8dcd13ccb5e4bd44b44c8470cc55ec59
      Parent: cb598c1d2705915b40c67ed74c3050692100cfe345fb3091df907ab4d2071edc
     Subject: Release 0.8.0 (8208ea20)
        Date: 2020-10-02 08:36:54 +0000

OS: CentOS 8