[postgis-devel] Promote Geometry to MultiGeometry on Insert

Regina Obe lr at pcorp.us
Thu Feb 16 10:33:02 PST 2023


Yap what Raúl said and I welcome the "Not having to do ST_Multi" all the time.

> -----Original Message-----
> From: postgis-devel [mailto:postgis-devel-bounces at lists.osgeo.org] On Behalf
> Of Raúl Marín
> Sent: Thursday, February 16, 2023 12:41 PM
> To: postgis-devel at lists.osgeo.org
> Subject: Re: [postgis-devel] Promote Geometry to MultiGeometry on Insert
> 
> Makes sense to me.
> 
> I think that if there is a "sane" cast between types I think it's better to accept it
> and it goes in the same approach as general PG types:
> 
> #create table a (a Integer);
> #insert into a VALUES (0.4);
> INSERT 0 1
> #Select * from a;
>   a
> ---
>   0
> 
> Although I'd really keep it to just sane casts, like geom -> multigeom, or
> multigeom(only_one_geom) ->geom.
> 
> Regards,
> Raúl.
> 
> On 16/2/23 18:19, Paul Ramsey 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