I have a layer on ESPG 4326 and I want to reproject it to ESPG 3857. I'm using this SQL query:
ALTER TABLE table ALTER COLUMN geom TYPE geometry(Geometry, 3857) USING ST_Transform(ST_SetSRID(geom, 4326), 3857) ;
But I'm getting this error:
ERROR: transform: couldn't project point (271600 5.1817e+006 0): latitude or longitude exceeded limits (-14) SQL state: XX000
I read somewhere to switch the lat and long, but when I open the layer on QGIS (from DDBB) with the expected projection (ESPG 3857) seems all right. I can't export from QGIS and reimport to PostGIS because the layer is to big, so I need to change the projection in PostGIS directly.