porsager / postgres

Postgres.js - The Fastest full featured PostgreSQL client for Node.js, Deno, Bun and CloudFlare
The Unlicense
7.04k stars 257 forks source link

Inserting raster data? #836

Open terion-name opened 3 months ago

terion-name commented 3 months ago

I am trying to store tile data to table using postgis-raster type for tile data.

const tile_data = Buffer.from(await res.arrayBuffer())
await db`INSERT INTO ${db(sourceSpec.table)} (z, x, y, tile_data) VALUES (${z}, ${x}, ${y}, ${tile_data})`

result in error

column "tile_data" is of type raster but expression is of type bytea

How to insert raster properly with postgres.js?