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. PostgreSQL support array[] type
Forum Update on Monday, May 27th 2025

PostgreSQL support array[] type

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 509 Views
  • 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.
  • R Offline
    R Offline
    Reishu
    wrote on 15 Feb 2023, 17:03 last edited by
    #1

    Hello,
    Does Qt support query with array[] args?
    My task requires a query like this

    select * func(array[3, 4], array[some binary data, some binary data])
    

    I tried to make a concat string, but didn't get a good result. psql driver message said me a about invalid characters utf-8, about slashes, about quotes, null's etc. I think that transform binary data to string query is bad choice. libpq contains native api on C for this, but i can't make a good parameters format for that
    Help me, pls

    C 1 Reply Last reply 15 Feb 2023, 17:35
    0
    • R Reishu
      15 Feb 2023, 17:03

      Hello,
      Does Qt support query with array[] args?
      My task requires a query like this

      select * func(array[3, 4], array[some binary data, some binary data])
      

      I tried to make a concat string, but didn't get a good result. psql driver message said me a about invalid characters utf-8, about slashes, about quotes, null's etc. I think that transform binary data to string query is bad choice. libpq contains native api on C for this, but i can't make a good parameters format for that
      Help me, pls

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 15 Feb 2023, 17:35 last edited by
      #2

      @Reishu Please show a minimal, compilable example from what you did with Qt and why it is needed.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      R 1 Reply Last reply 15 Feb 2023, 18:20
      0
      • C Christian Ehrlicher
        15 Feb 2023, 17:35

        @Reishu Please show a minimal, compilable example from what you did with Qt and why it is needed.

        R Offline
        R Offline
        Reishu
        wrote on 15 Feb 2023, 18:20 last edited by
        #3

        @Christian-Ehrlicher This is not done on Qt, because it is not clear if the driver supports it.

        why it is needed? Becase postgresql support array[] type in args. I wrote a typical query example

        C 1 Reply Last reply 15 Feb 2023, 18:33
        0
        • R Reishu
          15 Feb 2023, 18:20

          @Christian-Ehrlicher This is not done on Qt, because it is not clear if the driver supports it.

          why it is needed? Becase postgresql support array[] type in args. I wrote a typical query example

          C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 15 Feb 2023, 18:33 last edited by
          #4

          @Reishu said in PostgreSQL support array[] type:

          This is not done on Qt, because it is not clear if the driver supports it.

          So why not try it out instead doing wild guesses?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          R 1 Reply Last reply 15 Feb 2023, 20:17
          0
          • C Christian Ehrlicher
            15 Feb 2023, 18:33

            @Reishu said in PostgreSQL support array[] type:

            This is not done on Qt, because it is not clear if the driver supports it.

            So why not try it out instead doing wild guesses?

            R Offline
            R Offline
            Reishu
            wrote on 15 Feb 2023, 20:17 last edited by Reishu
            #5

            @Christian-Ehrlicher said in PostgreSQL support array[] type:

            So why not try it out instead doing wild guesses?

            ok, i write some details for you, which I did before creating the question

            • first, i'm check a documentation https://doc.qt.io/qt-6/sql-types.html - no support this type
            • second, i'm check source code of psql driver https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/sqldrivers/psql/qsql_psql.cpp?h=dev - no support PQexecParams \ PQsendQueryParams of libpq api
            • third, the only way is make an array[] what i find - concat data in resulting query string. But this is bad, rly. Do not do it

            But, Maybe I was wrong and anyone solve this problem? any driver extension? etc

            C 1 Reply Last reply 15 Feb 2023, 20:23
            0
            • R Reishu
              15 Feb 2023, 20:17

              @Christian-Ehrlicher said in PostgreSQL support array[] type:

              So why not try it out instead doing wild guesses?

              ok, i write some details for you, which I did before creating the question

              • first, i'm check a documentation https://doc.qt.io/qt-6/sql-types.html - no support this type
              • second, i'm check source code of psql driver https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/sqldrivers/psql/qsql_psql.cpp?h=dev - no support PQexecParams \ PQsendQueryParams of libpq api
              • third, the only way is make an array[] what i find - concat data in resulting query string. But this is bad, rly. Do not do it

              But, Maybe I was wrong and anyone solve this problem? any driver extension? etc

              C Offline
              C Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 15 Feb 2023, 20:23 last edited by
              #6

              @Reishu said in PostgreSQL support array[] type:

              But, Maybe I was wrong and anyone solve this problem? any driver extension? etc

              Not when you think you need those parameters to execute your query. I don't even know what it should do and why it's needed.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0

              1/6

              15 Feb 2023, 17:03

              • Login

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