Hello
In qgis 2.18 is there some way to automatically get the user name used to load 
a postgis layer?
I need it to populate a table field qgis side, not postgis side (I know I can 
do the latest using a trigger).

On Postgis I use

IF NEW.user_inser is NULL or NEW.user_inser = '' then NEW.user_inser = (select 
current_user);
END IF;
IF NEW.user_modif is NULL or NEW.user_modif = '' then NEW.user_modif = (select 
current_user);
END IF;
NEW.data_inser = current_timestamp;
NEW.data_modif = current_timestamp;

To trap a user who is inserting a new feature and set both insertion and 
modification user/data

Then If I want to get a user/data that updates a record, how can I do?
I mean as a user insert a feature or that feature is updated then next time I 
can't use

IF NEW.user_modif is NULL or NEW.user_modif = '' then NEW.user_modif = (select 
current_user);

And as I load this layer in legend Qgis doesn't change user_modif field.
So I'm searching a way to let Qgis change authomatically user_modif field on 
edit session

I tried to load a query like

select row_number() over(), current_user::text as user

To get the user of a given connection and it performs well but then How can I 
insert user value in user_modif field?

Any other better way??

Thanks
Pietro Rossin

AVVISO DI RISERVATEZZA Informazioni riservate possono essere contenute nel 
messaggio o nei suoi allegati. Se non siete i destinatari indicati nel 
messaggio, o responsabili per la sua consegna alla persona, o se avete ricevuto 
il messaggio per errore, siete pregati di non trascriverlo, copiarlo o inviarlo 
ad alcuno. In tal caso vi invitiamo a cancellare il messaggio ed i suoi 
allegati. Grazie.
CONFIDENTIALITY NOTICE Confidential information may be contained in this 
message or in its attachments. If you are not the addressee indicated in this 
message, or responsible for message delivering to that person, or if you have 
received this message in error, you may not transcribe, copy or deliver this 
message to anyone. In that case, you should delete this message and its 
attachments. Thank you.
_______________________________________________
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