Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pcoccoli opened this issue Nov 11, 2020 · 2 comments
Open

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

pcoccoli opened this issue Nov 11, 2020 · 2 comments

Comments

@pcoccoli
Copy link

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.

@pcoccoli
Copy link
Author

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

@Himura2la
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants