<div dir="ltr">Hi<div><br></div><div>It depends on the implementation in the data provider (and normally on the data type for the primary key).</div><div><br></div><div>In the postgres case, (up to) 32 bit integer primary keys are normally used as fid.</div><div>With others like 64 bit integer, string or compound foreign keys it's not possible to stick to this approach, so an internal fid to pk map is generated by the provider at runtime.</div><div><br></div><div>64 bit integers cannot be directly reused as fid because QGIS stores fids internally with 64 bit, but reserves the (negative, -1, -2, ...) half of the available values for new, uncommitted features.</div><div><br></div><div>Matthias</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 8, 2021 at 11:50 AM Andreas Neumann <<a href="mailto:andreas@qgis.org">andreas@qgis.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Ok - that explains it.</div><div><br></div><div>It is quite confusing that QGIS uses a different internal ID than the primary key column of the database. Is there a technical reason for this behaviour?</div><div><br></div><div>Andreas<br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 8 Jul 2021 at 11:43, Alexandre Neto <<a href="mailto:senhor.neto@gmail.com" target="_blank">senhor.neto@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>As far as I remember @atlas_featureid has always returned the same as the $id in the attributes table, which is kind of the internal row number.</div><div dir="auto"><br></div><div dir="auto">Alex<br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">A quinta, 8/07/2021, 10:35, Andreas Neumann <<a href="mailto:andreas@qgis.org" target="_blank">andreas@qgis.org</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>HI Jürgen,</div><div><br></div><div>Yes - I provided the primary key column <br></div><div><br></div><div>Here is my data source string:</div><div><br></div><div>service='edit' authcfg=sogis00 key='t_id' srid=2056 type=Polygon checkPrimaryKeyUnicity='1' table="alw_strukturverbesserungen"."projekt_aggregiert_v" (geometrie_convex_hull) sql=geometrie_bbox IS NOT NULL</div><div><br></div><div>@atlas_featureid returns something like an internal "row number" or similar, but not the column "t_id" as defined in the data source string.</div><div><br></div><div>Andreas<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 8 Jul 2021 at 10:42, Jürgen E. Fischer <<a href="mailto:jef@norbit.de" rel="noreferrer" target="_blank">jef@norbit.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Andreas,<br>
<br>
On Thu, 08. Jul 2021 at 10:30:08 +0200, Andreas Neumann wrote:<br>
> attribute(@atlas_feature,'pkey_name'), but it is a little more complicated<br>
> than @atlas_featureid - and I'm pretty sure that @atlas_featureid was using<br>
> the pkey column in th past?<br>
> <br>
> My data source for the atlas coverage layer is a Postgis View.<br>
<br>
It's probably not using the column you expect for the feature id.  Did you<br>
specify the key column when adding the view?<br>
<br>
<br>
Jürgen<br>
<br>
-- <br>
Jürgen E. Fischer           norBIT GmbH             Tel. +49-4931-918175-31<br>
Dipl.-Inf. (FH)             Rheinstraße 13          Fax. +49-4931-918175-50<br>
Software Engineer           D-26506 Norden            <a href="https://www.norbit.de" rel="noreferrer noreferrer" target="_blank">https://www.norbit.de</a><br>
QGIS release manager (PSC)  Germany                 IRC: jef on Libera|OFTC<br>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" rel="noreferrer" target="_blank">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><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr"><div dir="ltr"><div><br>--<br>Andreas Neumann<br></div><a href="http://QGIS.ORG" rel="noreferrer" target="_blank">QGIS.ORG</a> board member (treasurer)<br></div></div>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" rel="noreferrer" target="_blank">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><br>
</blockquote></div></div></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr"><div dir="ltr"><div><br>--<br>Andreas Neumann<br></div><a href="http://QGIS.ORG" target="_blank">QGIS.ORG</a> board member (treasurer)<br></div></div>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="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" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div>