<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi,</p>
    <p>Yes - it is a perfect case for PostgreSQL service definitions.</p>
    <p>See
<a class="moz-txt-link-freetext" href="https://docs.qgis.org/testing/en/docs/user_manual/managing_data_source/opening_data.html#postgresql-service-connection-file">https://docs.qgis.org/testing/en/docs/user_manual/managing_data_source/opening_data.html#postgresql-service-connection-file</a></p>
    <p>This way you are flexible: you don't connect to a
      hostname/ip/port/database connection but to a service definition -
      which can be managed centrally without having to change the data
      sources in QGIS.</p>
    <p>On different computers and users you can have different service
      defitions (pg_service.conf files) - on one machine pointing to
      "localhost", on another to a "remote host".</p>
    <p>That way you can also easily migrate your PostgreSQL server to a
      different hostname or IP without having to change hundreds of QGIS
      projects that point to a fixed hostname.</p>
    <p>It is good practice to use PostgreSQL service definitions anyway.</p>
    <p>On windows, make sure you use Unix line ending in your service
      defintion file, or you may get troubles using it.<br>
    </p>
    <p>Greetings,</p>
    <p>Andreas<br>
    </p>
    <div class="moz-cite-prefix">Am 11.01.19 um 08:00 schrieb Paolo
      Cavallini:<br>
    </div>
    <blockquote type="cite"
      cite="mid:E26A99F7-01D9-4886-B07F-7FA8EFA6F7F9@faunalia.it">
      <!-- Template generated by Exclaimer Signature Manager Exchange Edition on 01:54:25 Friday, 11 January 2019 -->
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style type="text/css">P.ImprintUniqueID {
        MARGIN: 0cm 0cm 0pt
}
LI.ImprintUniqueID {
        MARGIN: 0cm 0cm 0pt
}
DIV.ImprintUniqueID {
        MARGIN: 0cm 0cm 0pt
}
TABLE.ImprintUniqueIDTable {
        MARGIN: 0cm 0cm 0pt
}
DIV.Section1 {
        page: Section1
}
.ExternalClass * {
        LINE-HEIGHT: 100%
}
</style>Use pg_services.<br>
      <br>
      <div class="gmail_quote">Il 11 gennaio 2019 01:54:24 CET, Brent
        Wood <a class="moz-txt-link-rfc2396E" href="mailto:Brent.Wood@niwa.co.nz"><Brent.Wood@niwa.co.nz></a> ha scritto:
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">
          <div>This is not tested, but I think it should work<br>
            <br>
            Enable host based access for local connections via the
            server IP address in your pg_hba file and use this for all
            QGIS access, so you apply the same access approach for both
            local & remote connections.<br>
            <br>
            <br>
            Cheers<br>
            <br>
            Brent Wood<br>
            <br>
            Programme leader: Environmental Information Delivery<br>
            NIWA<br>
            DDI:  +64 (4) 3860529<br>
            <br>
          </div>
          <br>
          <br>
          <table class="ImprintUniqueIDTable" style="HEIGHT: 89px;
            TABLE-LAYOUT: fixed; WIDTH: 100%" cellspacing="0"
            cellpadding="0" border="0" align="center">
            <tbody>
              <tr>
                <td style="TABLE-LAYOUT: fixed; WIDTH: 180px"><a
                    href="http://www.niwa.co.nz" target=""
                    moz-do-not-send="true"><img style="border: 0px Solid
                      ; " src="cid:imagef6a2d5.PNG@d3805356.4e8e0b4a"
                      moz-do-not-send="true" width="180" height="88"></a><br>
                  <br>
                </td>
                <td style="TABLE-LAYOUT: fixed; WIDTH: 1159px">
                  <table
                    class="5777eb95-b84e-46f0-b728-12fb793abfe0Table"
                    cellspacing="0" cellpadding="0">
                    <tbody>
                      <tr>
                        <td nowrap="1"><font
style="font-family:Calibri;font-size:10pt;color:#000000;font-weight:bold;">Brent
                            Wood</font></td>
                      </tr>
                      <tr>
                        <td nowrap="1"><font style="font-family:Calibri
Light;font-size:9pt;color:#000000;font-weight:bold;">Principal
                            Technician - GIS and Spatial Data Management</font></td>
                      </tr>
                      <tr>
                        <td nowrap="1"><font style="font-family:Calibri
Light;font-size:9pt;color:#000000;font-weight:bold;">Programme Leader -
                            Environmental Information Delivery</font></td>
                      </tr>
                      <tr>
                        <td nowrap="1">
                          <table
                            class="5777eb95-b84e-46f0-b728-12fb793abfe0Table"
                            style="font-family:Calibri; font-size:9pt;"
                            cellspacing="0" cellpadding="0">
                            <tbody>
                              <tr>
                                <td nowrap="1"><font
                                    style="font-family:Calibri;font-size:9pt;"><font
style="font-family:Calibri;font-size:9pt;"><font
style="font-family:Calibri;font-size:9pt;color:#244061;font-weight:bold;">T
                                      </font><font
                                        style="font-family:Calibri;font-size:9pt;">+64-4-386-0529</font></font></font></td>
                                <td nowrap="1" align="Center"><font
                                    style="font-family:Calibri;font-size:9pt;"><font
style="font-family:Calibri;font-size:9pt;"><font
                                        style="font-family:Calibri;font-size:9pt;"> </font></font></font></td>
                                <td nowrap="1"><br>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </td>
                      </tr>
                      <tr>
                        <td nowrap="1"><font
                            style="font-family:Calibri;font-size:9pt;color:#000000;">National
                            Institute of Water & Atmospheric
                            Research Ltd (NIWA)</font></td>
                      </tr>
                      <tr>
                        <td nowrap="1"><font
                            style="font-family:Calibri;font-size:9pt;color:#000000;">301
                            Evans Bay Parade, Greta Point, Wellington</font></td>
                      </tr>
                      <tr>
                        <td nowrap="1"><font
style="font-family:Calibri;font-size:9pt;color:#000000;font-weight:bold;">Connect
                            with NIWA:
                          </font><span
                            style="font-family:Calibri;font-size:9pt;"><a
                              href="https://www.niwa.co.nz" title=""
                              target=""
                              style="font-family:Calibri;font-size:9pt;"
                              moz-do-not-send="true"><span
                                style="font-family:Calibri;
                                font-size:9pt;">niwa.co.nz</span></a></span><font
                            style="font-family:calibri;font-size:9pt;"> </font><span
                            style="font-family:calibri;font-size:9pt;"><a
                              href="https://www.facebook.com/nzniwa"
                              title="" target=""
                              style="font-family:calibri;font-size:9pt;"
                              moz-do-not-send="true"><span
                                style="font-family:calibri;
                                font-size:9pt;">Facebook</span></a></span><font
                            style="font-family:Calibri;font-size:9pt;"> </font><span
                            style="font-family:Calibri;font-size:9pt;"><a
                              href="https://twitter.com/niwa_nz"
                              title="" target=""
                              style="font-family:Calibri;font-size:9pt;"
                              moz-do-not-send="true"><span
                                style="font-family:Calibri;
                                font-size:9pt;">Twitter</span></a></span><font
                            style="font-family:Calibri;font-size:9pt;"> </font><span
                            style="font-family:Calibri;font-size:9pt;"><a
href="https://www.linkedin.com/company/niwa" title="" target=""
                              style="font-family:Calibri;font-size:9pt;"
                              moz-do-not-send="true"><span
                                style="font-family:Calibri;
                                font-size:9pt;">LinkedIn</span></a></span><font
                            style="font-family:Calibri;font-size:9pt;"> </font><span
                            style="font-family:Calibri;font-size:9pt;"><a
href="https://www.instagram.com/niwa_science" title="" target=""
                              style="font-family:Calibri;font-size:9pt;"
                              moz-do-not-send="true"><span
                                style="font-family:Calibri;
                                font-size:9pt;">Instagram</span></a></span></td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
            </tbody>
          </table>
          <table class="ImprintUniqueIDTable" style="HEIGHT: 37px;
            VERTICAL-ALIGN: bottom; BORDER-COLLAPSE: collapse;
            TABLE-LAYOUT: auto; WIDTH: 933px" cellspacing="0"
            cellpadding="0" border="0">
            <tbody>
            </tbody>
          </table>
          <table class="ImprintUniqueIDTable" style="HEIGHT: 14px;
            VERTICAL-ALIGN: bottom; BORDER-COLLAPSE: collapse;
            TABLE-LAYOUT: auto; WIDTH: 933px" cellspacing="0"
            cellpadding="0" border="0">
            <tbody>
            </tbody>
          </table>
          <table class="ImprintUniqueIDTable" style="BORDER-COLLAPSE:
            collapse; WIDTH: 100%" cellspacing="0" cellpadding="0"
            border="0">
            <tbody>
            </tbody>
          </table>
          <table class="ImprintUniqueIDTable" style="FONT-SIZE: x-small;
            FONT-FAMILY: Calibri; TABLE-LAYOUT: fixed" cellspacing="0"
            cellpadding="0" border="0">
            <tbody>
              <tr>
                <td><font size="1" face="Calibri" color="#244061">
                    <table
                      class="5777eb95-b84e-46f0-b728-12fb793abfe0Table">
                      <tbody>
                        <tr>
                          <td><font
                              style="font-family:Calibri;font-size:7pt;color:#244061;"><font
style="font-family:Calibri;font-size:8pt;color:#244061;">To ensure
                                compliance with legal requirements and
                                to maintain cyber security standards,
                                NIWA's IT systems are subject to ongoing
                                monitoring, activity logging and
                                auditing. This monitoring and auditing
                                service may be provided by third
                                parties. Such third parties can access
                                information transmitted to, processed by
                                and stored on NIWA's IT systems.</font></font></td>
                        </tr>
                      </tbody>
                    </table>
                  </font></td>
              </tr>
            </tbody>
          </table>
          <br>
          <table class="ImprintUniqueIDTable" style="BORDER-COLLAPSE:
            collapse" cellspacing="0" cellpadding="0" border="0">
            <tbody>
            </tbody>
          </table>
          <table class="ImprintUniqueIDTable" style="BORDER-COLLAPSE:
            collapse" width="500" cellspacing="0" cellpadding="0"
            border="0">
            <tbody>
            </tbody>
          </table>
          <div>________________________________________<br>
            From: Qgis-user <a class="moz-txt-link-rfc2396E" href="mailto:qgis-user-bounces@lists.osgeo.org"><qgis-user-bounces@lists.osgeo.org></a> on
            behalf of Laurence Béchet <a class="moz-txt-link-rfc2396E" href="mailto:bechet.laurence@gmail.com"><bechet.laurence@gmail.com></a><br>
            Sent: Friday, January 11, 2019 13:04<br>
            To: <a class="moz-txt-link-abbreviated" href="mailto:qgis-user@lists.osgeo.org">qgis-user@lists.osgeo.org</a><br>
            Subject: [Qgis-user] Project files with local and remote
            connections to postgreSQL databases<br>
            <br>
            Hi,<br>
            <br>
            I am having a basic problem with my project files. I usually
            run qgis<br>
            locally, where the PostgreSQL database is. However,
            sometimes I need to<br>
            have these same projects run on a remote computer (where a
            version a<br>
            qGIS is locally installed, but the connection to the
            database is<br>
            remote). And then the project file 'doesn't work' because
            the expected<br>
            connection to the database is locally not remotely, and I
            have not<br>
            figured out how to modify this parameter when the project is
            loaded in<br>
            qGIS. My current work around is to create a specific project
            for the<br>
            remote computer.<br>
            <br>
            However this solution is annoying when you have plenty of
            composers that<br>
            you lose in the process ... and playing directly in the xml
            project file<br>
            is a bit scary ...<br>
            Anybody would have an idea how to fix the problem?<br>
            <br>
            Kind regards<br>
            Laurence Béchet<br>
            ARK IN THE PARK Volunteer Co-Ordinator<br>
            Cascades Ranger Station<br>
            Falls Road, Waitakere<br>
            Phone:  (09) 810 7014<br>
            <br>
            <a class="moz-txt-link-abbreviated" href="http://www.arkinthepark.org.nz">www.arkinthepark.org.nz</a> <a class="moz-txt-link-abbreviated" href="http://www.forestandbird.org.nz">www.forestandbird.org.nz</a><br>
            <br>
            <br>
            <br>
            <br>
            _______________________________________________<br>
            Qgis-user mailing list<br>
            <a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
            List info:
            <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
            Unsubscribe:
            <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
          </div>
          <br>
          <br>
          <br>
        </blockquote>
      </div>
      <br>
      -- <br>
      Sorry for being short
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></pre>
    </blockquote>
  </body>
</html>