Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSqlTableModel() empty on Ubuntu but works on Windows ?
Forum Updated to NodeBB v4.3 + New Features

QSqlTableModel() empty on Ubuntu but works on Windows ?

Scheduled Pinned Locked Moved Solved General and Desktop
qsqltablemodelqsqldatabasepostgresql
41 Posts 4 Posters 8.6k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #32

    Would you be able to provide a small step by step guide to reproduce your test database ? Meaning the command you are currently using on your Linux machine to create the role and the database.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    R 1 Reply Last reply
    0
    • SGaistS SGaist

      Would you be able to provide a small step by step guide to reproduce your test database ? Meaning the command you are currently using on your Linux machine to create the role and the database.

      R Offline
      R Offline
      R-P-H
      wrote on last edited by R-P-H
      #33

      @SGaist Hi, I just use psql to create the database/table/user.

      CREATE DATABASE my_db
          WITH 
          OWNER = postgres
          ENCODING = 'UTF8'
          TABLESPACE = pg_default
          CONNECTION LIMIT = -1;
      
      CREATE ROLE my_user WITH
        LOGIN
        NOSUPERUSER
        INHERIT
        NOCREATEDB
        NOCREATEROLE
        NOREPLICATION
        ENCRYPTED PASSWORD 'md5hidden';
      
      CREATE TABLE public.my_table
      (
          example_column character varying COLLATE pg_catalog."default",
      )
      
      TABLESPACE pg_default;
      
      ALTER TABLE public.my_table OWNER to postgres;
      
      GRANT INSERT, SELECT, DELETE ON TABLE public.my_table TO my_user;
      

      So for example:

      sudo -u postgres psql -c 'one of the above blocks of code'
      

      So here my_db is the database name, my_user is the role I'm using to access the table and my_table is the table name.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        R-P-H
        wrote on last edited by
        #34

        Is there anything else I can try ?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #35

          Sorry I did not had time to test the database.

          One thing that you could try (I don't think it would change anything but worth a try), reorder the database setup and add your custom role and it setup both at the end.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          R 1 Reply Last reply
          0
          • SGaistS SGaist

            Sorry I did not had time to test the database.

            One thing that you could try (I don't think it would change anything but worth a try), reorder the database setup and add your custom role and it setup both at the end.

            R Offline
            R Offline
            R-P-H
            wrote on last edited by
            #36

            @SGaist said in QSqlTableModel() empty on Ubuntu but works on Windows ?:

            Sorry I did not had time to test the database.

            One thing that you could try (I don't think it would change anything but worth a try), reorder the database setup and add your custom role and it setup both at the end.

            I guess I could try that but why would the error be

            QSqlError("", "Unable to find table logs", "")
            

            then ?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #37

              Gut feeling: PostgreSQL namespace.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              R 1 Reply Last reply
              0
              • SGaistS SGaist

                Gut feeling: PostgreSQL namespace.

                R Offline
                R Offline
                R-P-H
                wrote on last edited by
                #38

                @SGaist said in QSqlTableModel() empty on Ubuntu but works on Windows ?:

                Gut feeling: PostgreSQL namespace.

                I had a look, but I don't quite understand how it applies to this...

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #39

                  The database role must have access to the namespace in order to access the relation it contains.

                  There might be a glitch there.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  R 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    The database role must have access to the namespace in order to access the relation it contains.

                    There might be a glitch there.

                    R Offline
                    R Offline
                    R-P-H
                    wrote on last edited by
                    #40

                    @SGaist said in QSqlTableModel() empty on Ubuntu but works on Windows ?:

                    The database role must have access to the namespace in order to access the relation it contains.

                    There might be a glitch there.

                    Yet the same role (same exact application/code) works fine on Windows ?

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      R-P-H
                      wrote on last edited by
                      #41

                      Upgrading to Qt Version 5.15+ solved the issue.

                      1 Reply Last reply
                      1

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved