<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Pekka,</p>
    <p>I suspect you use "ogr2ogr -f PostgreSQL PG:....."</p>
    <p>If you use rather "ogr2ogr -update PG:...." you should be able to
      use -doo (not sure the SET ROLE will work properly in that context
      though)<br>
    </p>
    <p>Even<br>
    </p>
    <div class="moz-cite-prefix">Le 02/07/2021 à 08:52, Pekka Sarkola a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CANgLEnCK=doUUifaTGAha4AdCRBWG+jJUigymp0LLn1cBfYK8g@mail.gmail.com">
      <div dir="ltr">Hi!
        <div><br>
        </div>
        <div>We have a PostGIS database with login roles and group roles
          (like "admins", "editors" and "viewers"). We have defined that
          only "admins" can create new schemas and tables (among other
          privileges). My problem is that I'd like to use ogr2ogr to
          bulk load some data to a PostGIS database using ogr2ogr with a
          certain login role with "admins" role.</div>
        <div><br>
        </div>
        <div>It seems that it is not possible to define roles in
          PostgreSQL connection parameters (my first try) or in
          PostgreSQL driver options.</div>
        <div> </div>
        <div>I tried to use PREDUDE_STATEMENTS like: "-doo
          "PRELUDE_STATEMENTS=SET ROLE admins", but got warning "Warning
          1: -doo ignored when creating the output datasource."</div>
        <div><br>
        </div>
        <div>Any solutions or suggestions?</div>
        <div><br>
          There is also similar case in QGIS: Supporting "set role" when
          connecting to a postgres database - <a
            href="https://github.com/qgis/QGIS/issues/42763"
            moz-do-not-send="true">https://github.com/qgis/QGIS/issues/42763</a></div>
        <div><br>
        </div>
        <div>Versions: GDAL 3.0.4, released 2020/01/28, PostgreSQL 12.7,
          PostGIS 3.1</div>
        <div><br>
        </div>
        <div>Rgs,</div>
        <div><br>
        </div>
        <div>Pekka</div>
        <div>
          <div>
            <div dir="ltr" class="gmail_signature"
              data-smartmail="gmail_signature">
              <div dir="ltr">
                <div>
                  <div dir="ltr">
                    <div dir="ltr">
                      <div dir="ltr">
                        <p><span>Pekka Sarkola<br>
                          </span><span>Gispo Oy<br>
                          </span><a href="mailto:pekka.sarkola@gispo.fi"
                            target="_blank" moz-do-not-send="true">pekka.sarkola@gispo.fi</a><span>  
                            -
                            GSM +358 40 725 2042<br>
                          </span><a href="http://www.gispo.fi/"
                            target="_blank" moz-do-not-send="true">www.gispo.fi</a><span>
                            – </span><a
                            href="http://www.paikkatieto.com/"
                            target="_blank" moz-do-not-send="true">www.paikkatieto.com</a></p>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></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>