Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • I take that back. Execution worked, all attributes are still intact, there are features in my table, but all geometries itself are not visible any more. So maybe the geometries weren't all simple geometries after all? I had a LineString layer that I have clipped with a polygon. I assumed, all features would still be simple lines... Commented Aug 17, 2023 at 14:03
  • 1
    This kind of assumption should have been validated before. If you had multiple segments per line, well, so long for all but the 1st one. In such case, the solution would have been to create a new table and to select/insert attributes + each individual parts using st_dump Commented Aug 17, 2023 at 14:24
  • 1
    This answer is incorrect. The alter table statement deleted all the geometry because st_geometryn is 1 based, not 0. So you set all the geometry to null with that update statement. Commented Aug 17, 2023 at 19:51
  • 1
    @jbalk well spotted, thanks, I have updated the answer! Hum, I wonder why st_geometryN doesn't throw an error when called with 0 (or negative) parameter Commented Aug 17, 2023 at 19:56
  • 2
    for those interested, here is the request so it throws an error Commented Aug 17, 2023 at 20:12