Skip to main content

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
1 answer
75 views

Better control cascading triggers in SQLite [closed]

I'm working with two interdependent SpatiaLite layers. When I delete entities from the first layer (ESPECES_PT), I also delete corresponding entries from the second layer (ESPECES_ATTRIBUTS). However, ...
Giene's user avatar
  • 825
2 votes
1 answer
45 views

PostGIS trigger to convert Curve to LineString

We have GIS data coming into PostGIS as ST_Curve and ST_MultiCurve when doing SELECT st_geometrytype(geom) even though it is meant to be ST_LineString data. We're trying to figure the best way to ...
Andrew T's user avatar
  • 301
0 votes
1 answer
59 views

QGIS - SpatiaLite - SQLite string manipulations (position/replace)

I have two layers : Layer 1: ESPECES_HABITATS_ATTRIBUTS, with fields 'espece' (containing unique values) and 'distance' (an integer). Layer 2: ESPECES_HABITATS_POLY, with fields 'ESPECE' (a ...
Giene's user avatar
  • 825
1 vote
0 answers
34 views

QGIS - SQLite trigger to create buffer but with a non-overlaping clause

I'm using an SQLite trigger to add a buffer around another "POINT" layer based on entered values. The buffers are being correctly added, but I'm encountering difficulty in preventing them ...
Giene's user avatar
  • 825
1 vote
2 answers
107 views

Synchronizing polygon changes between layers using QGIS

I'm working with two distinct SpatiaLite layers, each with specific fields (they are not duplicates of each other). While working on HABITATS_POLY, I aim to update ZONES_HUMIDES_POLY based on field ...
Giene's user avatar
  • 825
1 vote
0 answers
40 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
63 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
44 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
  • 825
2 votes
2 answers
105 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
  • 825
0 votes
1 answer
61 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
  • 825
1 vote
1 answer
63 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
  • 825
0 votes
0 answers
73 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
  • 825
1 vote
0 answers
62 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
  • 825
1 vote
1 answer
66 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
  • 825
1 vote
2 answers
136 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
  • 597
3 votes
1 answer
145 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
  • 1,015
1 vote
0 answers
45 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
  • 873
1 vote
0 answers
21 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,385
2 votes
2 answers
706 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
487 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
308 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
  • 466
2 votes
1 answer
578 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
240 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
541 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
  • 919
4 votes
2 answers
346 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
615 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
42 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
92 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,272
2 votes
2 answers
158 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,272
2 votes
1 answer
470 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
188 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
110 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,350
2 votes
1 answer
1k 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
153 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
  • 558
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
687 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
232 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
246 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
  • 558
3 votes
3 answers
2k 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
654 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
81 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
176 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
103 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
  • 1,015
2 votes
0 answers
121 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
  • 896
6 votes
0 answers
856 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,608
1 vote
1 answer
131 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
  • 117
3 votes
0 answers
92 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
132 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
786 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
  • 1,015