<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Hi,</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
You could try creating a view in the PostGIS database to do the join instead of QGIS, then just open the view in QGIS?</div>
<div class="elementToProof" id="Signature">
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div class="elementToProof" style="margin-right: 0px; margin-left: 0px; font-family: Calibri, Arial, Helvetica, sans-serif;">
Brent Wood<br>
<br>
Principal Technician, Fisheries<br>
NIWA<br>
DDI: +64 (4) 3860529</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> 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</font>
<div> </div>
</div>
<style>
<!--
@font-face
{font-family:Calibri}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
{color:#0563C1;
text-decoration:underline}
a:visited, span.x_MsoHyperlinkFollowed
{color:#954F72;
text-decoration:underline}
span.x_E-MailFormatvorlage17
{font-family:"Arial",sans-serif;
color:windowtext}
.x_MsoChpDefault
{font-family:"Calibri",sans-serif}
@page WordSection1
{margin:70.85pt 70.85pt 2.0cm 70.85pt}
div.x_WordSection1
{}
-->
</style>
<div lang="DE" link="#0563C1" vlink="#954F72">
<div class="x_WordSection1">
<p class="x_MsoNormal"><span style="font-size:10.0pt; font-family:"Arial",sans-serif">Hello,</span></p>
<p class="x_MsoNormal"><span style="font-size:10.0pt; font-family:"Arial",sans-serif"> </span></p>
<p class="x_MsoNormal"><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></p>
<p class="x_MsoNormal"><span style="font-size:10.0pt; font-family:"Arial",sans-serif"> </span></p>
<p class="x_MsoNormal"><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></p>
<p class="x_MsoNormal"><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></p>
<p class="x_MsoNormal"><span style="font-size:10.0pt; font-family:"Arial",sans-serif"> </span></p>
<p class="x_MsoNormal"><span style="font-size:10.0pt; font-family:"Arial",sans-serif">Thanks in advance,</span></p>
<p class="x_MsoNormal"><span style="font-size:10.0pt; font-family:"Arial",sans-serif">Werner</span></p>
<p class="x_MsoNormal"><span style="font-size:10.0pt; font-family:"Arial",sans-serif"> </span></p>
<p class="x_MsoNormal" style="text-autospace:none"><b><span style="font-size:10.0pt; font-family:"Arial",sans-serif">---</span></b></p>
<p class="x_MsoNormal" style="text-autospace:none"><b><span style="font-size:10.0pt; font-family:"Arial",sans-serif"> </span></b></p>
<p class="x_MsoNormal" style="text-autospace:none"><b><span style="font-size:10.0pt; font-family:"Arial",sans-serif">Werner Isenmann</span></b></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Arial",sans-serif"> </span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Arial",sans-serif">Regierungspräsidium Freiburg</span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Arial",sans-serif">Referat 91 – Geowissenschaftliches Landesservicezentrum</span></p>
<p class="x_MsoNormal" style="line-height:105%; text-autospace:ideograph-other"><span style="font-size:10.0pt; line-height:105%; font-family:"Arial",sans-serif"> </span></p>
<p class="x_MsoNormal" 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></p>
<p class="x_MsoNormal" 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></p>
<p class="x_MsoNormal" style="line-height:105%; text-autospace:ideograph-other"><span style="font-size:10.0pt; line-height:105%; font-family:"Arial",sans-serif"> </span></p>
<p class="x_MsoNormal" 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></p>
<p class="x_MsoNormal" 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></p>
<p class="x_MsoNormal"> </p>
</div>
</div>
<br>
<div style="margin-bottom: 10px; line-height: 1.2;"><b>Brent Wood </b><br>
<span style="color: #1822f8;">Principal Technician - GIS and Spatial Data Management
<br>
</span>
<div style="width: 100%; white-space: normal; word-break: keep-all;">+64-4-386-0529
</div>
301 Evans Bay Parade Hataitai Wellington New Zealand<br>
Earth Sciences New Zealand </div>
<div style="border-bottom: solid 3px #1822F8; background-color: black !important; height: 42px; width: 100%; align-items: center;">
<a href="https://earthsciences.nz"><img src="https://webstatic.earthsciences.nz/static/logo/earth-sciences-signature.png" alt="Earth Sciences New Zealand" style="height: 42px; margin-right: 15px;"></a>
</div>
<div style="border-bottom: solid 1px #1822F8; width: 100%; margin-top: 10px; padding: 0px 0px 10px 0px; font-size: 8pt; 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>. </div>
</body>
</html>