Patrik Sylve e6a1000155
Use pg_trigger_depth to avoid re-trigger in update (#1708)
Some of the `update_osm_${LAYER}`-functions, which are executed by triggers on updates, execute an UPDATE statement on the same tables that have these triggers. This causes the trigger functions `flag` and `store` to run multiple times for one record. 

For instance, if I add log in the trigger functions and run an INSERT on `osm_housenumber_point`, this output is generated:  

```
NOTICE:  Store
NOTICE:  Flag
NOTICE:  Refresh housenumber
NOTICE:  Flag
NOTICE:  Store
NOTICE:  Flag
INSERT 0 1
```

If we limit the triggers from executing if they are called from another trigger using `pg_trigger_depth() < 1`, the triggers will only be triggered once per record:

```
NOTICE:  Store
NOTICE:  Flag
NOTICE:  Refresh housenumber
INSERT 0 1
```

This will prevent redunant executions and might improve update performance.  

Co-authored-by: Patrik Sylve <patrik.sylve@t-kartor.com>
2025-02-18 11:18:04 +01:00
..
2017-12-04 12:06:28 +01:00
2023-01-06 10:08:03 +01:00

housenumber

Docs

Read the layer documentation at http://openmaptiles.org/schema#housenumber

Mapping Diagram

Mapping diagram for housenumber

ETL diagram

ETL diagram for housenumber