<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
p.xmsonormal, li.xmsonormal, div.xmsonormal
        {mso-style-name:x_msonormal;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.xmsochpdefault, li.xmsochpdefault, div.xmsochpdefault
        {mso-style-name:x_msochpdefault;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Calibri",sans-serif;}
span.xmsohyperlink
        {mso-style-name:x_msohyperlink;
        color:#0563C1;
        text-decoration:underline;}
span.xmsohyperlinkfollowed
        {mso-style-name:x_msohyperlinkfollowed;
        color:#954F72;
        text-decoration:underline;}
span.xe-mailformatvorlage17
        {mso-style-name:x_e-mailformatvorlage17;
        font-family:"Arial",sans-serif;
        color:windowtext;}
span.E-MailFormatvorlage25
        {mso-style-type:personal-reply;
        font-family:"Arial",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US">Hi Brent,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US">thanks for your hint. I already tried this. Since now Cross Database references (the tables are in different databases) aren’t allowed, so this solutions
 doesn’t work now.and we have to change the PostGIS settings for this solution.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US">Or are there other possibilities?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US">Werner<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Von:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Brent Wood <Brent.Wood@niwa.co.nz>
<br>
<b>Gesendet:</b> Dienstag, 19. August 2025 09:21<br>
<b>An:</b> qgis-user@lists.osgeo.org; Isenmann, Werner (RPF) <Werner.Isenmann@rpf.bwl.de><br>
<b>Betreff:</b> EXTERN: Re: Virtual Layer not working correct when opening QGIS project<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<table class="MsoNormalTable" border="1" cellpadding="0" style="background:#FFFFC1;border:solid black 1.0pt">
<tbody>
<tr>
<td style="border:none;padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span style="color:red">Phishing-Gefahr:</span></strong><span style="color:black"> Vorsicht bei Links und Anhängen in
<u>externen E-Mails</u>!</span><o:p></o:p></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="display:none"><o:p> </o:p></span></p>
<table class="MsoNormalTable" border="0" cellpadding="0">
<tbody>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"> <o:p></o:p></p>
</td>
</tr>
</tbody>
</table>
<div>
<p class="MsoNormal"><span style="font-family:Aptos;color:black">Hi,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Aptos;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Aptos;color:black">You could try creating a view in the PostGIS database to do the join instead of QGIS, then just open the view in QGIS?<o:p></o:p></span></p>
</div>
<div id="Signature">
<div>
<p class="MsoNormal"><span style="font-family:Aptos;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">Brent Wood<br>
<br>
Principal Technician, Fisheries<br>
NIWA<br>
DDI:  +64 (4) 3860529<o:p></o:p></span></p>
</div>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> QGIS-User <qgis-user-bounces@lists.osgeo.org> on behalf of Isenmann,
 Werner (RPF) via QGIS-User <qgis-user@lists.osgeo.org><br>
<b>Sent:</b> Tuesday, 19 August 2025 18:37<br>
<b>To:</b> qgis-user@lists.osgeo.org <qgis-user@lists.osgeo.org><br>
<b>Subject:</b> [Qgis-user] Virtual Layer not working correct when opening QGIS project</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="xmsonormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Hello,</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">in a QGIS project I have a PostGIS polygon layer where I joined two tables (from PostgrSQL DB). Then I created a virtual layer, containing all the attributes of the polygon
 layer and all the attributes of the joined tables. This works well so far.</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">When I close the QGIS project an open it again, the virtual layer attribute table first doesn’t show the joined attributes. They only appear, when I save the virtual layer again
 with the same select statement.</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Does anyone have any tips on how to ensure that the virtual layer permanently retains the joined attributes?</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Thanks in advance,</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Werner</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif"> </span><o:p></o:p></p>
<p class="xmsonormal" style="text-autospace:none"><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif">---</span></b><o:p></o:p></p>
<p class="xmsonormal" style="text-autospace:none"><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif"> </span></b><o:p></o:p></p>
<p class="xmsonormal" style="text-autospace:none"><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Werner Isenmann</span></b><o:p></o:p></p>
<p class="xmsonormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Arial",sans-serif"> </span><o:p></o:p></p>
<p class="xmsonormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Regierungspräsidium Freiburg</span><o:p></o:p></p>
<p class="xmsonormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Referat 91 – Geowissenschaftliches Landesservicezentrum</span><o:p></o:p></p>
<p class="xmsonormal" style="line-height:105%;text-autospace:ideograph-other"><span style="font-size:10.0pt;line-height:105%;font-family:"Arial",sans-serif"> </span><o:p></o:p></p>
<p class="xmsonormal" style="line-height:105%;text-autospace:ideograph-other"><span style="font-size:10.0pt;line-height:105%;font-family:"Arial",sans-serif">Albertstraße 5</span><o:p></o:p></p>
<p class="xmsonormal" style="line-height:105%;text-autospace:ideograph-other"><span style="font-size:10.0pt;line-height:105%;font-family:"Arial",sans-serif">D-79104 Freiburg i. Br.</span><o:p></o:p></p>
<p class="xmsonormal" style="line-height:105%;text-autospace:ideograph-other"><span style="font-size:10.0pt;line-height:105%;font-family:"Arial",sans-serif"> </span><o:p></o:p></p>
<p class="xmsonormal" style="line-height:105%;text-autospace:ideograph-other"><span style="font-size:10.0pt;line-height:105%;font-family:"Arial",sans-serif">Phone: (+49) 761 208-3008</span><o:p></o:p></p>
<p class="xmsonormal" style="line-height:105%;text-autospace:ideograph-other"><span style="font-size:10.0pt;line-height:105%;font-family:"Arial",sans-serif">E-Mail:
<a href="mailto:Werner.Isenmann@rpf.bwl.de"><span style="color:windowtext">Werner.Isenmann@rpf.bwl.de</span></a></span><o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="margin-bottom:7.5pt">
<p class="MsoNormal"><b>Brent Wood </b><br>
<span style="color:#1822F8">Principal Technician - GIS and Spatial Data Management
</span><o:p></o:p></p>
<div>
<p class="MsoNormal">+64-4-386-0529 <o:p></o:p></p>
</div>
<p class="MsoNormal">301 Evans Bay Parade Hataitai Wellington New Zealand<br>
Earth Sciences New Zealand <o:p></o:p></p>
</div>
<div style="border:none;border-bottom:solid #1822F8 2.25pt;padding:0cm 0cm 0cm 0cm;align-items: center">
<p class="MsoNormal"><a href="https://earthsciences.nz"><span style="border:solid windowtext 1.0pt;padding:0cm;text-decoration:none"><img border="0" width="100" height="100" style="width:1.0416in;height:1.0416in" id="_x0000_i1026" src="cid:~WRD000.jpg" alt="Das Bild wurde vom Absender entfernt. Earth Sciences New Zealand"></span></a><o:p></o:p></p>
</div>
<div style="border:none;border-bottom:solid #1822F8 1.0pt;padding:0cm 0cm 8.0pt 0cm;margin-top:7.5pt">
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:Aptos">The Institute of Geological and Nuclear Sciences Limited and the National Institute of Water and Atmospheric Research Limited joined to become the New Zealand Institute for Earth Science Limited.
 We are known as Earth Sciences New Zealand. For more information on the Earth Sciences transition
<a href="https://niwa.co.nz/about-niwa/science-sector-reforms">click here</a>.<br>
<br>
<b>Notice:</b> This email may contain information which is confidential and/or subject to copyright, and may not be used, published or redistributed without the prior written consent of Earth Sciences New Zealand. If you are not the intended recipient, please
 immediately notify the sender and delete the email and any attachments. Any opinion or views expressed in this email are those of the individual sender and may not represent those of Earth Sciences New Zealand.<br>
<br>
For information about how we process data and monitor communications please see our
<a href="https://niwa.co.nz/about-niwa/privacy-policy">privacy policy</a>. <o:p></o:p></span></p>
</div>
</div>
</body>
</html>