/* raster */
raster = rt_raster_deserialize(pgraster, FALSE);
if (!raster) {
+ MemoryContextSwitchTo(oldcontext);
elog(ERROR, "RASTER_bandmetadata: Could not deserialize raster");
SRF_RETURN_DONE(funcctx);
}
/* numbands */
numBands = rt_raster_get_num_bands(raster);
if (numBands < 1) {
- elog(NOTICE, "Raster provided has no bands");
rt_raster_destroy(raster);
+ MemoryContextSwitchTo(oldcontext);
+ elog(NOTICE, "Raster provided has no bands");
SRF_RETURN_DONE(funcctx);
}
elog(NOTICE, "Invalid band index: %d. Indices must be 1-based. Returning NULL", idx);
pfree(bandNums);
rt_raster_destroy(raster);
+ MemoryContextSwitchTo(oldcontext);
SRF_RETURN_DONE(funcctx);
}
if (NULL == band) {
elog(NOTICE, "Could not get raster band at index %d", bandNums[i]);
rt_raster_destroy(raster);
+ MemoryContextSwitchTo(oldcontext);
SRF_RETURN_DONE(funcctx);
}
/* Build a tuple descriptor for our result type */
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE) {
+ MemoryContextSwitchTo(oldcontext);
ereport(ERROR, (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg(