[postgis-users] Should we change existing geometry columns to typmod instead of constraint-based?

Mike Toews mwtoews at gmail.com
Mon Nov 12 14:11:51 PST 2012


They are easier to manage, and don't require as much maintenance. So for
instance, if you create a new table from a query:

SELECT * INTO region
FROM world WHERE ...;

if the table "world" has a typmod geometry column, then these would appear
in "region" as e.g., geometry(Point,4326). Geometry columns without typmods
or constraints can also be misleading, since the geometry columns view
will misrepresent their geometry type (just GEOMETERY), dimension (2) and
srid (0), even if the data has otherwise.

Most of your changes shouldn't require much drama. You can do them
in-place, e.g.:

ALTER TABLE world
    ALTER COLUMN geom TYPE geometry(MultiPolygonZ,4326);

then drop the old constraints.

-Mike


On 13 November 2012 05:26, Shira Bezalel <shira at sfei.org> wrote:

>
> Hi All,
>
> We have recently upgraded our databases to use PostGIS 2.0.1 from 1.5. Is
> it recommended that we recreate our tables with geometry columns so that
> they use the typmod geometries instead of the constraint-based geometries?
> Is there any advantage to this?
>
> Thanks,
> Shira
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121113/0908302c/attachment.html>


More information about the postgis-users mailing list