According to the PostGIS manual, geometry columns should not by added directly, but using AddGeometryColumn():

AddGeometryColumn — Adds a geometry column to an existing table of attributes.

I am copying a schema from one PostgreSQL instance to another. I wonder if the SQL created by pg_dump is good enough - will it create the geometry columns the same way AddGeometryColumn() does?

1 Answer 1



First that is old document -- new one is here: http://postgis.net/docs/AddGeometryColumn.html

Though what they say in both is the same.

The using that function is only need for 1.5 and below. 2.0 we encourage you to just create the table normally.

something like

CREATE TABLE test(gid serial primary key, geom geometry(POLYGON, 4326) );

pg_dump works fine either way since in old version it would restore the constraints and new version the create table would be built with typmodifiers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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