<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Robin,</p>
    <p>- output of "gdalinfo --version" ?</p>
    <p>- try adding ``--config PG_USE_COPY YES`` to  the command line
      where you append to the existing table. Cf
      <a class="moz-txt-link-freetext" href="https://gdal.org/drivers/vector/pg.html#configuration-options">https://gdal.org/drivers/vector/pg.html#configuration-options</a>
      (copy mode is enabled by default at table creation, but not in
      append scenarios)</p>
    <p>- if the above didn't help, try also setting ``--config
      OGR2OGR_USE_ARROW_API NO`` (please report if that makes a
      difference)</p>
    <p>Even<br>
    </p>
    <div class="moz-cite-prefix">Le 14/03/2024 à 18:28, Robin Wilson via
      gdal-dev a écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:etPan.65f333e1.4b45c336.53d@rtwilson.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <style>body{font-family:Helvetica,Arial;font-size:13px}</style>
      <div style="font-family:Helvetica,Arial;font-size:13px; ">Hi,</div>
      <div style="font-family:Helvetica,Arial;font-size:13px; "><br>
      </div>
      <div style="font-family:Helvetica,Arial;font-size:13px; ">I’ve
        been using ogr2ogr to import vector datasets into PostGIS
        tables.</div>
      <div style="font-family:Helvetica,Arial;font-size:13px; "><br>
      </div>
      <div style="font-family:Helvetica,Arial;font-size:13px; ">I
        originally tried this using a local Postgres server, and ran the
        following commands to import one file into a PostGIS table, and
        then append the contents of another file to the same table:</div>
      <div style="font-family:Helvetica,Arial;font-size:13px; "><br>
      </div>
      <div style="font-family:Helvetica,Arial;font-size:13px; ">ogr2ogr
        --debug ON -f PostgreSQL PG:”host=localhost user=postgres
        password=blah dbname=test_db" buildings1.gpkg -nln ogr_test</div>
      <div style="font-family:Helvetica,Arial;font-size:13px; ">
        <div style="margin: 0px;">ogr2ogr -append -update --debug ON -f
          PostgreSQL PG:”host=localhost user=postgres password=blah
          dbname=test_db" buildings2.gpkg -nln ogr_test</div>
      </div>
      <div class="bloop_container">
        <div class="bloop_frame"> </div>
      </div>
      <br>
      <div class="gmail_signature">This works fine, and both commands
        run quickly.</div>
      <div class="gmail_signature"><br>
      </div>
      <div class="gmail_signature">I then tried the same thing, but with
        a PostGIS server hosted on Azure. Obviously I expect things to
        take longer when accessing across the internet, but this time
        the first command completed quickly, but the second command
        seems to hang. Looking at the debug output, it shows:</div>
      <div class="gmail_signature"><br>
      </div>
      <div class="gmail_signature">
        <div class="gmail_signature">GPKG: GeoPackage v1.2.0</div>
        <div class="gmail_signature">GDAL: GDALOpen(buildings2.gpkg,
          this=0x131011800) succeeds as GPKG.</div>
        <div class="gmail_signature">PG: Client encoding: 'UTF8'</div>
        <div class="gmail_signature">PG: PostGIS schema: 'public'</div>
        <div class="gmail_signature">PG: PostgreSQL version string :
          'PostgreSQL 15.4 on x86_64-pc-linux-gnu, compiled by gcc
          (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit'</div>
        <div class="gmail_signature">PG: PostGIS version string : '3.3
          USE_GEOS=1 USE_PROJ=1 USE_STATS=1'</div>
        <div class="gmail_signature">GDAL: GDALOpen(PG:<connection
          string>, this=0x140f25850) succeeds as PostgreSQL.</div>
        <div class="gmail_signature">PG: Primary key name (FID): fid,
          type : int4</div>
        <div class="gmail_signature">PG: Using column 'fid' as FID for
          table 'ogr_test'</div>
        <div class="gmail_signature">OGR2OGR: Using WriteArrowBatch()</div>
        <div class="gmail_signature"><br>
        </div>
        <div class="gmail_signature">and then nothing else.</div>
        <div class="gmail_signature"><br>
        </div>
        <div class="gmail_signature">I’m intrigued as to why it seems to
          hang, and what it is doing, or trying to do. I’ve tried adding
          buildings2.gpkg to a new table on the Azure PostGIS server and
          it completes very quickly, so it’s not just that buildings2 is
          larger and takes a long time to upload. Similarly, merging the
          two buildings files with ogrmerge.py and then running the
          ogr2ogr command to import to PostGIS also works, and runs
          quickly.</div>
        <div class="gmail_signature"><br>
        </div>
        <div class="gmail_signature">I’m also intrigued as to why this
          only seems to be happening with the Azure server - is there
          some configuration option I need to set? I’ve tried connecting
          as the ‘postgres’ root user, so it shouldn’t be a permissions
          issue.</div>
        <div class="gmail_signature"><br>
        </div>
        <div class="gmail_signature">Any ideas or suggestions of things
          to try?</div>
        <div class="gmail_signature"><br>
        </div>
        <div class="gmail_signature">Any help gratefully received,</div>
        <div class="gmail_signature"><br>
        </div>
        <div class="gmail_signature">
          <div class="gmail_signature">Best regards,</div>
          <div class="gmail_signature"><br>
          </div>
          <div class="gmail_signature">Robin</div>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>