[postgis-users] How to add a geography column

Mike Toews mwtoews at gmail.com
Sun Dec 16 20:55:50 PST 2012


On 17 December 2012 09:17, René Fournier <m5 at renefournier.com> wrote:
> I've aware of AddGeometryColumn(), but how can I add a geography column, a
> la:
>
> SELECT AddGeographyColumn ('public','accounts','location',4326,'POINT',2);

Hi René,

If you are using PostGIS 2+, it can be done using standard DDL, with
the typmod syntax[1] to specify the geography type and SRID:

ALTER TABLE accounts
  ADD COLUMN location geography(Point,4326);

That's all!

-Mike

[1] http://postgis.refractions.net/docs/using_postgis_dbmanagement.html#Geography_Basics


More information about the postgis-users mailing list