Questions tagged [trigger]

in this context implies a SQL trigger, (aka database trigger), which is a type of stored procedure that is called automatically in response to a specified event in the database.

Filter by
Sorted by
Tagged with
1 vote
0 answers
35 views

Field value populated ether by another field value or by user input based on a Boolean field in QGIS form

I'm creating a winter bird survey form in QGIS for use in Qfield. There is a field called "mixed" which records whether a flock is mixed(1) or not(0). Another field called "sp_count&...
P Dreyer's user avatar
  • 145
2 votes
1 answer
56 views

Backup table does not replicate geometry, fed by trigger in pgAdmin (postGIS)

I have two tables, A and B. B is a backup of A. Table A has a trigger: CREATE OR REPLACE TRIGGER trigger AFTER INSERT OR UPDATE OR DELETE ON A FOR EACH ROW EXECUTE FUNCTION ...
Tobias Holms's user avatar
0 votes
0 answers
36 views

QGIS - Unable to save after mergin attribute - (SpatiaLite - Triggers)

I'm working with SpatiaLite layers, and I'm currently encountering a problem when I use the tool: « Merge attributes of selected entities ». I use several triggers that are not the cause of the ...
Giene's user avatar
  • 669
2 votes
2 answers
88 views

QGIS - Trigger's execution too slow (QGIS freeze)

I am currently working on a SpatiaLite layer that is updated after insertions and modifications through triggers. When I copy-paste features on the "HABITATS_POLY" layer, it triggers updates ...
Giene's user avatar
  • 669
0 votes
1 answer
47 views

QGIS - SpatiaLite triggers doesn't update properly each field

See edit at the end of the post I am working in two layers: HABITATS_POLY (important fields: "EUNIS_1" , "EUNIS_2" , "EUNIS_3" , "EUNIS_4" ; "EUNIS22_1&...
Giene's user avatar
  • 669
1 vote
1 answer
43 views

QGIS - How to update several rows with triggers SQLite

I currently have two SpatiaLite layers: HABITATS_POLY: Key fields include EUNIS_1, EUNIS_2, EUNIS_3, EUNIS_4, EUNIS22_1, EUNIS22_2, EUNIS22_3, EUNIS22_4. GESTION_CODES: Key fields include EUNIS and ...
Giene's user avatar
  • 669
0 votes
0 answers
56 views

Triggers for multiple tables in Geopackage and DB Browser for SQLite for QGIS use

I need to build an automatic trigger in the database so that when inserting/updating a new polygon in the SETORES feature and filling in the CD_GEOCMU key attribute with the appropriate code, for ...
Denilson's user avatar
  • 695
0 votes
0 answers
63 views

QGIS how to improve triggers on SQL - SpatiaLite

I'm looking for a way to improve the way my triggers are working on a SpatiaLite layer. Currently, it takes 45 seconds to work on 1000 entities. Is there a way to improve the performance? My triggers ...
Giene's user avatar
  • 669
1 vote
0 answers
39 views

Refresh attribute table after SQL trigger

I'm utilizing a trigger on a SpatialLite layer in QGIS. This trigger is designed to update a field when its content matches with another in the database. Here's the trigger's code: CREATE TRIGGER ...
Giene's user avatar
  • 669
1 vote
1 answer
46 views

QGIS - SpatialLite - Trigger for code correspondences - Manage multiple results

I have a database containing correspondences between codes (e.g., A = 1 = 11 = H = M, etc.). I've made the first 100 rows of this data available for download. BDD Extract I would like a feature where, ...
Giene's user avatar
  • 669
1 vote
2 answers
63 views

Geopackage trigger doesn't work

I use this trigger on a geopackage table: CREATE TRIGGER upd_iae_surf AFTER UPDATE ON "IAE CRD Surf" BEGIN UPDATE "IAE CRD Surf" SET "taille" = ROUND(ST_Area(NEW.geom)/...
Etienne's user avatar
  • 497
3 votes
1 answer
125 views

Date management problem in a trigger with PostgreSQL [closed]

I created two tables on PostgreSQL. I would like to note in a layer a date and retrieve: the corresponding year in a variable, then reuse the year variable in various other attributes integrating ...
fcka's user avatar
  • 923
1 vote
0 answers
44 views

Bounding box not working well in trigger PostgreSQL - PostGIS

My trigger function consists of collecting the vertices of a polyline table "depart_bt", searching for the point entities of the table “support_bt” which coincide with the vertices of the ...
ennine's user avatar
  • 863
1 vote
0 answers
20 views

How can I round numeric area values in PostGIS? [duplicate]

I am using a trigger function in PostGIS to calculate the area in hectare of each polygon that is created or changed. The field is called "flaeche_ha_gis", the datatype is "double"....
Enzo Baldini's user avatar
  • 2,297
2 votes
2 answers
396 views

TRIGGER FUNCTION: With UPDATE of geom: Calculate automatically area column

I'm using PostGIS and I would like to use trigger to: when there is a change in the geometry of a polygon, that its surface is also updated. I have tested several syntaxes but I always get an error &...
Demonshine's user avatar
3 votes
1 answer
233 views

Using ST_Intersects inside of an ST_Within

I have a PostgreSQL trigger function getting executed by QGIS. That is working fine. I am trying to modify my function to count the number of points that fall within the intersection (clipped) ...
Ryan Peel's user avatar
1 vote
1 answer
241 views

Wrong schema while importing data via with ogr2ogr into postgresql database and using dblink

I have the following issue: I have a table on a PostgreSQL database which triggers its changes via dblink to another table in a different data base. The trigger function looks as follows: CREATE OR ...
danceb's user avatar
  • 456
2 votes
1 answer
471 views

Trigger to update foreign table

I have two similar tables (sections) in two different databases (QGIS cloud database and AWS PostgreSQL database). I update the QGIS Cloud database (so that everyone in my organization can see the ...
franrvr's user avatar
  • 81
4 votes
1 answer
208 views

Trigger in PostGIS that deletes or updates a feature based on location

In PostGIS I have two tables: closures (id, name, endpoint, geom) and chambers (id, name, geom). A closure must always be placed in a chamber for which it will take the chambers name it has been ...
franrvr's user avatar
  • 81
2 votes
1 answer
403 views

PostGIS trigger : table and materialized view

I have a PostGIS polygons table for my "cities". I have a point table for my "boreholl". I created a "mv" materialized view defined by a spatial join as follows: SELECT ...
user35117's user avatar
  • 939
4 votes
2 answers
288 views

How to trigger calculation on QGIS startup?

I am preparing a field worker / QField project an would like to visualize green spaces based on the days that have elapsed since the last field worker has visited that site. I am testing with a very ...
JackColt's user avatar
0 votes
2 answers
521 views

Having changes to SpatiaLite table column to automatically update GIS layer

If the length of a line is changed (direct SQL), I would like the layer to reflect the new line length and also update the label for the feature. How can that be accomplished? It appears that ...
Robotuner's user avatar
  • 394
1 vote
0 answers
39 views

Updating the other column when data in the column changes in ArcGIS [closed]

In ArcGIS in one of my layers, I combined two columns with calculated field and printed it into a third column. However when I change a data in my first column, I want that data in the third column to ...
Uğurcan GÜL's user avatar
0 votes
1 answer
87 views

Under what circumstances would the _DELETE trigger get called? (_EVW)

Oracle 18c/10.7.1 geodatabase: When an FC is registered as versioned (with option to move edits to base), several triggers get automatically created: V000001_DELETE V000001_INSERT V000001_UPDATE ...
User1974's user avatar
  • 1,122
2 votes
2 answers
140 views

Prevent deletes in a versioned table at the database level

I have a table in an Oracle 18c/10.7.1 geodatabase. The table is versioned with the option to move edits to base. As far as I can tell, it's not possible to prevent ArcGIS Desktop users from deleting ...
User1974's user avatar
  • 1,122
2 votes
1 answer
337 views

FME Server Automation: Watch URL/Published data in the internet

I'd like to build an automation in FME Server consisting of one trigger (watch URL/xlsx-sheet) and an email-action. The problem is about the trigger: There is a federal environment agency that ...
Maja Ott's user avatar
  • 435
0 votes
0 answers
164 views

Condition with using geometry OLD and NEW

Is there a posibility to use a condition with OLD and NEW parameters? Using postgres 12, and pgAdmin Geometry in Qgis Trigger CREATE TRIGGER abc_trigger AFTER INSERT OR UPDATE OR DELETE ON "...
Filip's user avatar
  • 11
1 vote
0 answers
97 views

ST contains not working properly with trigger

I have table1, on which people do regular inserts, and table2, that needs to get updated based on what was inserted to table1. table1 has id integer type text ref text geom polygon ...
Luffydude's user avatar
  • 2,288
2 votes
1 answer
956 views

Insert/Update/Delete table from another table changes in PostGIS

I'm trying to build a function that Insert/Update/Delete rows of a table based from another table changes. Unfortunately I could not continue, some problems occured: DELETE isn't work correctly: Any ...
Caio Mattos's user avatar
1 vote
1 answer
144 views

Make array_append in trigger with PostGIS intersection

I've 2 layers : linestring with column id_line and polygone, drawn by user. I trying to get id_line on linestring who intersects polygon. I've got it in qgis with : aggregate( layer:= 'aep_cana', ...
pasqal's user avatar
  • 506
2 votes
3 answers
1k views

PostgeSQL Trigger St_Intersect Insert, Update

I have a problem creating a trigger in PostgreSQL that will get data from polygon layer. Issue: I have two tables: 1. point (id, geom, address) 2. polygon (id, geom, address) Polygon table ...
Darko Nedic's user avatar
2 votes
1 answer
641 views

Perform intersection using a TRIGGER

I've two geometry table inside my DB: buffer: id INTEGER SERIAL PRIMARY KEY, geom POLYGON polygons: geom MULTIPOLYGON I need have the intersection between buffer and polygons and I will do this ...
MaxDragonheart's user avatar
1 vote
0 answers
213 views

RAISE NOTICE from trigger to QGIS

I work on vue postgresql made with table, so for save I have to use trigger. My trigger do a lot of thing and I have to send message to the user to make him understand what happend. But QGIS ...
Pierre's user avatar
  • 161
1 vote
1 answer
224 views

Dynamic triggers with table_name in PostGIS

I want make a dynamic trigger with PostgreSQL/PostGIS like this. I try that triggers make more generic for use with many tables with the same pattern. When i use direct table's name in code, that's ...
pasqal's user avatar
  • 506
3 votes
3 answers
1k views

Running second FME workspace when first workspace is completed

I've got a workspace that inserts data in a database. It runs on FME Desktop and FME Server. After the insertion (the first workspace) is completely done, I'd like to run a second workspace that ...
Maja Ott's user avatar
  • 435
2 votes
1 answer
629 views

Automatically add points geometry while GPS logging?

I have a PostgreSQL 10 Server (x64) running on my Windows 8 (x64 based) machine. On the top of my Postgres database, there is PostgREST API running that receives GPS data (5 seconds interval) from a ...
khajlk's user avatar
  • 1,081
1 vote
0 answers
80 views

Attribute objects in Enterprise geodatabase automatically

There is a Enterprise geodatabase (MS SQL Server, ArcGIS), it has about 100 feature classes. It is necessary to automate the process of populating a unique number to each object in the database. ...
Lora's user avatar
  • 45
1 vote
0 answers
154 views

PostgreSQL Trigger to keep track of table changes [closed]

I am trying to create a trigger (PostgreSQL 9.4) to track changes made to a table. This is my approach: CREATE OR REPLACE FUNCTION taxon_history() RETURNS trigger AS $BODY$ BEGIN IF TG_OP = '...
Lisdengard's user avatar
2 votes
0 answers
99 views

Trigger PostgreSQL

I have a pb to make a trigger. I have 3 tables and a georeferenced layer: The common table contains: PKcom, INSEE The cadastre table contains: PKcadastre, Fkbat, section, parcel The building table ...
fcka's user avatar
  • 923
2 votes
0 answers
117 views

Per row commit when editing PostGIS data with QGIS, with PostGIS triggers checking inserted data

I have a PostGIS trigger assuring that records with a Point-geometry inserted in a table fall within Polygons in another table. Simple example: -- Trigger function CREATE OR REPLACE FUNCTION ...
MartinT's user avatar
  • 876
6 votes
0 answers
776 views

Using geopackage trigger in QField [closed]

I tried to create trigger in GeoPackage so one layer would get updated by data from the other, both in the same GeoPackage. It worked perfectly within desktop QGIS but I get this error message in ...
Mat's user avatar
  • 1,588
1 vote
1 answer
125 views

Update geometries with ST_UnaryUnion at TRIGGER

We are currently working on database with multipolygons and we're using QGIS 3. Sometimes it's very useful to work with parts (each page of document is separate part of multipolygon), however at the ...
Krakatau's user avatar
  • 107
3 votes
0 answers
89 views

Trigger - Calculate area of a layer inside feature by changing the inner layer

Working with PostGIS database and QGIS, I have two polygons layers, an external with land lots (lotes) and an internal with building area (areaconstruida). In the "lotes" layer, I need a field in ...
Rafael Leite's user avatar
2 votes
1 answer
127 views

Trigger - Calculate area of a layer inside feature

I'm trying to create a trigger to auto-fill a field of a table in postGIS based on two polygon layers geometry. I'm using QGIS for geometry updates. The first layer (lotes) has bigger polygons and ...
Rafael Leite's user avatar
2 votes
1 answer
2k views

Geometry based automatic fill of fields in attribute table

I'm looking for solutions for auto-fill attribute table fields of spatial layer on QGIS from updates in geometry. All layers were created as polygon shapefiles. Attribute table fields are dependent ...
Rafael Leite's user avatar
3 votes
1 answer
748 views

Trigger PostGIS QGIS

I have 2 layers on PostGIS: a point layer named 'tdia' and a polygon layer named 'com': -the com layer contains the city name. (Polygon) -the tdia layer contains bus stops. (point) I want to create a ...
fcka's user avatar
  • 923
1 vote
0 answers
589 views

How to Create 'Update Triggers' to Track Field Values Changes When Data is Versioned?

How can I create a trigger to capture when a field is changed from one value to another if my data is versioned? I am not able to run an UPDATE trigger and grab ':new' and ':old' values because with ...
MrChancey's user avatar
0 votes
0 answers
70 views

Automating Redshift data dump to a PostgreSQL DB every 12 hours

I have a redshift database that changes multiple times a day. I want to use this "live" data to make web maps and I have a Postgres DB where all my web-mapping data is stored. I want to continuously ...
atlasofcoffee's user avatar
4 votes
1 answer
207 views

PostGIS trigger does not work as expected while checking intersections

I'm trying to write a trigger that should prevent saving lines which do not end at building boundaries. ( A PostGIS-Solution for something like the topology-rule "Must be covered by boundary of" in ...
Thomas B's user avatar
  • 8,797
2 votes
1 answer
529 views

Adding per-row creation time and modification time in GeoPackage geometry table?

I need to add ctime and mtime to a GPKG sqlite database in table with geometry. Apparently logic solution: add ctime column with DEFAULT CURRENT_TIMESTAMP and add trigger ON UPDATE to set mtime = ...
Jack's user avatar
  • 41