Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Storing MultiPolygon and Polygon features in a single column used to be as simple as not creating or removing the geometry type check constraint.

Is there a similar simple fix in PostGIS 2?

share|improve this question
up vote 3 down vote accepted

Say you have my_table with a geom column with a typmod geometry(Polygon,4326):

CREATE table my_table(
  gid serial primary key,
  geom geometry(Polygon,4326)

To store whatever geometry type you want, just redefine the typmod to geometry(Geometry,4326), or don't use typmods. (The former enforces the SRID, and the later doesn't enforce anything):

ALTER TABLE my_table ALTER COLUMN geom TYPE geometry(Geometry,4326);

INSERT INTO my_table(geom)

However, the data in the geometry_columns view might not work with some applications, since it also says 'GEOMETRY'.

Lastly, CHECK CONSTRAINTS can always be used with any table, as was the norm in PostGIS 1.5 and before. If you want to keep the table definitions as they were in 1.5, this is still supported.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.