I have a point table and the buffer geometry is created around the point.

I have defined the if the point is within the buffer_distance then its value is =1
and if it is outside the buffer its value is =0, and when it is on buffer_polygon then =2.

Now when ever i change the location of point then it should check the following conditions and the flag value should change according to the location of point new position.

I am changing the position of the point in QGIS.

My table structure is like this:-

GID(PK) Flag(INT) Buffer_Distance THE_Geom Buffer_GEOM
1 1 100 point(X,Y Location) Buffer Created around the Point
2 2 200 point(X,Y Location) Buffer Created around the Point
3 2 200 point(X,Y Location) Buffer Created around the Point
4 3 300 point(X,Y Location) Buffer Created around the Point
5 3 300 point(X,Y Location) Buffer Created around the Point
6 1 100 point(X,Y Location) Buffer Created around the Point