<div dir="auto"><div>I think that some logic to retrieve a pk for a view would be great to have.<div dir="auto"><br></div><div dir="auto">If I'm not wrong, the data source select dialog offers a pk when you select a view, maybe it's just easy as porting that logic to the provider and use it to guess the PK if there's no information in the URI.</div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 29, 2019, 17:47 Sandro Santilli <<a href="mailto:strk@kbt.io">strk@kbt.io</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Aug 29, 2019 at 12:35:45PM +0100, Jorge Gustavo Rocha wrote:<br>
> <br>
> <a href="https://cdash.orfeo-toolbox.org/viewTest.php?onlyfailed&buildid=14455" rel="noreferrer noreferrer" target="_blank">https://cdash.orfeo-toolbox.org/viewTest.php?onlyfailed&buildid=14455</a><br>
> <br>
> That is related to your PR, right?<br>
<br>
Ok, it was actually my PR.<br>
Wasn't easy to spot the problem, because the QgsVectorLayer.isValid()<br>
call doesn't tell what's invalid about a layer, but at the end the<br>
problem was that QGIS was not able to find a primary key for a view.<br>
<br>
I've added the primary key manually as part of the URI, as the test<br>
is meant to test something different and didn't want to get distracted<br>
by that, but if you think QGIS should be capable of finding a working<br>
primary key in a view I'll file a ticket for that.<br>
<br>
Other issue: sslmode needed to be disabled for the test to pass.<br>
<br>
My PR is now Travis-Green:<br>
<a href="https://github.com/qgis/QGIS/pull/31468" rel="noreferrer noreferrer" target="_blank">https://github.com/qgis/QGIS/pull/31468</a><br>
<br>
--strk;<br>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank" rel="noreferrer">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></blockquote></div></div></div>