~= — Returns
TRUE if A's bounding box is the same as B's.
~= operator returns
TRUE if the bounding box of raster A
is the same as the bounding box of raster B.
This operand will make use of any indexes that may be available on the rasters.
Very useful usecase is for taking two sets of single band rasters that are of the same chunk but represent different themes and creating a multi-band raster
SELECT ST_AddBand(prec.rast, alt.rast) As new_rast FROM prec INNER JOIN alt ON (prec.rast ~= alt.rast);