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 Tuesday, May 27th 2025

PostgreSQL support array[] type

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 511 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 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

    Christian EhrlicherC 1 Reply Last reply
    0
    • R Reishu

      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

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 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
      0
      • Christian EhrlicherC Christian Ehrlicher

        @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 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

        Christian EhrlicherC 1 Reply Last reply
        0
        • R Reishu

          @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

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 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
          0
          • Christian EhrlicherC Christian Ehrlicher

            @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 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

            Christian EhrlicherC 1 Reply Last reply
            0
            • R Reishu

              @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

              Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 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

              • Login

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