Sample Header Ad - 728x90

Create, Insert, and return BYTEA value

0 votes
1 answer
463 views
I'm creating vector tiles using
and I would like to store them immediately after they are created in addition to returning the object. The below code works fine at creating a bytea response.
WITH mvtgeom AS
(
SELECT ST_AsMVTGeom(
ST_GeomFromText('POLYGON ((0 0, 10 0, 10 5, 0 -5, 0 0))'),
ST_MakeBox2D(ST_Point(0, 0), ST_Point(4096, 4096)),
4096, 0, false)
)

SELECT ST_AsMVT(mvtgeom.*)
FROM mvtgeom
But when I change the last section to include an INSERT statement:
INSERT INTO test SELECT ST_AsMVT(mvtgeom.*)
FROM mvtgeom
I get the response: > This result object does not return rows Which is of course true, but how to insert data which isn't a row? The table test only has an ID and a BYTEA column.
Asked by Tom Shelley (5 rep)
Nov 2, 2022, 05:48 AM
Last activity: Nov 2, 2022, 07:32 AM