# To forbid overlappings in geometry (polygons) using a function or constraint or rule

**URL:** <https://www.pg-forum.de/t/to-forbid-overlappings-in-geometry-polygons-using-a-function-or-constraint-or-rule/404>\
**Category:** Trigger und Funktionen\
**Created:** [7. März 2018 um 13:09 UTC](https://www.pg-forum.de/t/to-forbid-overlappings-in-geometry-polygons-using-a-function-or-constraint-or-rule/404 "2018-03-07T13:09:21Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Beate](https://www.pg-forum.de/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@Beate](https://www.pg-forum.de/u/Beate)\
**Post date:** [7. März 2018 um 13:09 UTC](https://www.pg-forum.de/t/to-forbid-overlappings-in-geometry-polygons-using-a-function-or-constraint-or-rule/404/1 "2018-03-07T13:09:21Z")

</div>

hi,  
does anybody know how you can forbid in the database to save a geometry wich overlaps another geometry in my table? In my table should be allowed st\_disjoint and st\_touches only. I think maybe a constraint or function or rule could manage this?  
I am not looking for a SELECT to find overlapping geometries!  
I want to avoid to insert a new object in mytable wich overlays area of another object. And I want to avoid to update a geometry in mytable wich would overlap an existing object after save.

CREATE TABLE myscheme.mytable  
(  
gid serial NOT NULL,  
object bigint,  
the\_geom geometry(MultiPolygon,25832),  
CONSTRAINT mytable\_pkey PRIMARY KEY (gid)  
)  
WITH (  
OIDS=FALSE  
);  
thanks, Beate

---

_[View the full topic](https://www.pg-forum.de/t/to-forbid-overlappings-in-geometry-polygons-using-a-function-or-constraint-or-rule/404)._
