I have a postgis table with point geometry which looks like this
CREATE TABLE mypoints
(
gid serial NOT NULL,
coordid integer,
geom geometry(Point,4326)
);
And a table with coordinates like this
CREATE TABLE mycoords
(
coordid serial NOT NULL,
x numeric(10,4),
y numeric(10,4)
);
I want to create several triggers, that update or insert mypoints.geom
value with MakePoint(mycoords.x, mycoords.y)
function, taking values from joined mycoords
table, and at the same time vice versa - when mypoints.geom
is updated or inserted, correlated mycoords.x
and mycoords.y
values should be calculated with ST_X(mypoints.geom)
and ST_Y(mypoints.geom)
respectively.
How can I do that?