I have this code.
const char * q = "INSERT INTO test_raster (raw_data) VALUES
(ST_SetValues(ST_AddBand(ST_MakeEmptyRaster(2, 2, -180, -90, 180, -90, 0, 0, 4326),
1, '8BUI', 0, 0), 1, 1, 1, $1::double precision[][]))";
double tmp[2][2] = { {0, 125}, {45, 255} };
const char *values[1] = { (char *)&tmp };
int lengths[1] = { 4*sizeof(double) };
int binary[1] = { 1 };
PGresult *rs = PQexecParams(psql,
q,
1,
NULL,
values,
lengths,
binary,
0);
auto stat = PQresultStatus(rs);
printf("%s", PQresultErrorMessage(rs));
where psql
is connection to PostgreSQL with PostGIS. However, when I run this code, I got "ERROR: wrong element type"
What is causing this? OID should be deduced by database from specified ::double precision[][]