Tom,

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.
c) If you want to allow only 3D geometries, then what you'd want is 

geom geometryZ

create table testptz (pkey integer primary key, geom geometry(geometryZ));

There is no reason to include a srid constraint unless you plan to enforce it.  
Though putting 0 in there is same as leaving it out.

Hope that helps,
Regina
http://postgis.us


-----Original Message-----
From: postgis-users [mailto:postgis-users-boun...@lists.osgeo.org] On Behalf Of 
Kralidis, Tom (EC)
Sent: Friday, July 28, 2017 1:04 PM
To: postgis-users@lists.osgeo.org
Subject: [postgis-users] table creation and mixed geometries

Hi all: as per [1] we are looking into how GeoAlchemy2 [2] communicates with 
PostGIS when creating columns of type geometry.  Below are two variations of 
table creation/geometry column definition:

a./ create table testptz (pkey integer primary key, geom geometry);

b./ create table testptz (pkey integer primary key, geom geometry(geometry, 0));

The issue/context is being able to insert both POINT and POINTZ geometries into 
a given table.

GeoAlchemy runs the SQL in option b to create the table but runs into error 
when trying to insert as follows:

insert into testptz values (1, 'POINT(0 0 0)');
ERROR: Geometry has Z dimension but column does not

When running the insert command against option a, everything works.  Any 
idea/suggestions?

Thanks

..Tom

[1] https://groups.google.com/forum/#!topic/geoalchemy/LxC9y2JsXhg
[2] https://geoalchemy-2.readthedocs.io/en/latest/

_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users

Reply via email to