1

I have a raster table in PostGIS and I have a trigger that inserts into that raster table.I realized that for 130 different raster inputs, all of them voilated raster constraints. In other words, whenever the trigger tried to insert into the raster table, there was an error saying:

new row for relation "raster_table" violates check constraint "enforce_nodata_values_rast"

I have no idea what is going on. I checked the raster input but it is not filled with "no data" values.

I created another table with the same trigger but I did not add raster constraints. This time all the rows were successfully inserted into the table!

I think the problem is with raster constraints. They are somehow doing something wrong! Do you have any idea what is going on?

2

Your input raster might not be filled with NODATA values but still, it might be defined to use a certain NODATA values when NODATA values are necessary.

You can check the NODATA value defined for your raster with the ST_BandNoDataValue(rast, band) function inside PostGIS or with gdalinfo outside the database.

If your raster have a different NODATA defined then what is expected by your raster table constraint, you can undefine or redefine it with ST_SetBandNoDataValue(rast, newvalue).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.