0

I have a PostGIS table in which the geometries are mixed Linestring and Multilinestring. But QGIS doesn't like it very much (it splits the table by the different geometries in the "add PostGIS table" dialog for example).

I would like to have only multilinestring type. I tried converting the type with

ALTER TABLE LaTable
    ALTER COLUMN geom TYPE geometry(MULTILINESTRING, 31370)

but I got error

ERROR:  Geometry type (LineString) does not match column type (MultiLineString)

I even tried the other way around (multilinestring --> linestring) but I also got the error the other way around :

ERROR:  Geometry type (MultiLineString) does not match column type (LineString)

Is there an other way I could get a single-type geometry on this table ?

0

You need to explicitly cast the linestring to multilinestring using st_multi

ALTER TABLE LaTable
    ALTER COLUMN geom TYPE geometry(MULTILINESTRING, 31370) USING ST_Multi(geom);
| 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.