In beginning i had two tables of points and i wanted create from one of this POINT table new table CIRCLES which will contain circle polygons 300 metres around points. This step i have done here:
INSERT INTO circles (geom) (
SELECT ST_Buffer(point, 300, 'quad_segs=8')
FROM points
);
Now I have two tables. First table CIRCLES contain 10 polygons (circles) and each circle have unique serial number (1,2,3,..10). Second table POINTS contain 500 points. How can I, get this result: If any point from table POINTS is located inside polygon (circle) from table CIRCLES, so in table POINTS in column PLGN we will write value of serial number of circle in which is this point inside.
In this task we don't consider case, that one point can be inside two or more circles.
ST_DWithin(poly.geom, p.geom, 300.0)
, which does not require an expensive and imprecise buffer op.