<div dir="ltr"><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">Thanks for the explanation. Maybe I could create a function on the database just to send something sufficiently appeasing to QGIS.</div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">Buona Pasqua!</div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">c</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Apr 1, 2026 at 1:52 PM Régis Haubourg <<a href="mailto:regis.haubourg@gmail.com">regis.haubourg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  
    
  
  <div>
    <p>Hi, </p>
    <p>This is pretty simple, </p>
    <p>QGIS queries a bunch of things against the catalog system table
      to understand the capabilities of the server, tables, access
      privileges and so on. This query fails because pg_is_in_recovery()
      function does not exist in postgres 8.4. on QGIS side, it hasn't
      changed since 2 years:
<a href="https://github.com/qgis/QGIS/commit/d3474e4e2f258676c75bba874485b816b262acc2" target="_blank">https://github.com/qgis/QGIS/commit/d3474e4e2f258676c75bba874485b816b262acc2</a> </p>
    <p>This has nothing to do with the URI. </p>
    <p>GDAL does not need as many system queries because it is not a GUI
      tool, so there is less chances it breaks. </p>
    <p>This has changed between 3.34 and 3.40, to fix a crash 
      <a href="https://github.com/qgis/QGIS/pull/57810" target="_blank">https://github.com/qgis/QGIS/pull/57810</a> </p>
    <p>So, it is probable we don't add a If statement to handle PG 8.4.
      This function landed in 9.0 in postgres.</p>
    <p><br>
    </p>
    <pre cols="72">Cheers
Régis Haubourg</pre>
    <div>On 31/03/2026 22:00, Carlo A. Bertelli
      (Charta s.r.l.) wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">Thanks to
          everyone for replying so quickly to this problem.</div>
        <div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">I totally
          agree with you about the necessity to upgrade PostgreSQL and I
          think it's not a good idea to risk adding bugs to a foundation
          library as GDAL.</div>
        <div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">Anyway, I
          tried version 3.12.3 and it supports reading from a table and
          writing to it without problems. But something changed at least
          on version 4.0.0 for MacOS.</div>
        <div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">While the
          DBManager recognized the table structure, the datasource
          browser doesn't and complains:</div>
        <blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">Error retrieving fields information for
          uri: bname='mydb' host=<span class="gmail_default" style="font-family:arial,sans-serif;font-size:small"></span>d<span class="gmail_default" style="font-family:arial,sans-serif;font-size:small"><a href="http://b.myclientshost.com" target="_blank">b.myclientshost.com</a></span> port=5432
          user='mypooruser' sslmode=disable checkPrimaryKeyUnicity='O'
          table="oneschema". "mypolytable"</blockquote>
        <div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">when
          browsing fields.</div>
        <div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">Maybe it
          has something to do with <span style="font-family:Arial,Helvetica,sans-serif"><b>uri: </b>bname which
            obviously means </span><span style="font-family:Arial,Helvetica,sans-serif"><b>uri:
              dbname</b> but the typo would break something if it is
            used in the code.</span></div>
        <div class="gmail_default" style="font-family:arial,sans-serif;font-size:small"><span style="font-family:Arial,Helvetica,sans-serif">This is the
            PostGIS error I get when retrieving this layer:</span></div>
        <div class="gmail_default" style="font-family:arial,sans-serif;font-size:small"><span style="font-family:Arial,Helvetica,sans-serif"><br>
          </span></div>
        <blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">2026-03-31T21:39:29     WARNING  
           Erroneous query: SELECT has_table_privilege('"oneschema".
          "mypolytable"','SELECT'),pg_is_in_recovery(),current_schema()
          ,has_any_column_privilege('"oneschema".
          "mypolytable"','INSERT'),has_table_privilege('"oneschema".
          "mypolytable"','DELETE'),has_any_column_privilege('"oneschema".
          "mypolytable"','UPDATE'),'f' returned 7 [ERROR: function
          pg_is_in_recovery() does not exist<br>
                       LINE 1: ...vilege('"oneschema".
          "mypolytable"','SELECT'),pg_is_in_r...<br>
                        ^<br>
                       HINT: No function matches the given name and
          argument types. You might need to add explicit type casts.<br>
                       ]<br>
          2026-03-31T21:39:29     WARNING    Unable to determine table
          access privileges for the "oneschema". "mypolytable" relation.<br>
                       The error message from the database was:<br>
                       ERROR: function pg_is_in_recovery() does not
          exist<br>
                       LINE 1: ...vilege('"oneschema".
          "mypolytable"','SELECT'),pg_is_in_r...<br>
                        ^<br>
                       HINT: No function matches the given name and
          argument types. You might need to add explicit type casts.<br>
                       .<br>
                       SQL: SELECT has_table_privilege('"oneschema".
          "mypolytable"','SELECT'),pg_is_in_recovery(),current_schema()
          ,has_any_column_privilege('"oneschema".
          "mypolytable"','INSERT'),has_table_privilege('"oneschema".
          "mypolytable"','DELETE'),has_any_column_privilege('"oneschema".
          "mypolytable"','UPDATE'),'f'<br>
          2026-03-31T21:39:29     WARNING    Erroneous query: SELECT
          has_table_privilege('"oneschema".
          "mypolytable"','SELECT'),pg_is_in_recovery(),current_schema()
          ,has_any_column_privilege('"oneschema".
          "mypolytable"','INSERT'),has_table_privilege('"oneschema".
          "mypolytable"','DELETE'),has_any_column_privilege('"oneschema".
          "mypolytable"','UPDATE'),'f' returned 7 [ERROR: function
          pg_is_in_recovery() does not exist<br>
                       LINE 1: ...vilege('"oneschema".
          "mypolytable"','SELECT'),pg_is_in_r...<br>
                        ^<br>
                       HINT: No function matches the given name and
          argument types. You might need to add explicit type casts.<br>
                       ]<br>
          2026-03-31T21:39:29     WARNING    Unable to determine table
          access privileges for the "oneschema". "mypolytable" relation.<br>
                       The error message from the database was:<br>
                       ERROR: function pg_is_in_recovery() does not
          exist<br>
                       LINE 1: ...vilege('"oneschema".
          "mypolytable"','SELECT'),pg_is_in_r...<br>
                        ^<br>
                       HINT: No function matches the given name and
          argument types. You might need to add explicit type casts.<br>
                       .<br>
                       SQL: SELECT has_table_privilege('"oneschema".
          "mypolytable"','SELECT'),pg_is_in_recovery(),current_schema()
          ,has_any_column_privilege('"oneschema".
          "mypolytable"','INSERT'),has_table_privilege('"oneschema".
          "mypolytable"','DELETE'),has_any_column_privilege('"oneschema".
          "mypolytable"','UPDATE'),'f'<br>
          2026-03-31T21:46:13     WARNING    Erroneous query: SELECT
          has_table_privilege('"oneschema".
          "mypolytable"','SELECT'),pg_is_in_recovery(),current_schema()
          ,has_any_column_privilege('"oneschema".
          "mypolytable"','INSERT'),has_table_privilege('"oneschema".
          "mypolytable"','DELETE'),has_any_column_privilege('"oneschema".
          "mypolytable"','UPDATE'),has_column_privilege('"oneschema".
          "mypolytable"','GEOMETRY','UPDATE') returned 7 [ERROR:
          function pg_is_in_recovery() does not exist<br>
                       LINE 1: ...vilege('"oneschema".
          "mypolytable"','SELECT'),pg_is_in_r...<br>
                        ^<br>
                       HINT: No function matches the given name and
          argument types. You might need to add explicit type casts.<br>
                       ]<br>
          2026-03-31T21:46:13     WARNING    Unable to determine table
          access privileges for the "oneschema". "mypolytable" relation.<br>
                       The error message from the database was:<br>
                       ERROR: function pg_is_in_recovery() does not
          exist<br>
                       LINE 1: ...vilege('"oneschema".
          "mypolytable"','SELECT'),pg_is_in_r...<br>
                        ^<br>
                       HINT: No function matches the given name and
          argument types. You might need to add explicit type casts.<br>
                       .<br>
                       SQL: SELECT has_table_privilege('"oneschema".
          "mypolytable"','SELECT'),pg_is_in_recovery(),current_schema()
          ,has_any_column_privilege('"oneschema".
          "mypolytable"','INSERT'),has_table_privilege('"oneschema".
          "mypolytable"','DELETE'),has_any_column_privilege('"oneschema".
          "mypolytable"','UPDATE'),has_column_privilege('"oneschema".
          "mypolytable"','GEOMETRY','UPDATE')</blockquote>
        <div><br>
        </div>
        <div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">while
          getting the same data by gdalinfo does not need any special
          privilege. I should be able to understand what this repeated
          error means on the SQL side, but it seems a complete nonsense
          to me. I'm sure someone would detect the reason for it. </div>
        <div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">Is there
          a way to mitigate it? I was trying to use a virtual ogr file
          to handle misbehaving columns; I could convert some specific
          table to Spatialite, but I think solving my problem could be
          useful to someone else.</div>
        <div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">Thanks in
          advance for any hint provided.</div>
        <div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">c</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Tue, Mar 31, 2026 at
          8:26 PM Régis Haubourg via QGIS-Developer <<a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">9.1
          has reached end of life 10 years ago!<br>
          I'm with Even here. A Postgres server out of maintenance
          period must be <br>
          considered insecure and outdated and must totally be upgraded
          anyway.<br>
          <br>
          Cheer, Régis<br>
          <br>
          On 31/03/2026 18:14, Stefanos Natsis via QGIS-Developer wrote:<br>
          > One breaking change I'm aware of in QGIS 4 is that we've
          used the <br>
          > `CREATE TABLE IF NOT EXISTS` idiom for the
          `qgis_projects` table (for <br>
          > storing projects in the database) which was introduced in
          PostgreSQL 9.1<br>
          _______________________________________________<br>
          QGIS-Developer mailing list<br>
          <a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
          List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
          Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
        </blockquote>
      </div>
    </blockquote>
  </div>

</blockquote></div>