This checks if the points (1 1), (2 2), (3 3), and (4 4) all lie inside the polygon defined by (0 0), (10 0), (10 10), (0 10) and (0 0):
SELECT st_contains(
st_polygon(
st_linefrommultipoint(
st_mpointfromtext(
'MULTIPOINT(0 0, 10 0, 10 10, 0 10, 0 0)'
)
),
0
),
st_mpointfromtext(
'MULTIPOINT(1 1, 2 2, 3 3, 4 4)'
)
);
So to find all multipoints that satisfy the criterion, you could use something like that:
SELECT id
FROM multipoints
WHERE st_contains(
st_polygon(
st_addpoint(
st_linefrommultipoint(
multipoints.geom
),
st_startpoint(
st_linefrommultipoint(
multipoints.geom
)
),
-1
),
st_srid(multipoints.geom)
),
st_mpointfromtext(
'MULTIPOINT(1 1, 2 2, 3 3, 4 4)',
8307
)
);
This assumes that the multipoints don't form a closed polygon (i.e., first point is equal to last).
I used SRID 8307 in my example, replace it with the one you need.