Hi Alexander,

If you use the PostgreSQL transaction mode, you can edit multiple related tables at once and get the IDs immediately (even before saving your data).

See Project --> Properties --> Data Sources and enable at least the following two checkboxes potentially also the third one:

        * Automatically create transaction groups where possible
        * Evaluate default values on provider side

If you want to be on the safe side for future avoidance of ID clashes, you can also consider using UUID as your primary key column. That will allow you in the future to better merge independent data sources without having to worry about ID clashes.

Greetings,

Andreas

On 2021-09-13 09:45, Jorge Gustavo Rocha wrote:

Hi Alexander,

You should not set an expression manually. If the id column is comes from a PostgreSQL identity/sequence based column, QGIS is get the exact id when the write operation is executed. It works fine with any number of users.

Set you column with (on the PostgreSQL side):

id INT GENERATED ALWAYS AS IDENTITY

I hope it helps.

Jorge Gustavo

On 13/09/21 07:27, Alexander Klemm - km3 teledienst GmbH wrote:

Hello,

we want to use QGIS to document our cable Infrastructure (We are an ISP). Now the Problem is, that 3 or 4 persons have to work with QGIS. Now my Idea was to provide a Postgresql Server with postgis installed. Thats working fine. The Project and the Layers are stored into the Postgresql Server and all Persons could work with it. Now my Problem is, that the Contents of the Layers must have an unique ID. The ID is set by the default value at the attribute form with_ "maximum($id)+1"_. If two persons are working on the QGIS System, the Problem is, that there are duplicated IDs, because the IDs will not be stored immediately. Is there a solution for this problem?

thank you for helping
best regards

Alexander Klemm

Mit freundlichen Grüßen
Alexander Klemm

km3 teledienst GmbH - August-Bebel-Str. 86 - 08344 Grünhain-Beierfeld
Tel. +49 (0)3774 13931-0 - Fax +49 (0)3774 13931-02
[email protected] - https://www.km3.de
Geschäftsführer: Heiko Lötzsch und Mike Bielagk
Registergericht: Amtsgericht Chemnitz - Handelsregister: B Nr. 18881
Umsatzsteuer-ID: DE 216 086 551 - Steuer-Nr.: 218 / 112 / 02921

_______________________________________________
Qgis-user mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

_______________________________________________
Qgis-user mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
_______________________________________________
Qgis-user mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to