[postgis-users] table creation and mixed geometries

Kralidis, Tom (EC) tom.kralidis at canada.ca
Fri Jul 28 10:04:24 PDT 2017

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?



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

More information about the postgis-users mailing list