[postgis-users] table creation and mixed geometries

Regina Obe lr at pcorp.us
Mon Jul 31 09:01:29 PDT 2017

> On Fri, Jul 28, 2017 at 10:56:14PM -0400, Regina Obe wrote:

>> a) geom geometry   means no restriction whatsoever.  No typmod is applied.
>> b) geometry typmod is short for any 2D geometry so it won't allow Zs.

> It keeps striking me that there's no way to have unconstrained number of dimensions when using AddGeometryColumn (both typmod based or constraint-based). We can have unconstrained spatial type and 
> SRS but no unconstrained ZM flags: isn't that unfair ?

> --strk;
Unfair?  I suppose.
You want to implement strk for 2.4.  I never bothered to check how much effort it would be to do this since it seemed like a rare request.   I think for constraint way it would not be too hard to add an overloaded that allows it.  Though I don't think that would help Tom's original gripe that he wanted to do it in Django and Django expects typmod.

I was also concerned if we could would it just cause misuse with people unintentionally mixing dimensionality.

Mixing dimensionally different geometries in same table always seemed like an unpleasant thing to do to me as then you get into questions like

What does ST_Union of 2D and 3D points mean especially since our ST_Union is 3dish.
What does ST_MakeLine do when you try to make a line between 2D and 3D points.

What kind of monster would ST_Collect make or would it throw an error since it's illegal to have a mixed dimensionality collection.

I suppose you could say the same for SRID, but mixing SRIDs was always a side effect of us not trying to stop it rather than the ability to not do it being there already. 
When in doubt do nothing.  It is better to not lift a finger than to lift a finger in error is my motto :)


More information about the postgis-users mailing list