[postgis-devel] Promote Geometry to MultiGeometry on Insert

Paul Ramsey pramsey at cleverelephant.ca
Thu Feb 16 11:44:48 PST 2023


We still have mixed policy on this, I think? I think it is, again, likely to be non-intrusive to users if functions like function (linestring) that currently return null on all multilinestring return a result for single-valued multi-linestring. we also have some affordances in things like st_geometryn to return the input when called on singletons with index of 1.

P

> On Feb 16, 2023, at 11:40 AM, Martin Davis <mtnclimb at gmail.com> wrote:
> 
> iI we do this can we also make sure functions accept both Geom and MultiGeom where that makes sense?  That will lessen the pain of transition, and also make queries simpler.
> 
> On Thu, Feb 16, 2023 at 9:20 AM Paul Ramsey <pramsey at cleverelephant.ca> wrote:
> In 3.1 we started allowing people to insert SRID=0 geometries into columns with an SRID typmod, so that people wouldn't have to always add the SRID value when what they *meant* was to insert a conforming geometry into the column. SRID conflicts would still raise an error, but a SRID=0 is not a conflicting SRID, it's an unset SRID, so accepting the geometry and adding the typmod column made sense.
> 
> In a similar vein, it kind of makes sense to accept simple geometries as input to multigeometry columns:
> 
> CREATE TABLE mp (geom Geometry(MultiPolygon, 3005);
> INSERT INTO mp VALUES ('POLYGON(...)');
> SELECT ST_AsEWKT(geom) FROM mp;
> 
> SRID=3005;MULTIPOLYGON(...)
> 
> Again, in the spirit of "do what I mean". If 100% of the time, the response to a "geometry type mismatch" is just to wrap the input in ST_Multi(), the "data integrity check" isn't really helping, it's just adding a step to every interaction.
> 
> Comments and concerns?
> 
> P
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-devel
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-devel



More information about the postgis-devel mailing list