[postgis-users] Upgrade table to PostGIS 2.0 structure

Lee Hachadoorian Lee.Hachadoorian+L at gmail.com
Sun Oct 21 00:32:18 PDT 2012


I finally got around to upgrading from Postgres 8.4 / PostGIS 1.5 to 
Postgres 9.1 / PostGIS 2.0. Did full dump and restore of my database 
using postgis_restore.pl. Noticed that the tables remained in PostGIS 
1.5 format. I tested the following SQL on a table:

ALTER TABLE alis.geo_tracts
ALTER COLUMN the_geom TYPE geometry(MULTIPOLYGON, 26918),
DROP CONSTRAINT enforce_dims_the_geom,
DROP CONSTRAINT enforce_geotype_the_geom,
DROP CONSTRAINT enforce_srid_the_geom
;

This alters a PostGIS 1.5 geometry column to use a typmodded PostGIS 2.0 
geometry column, and removes the no-longer-used constraints. After 
altering the table, it appears correctly in geometry_columns view, and I 
successfully added it as a layer to a Quantum GIS project.

This seems to work, but is there anything I need to know about this? Is 
there (a) anything else that needs to be changed to make the table 
conform to the expected PostGIS 2.0 structure, or (b) any reason why 
this is *not* a good way to upgrade these tables to the new format?

Best,
--Lee

-- 
Lee Hachadoorian
PhD, Earth & Environmental Sciences (Geography)
Research Associate, CUNY Center for Urban Research
http://freecity.commons.gc.cuny.edu

-- 
Lee Hachadoorian
PhD, Earth & Environmental Sciences (Geography)
Research Associate, CUNY Center for Urban Research
http://freecity.commons.gc.cuny.edu




More information about the postgis-users mailing list