There are probably similar issues for the vector import?
Trying to import raster layers into PostGIS can lead to a crash possibly because:
when attempting to import a layer that has a nonstandard CRS, rasterlayer.crs().postgisSrid() probably returns a zero or none value, i didnt check, in this case a WKT would probably need to be used with something like crs().toWKT()?, and in this case the CRS selection dialog is opened by the code
you arent supposed to do GUI stuff off the main thread, and the qgsTask is not on the main thread
The srid is passed through the code to the sql invocation https://postgis.net/docs/RT_ST_FromGDALRaster.html , which takes an srid.
The docs state If srid is NULL, the function will try to automatically assign the SRID from the GDAL raster. If srid is provided, the value provided will override any automatically assigned SRID..
I don't know if the gdal raster string contains metadata, in which case maybe that could be used implicitly to pass the cgs?
In some cases the selection dialog comes up successfully but crashes later.
Trying to import raster layers into PostGIS can lead to a crash possibly because:
The srid is passed through the code to the sql invocation https://postgis.net/docs/RT_ST_FromGDALRaster.html , which takes an srid. The docs state
If srid is NULL, the function will try to automatically assign the SRID from the GDAL raster. If srid is provided, the value provided will override any automatically assigned SRID.
.I don't know if the gdal raster string contains metadata, in which case maybe that could be used implicitly to pass the cgs?
In some cases the selection dialog comes up successfully but crashes later.