It is very likely that I am misunderstanding the documentation as I'm new to PostGIS, but it says here regarding the "addGeometryColumn" function that since version 2.0.0 of PostGIS:
This function no longer updates geometry_columns [...] So for example building a wgs84 POINT column with this function is now equivalent to: ALTER TABLE some_table ADD COLUMN geom geometry(Point,4326);
However, the command line tool "shp2pgsql" which was shipped with the "postgis" package (I am on Ubuntu 16.04 LTS xenial) generates SQL containing the addGeometryColumn() function, for example:
SELECT AddGeometryColumn('','mytestgeo','geom','26918','POINT',2);
I am definitely using PostGIS 2.5:
SELECT postgis_version();
2.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
Since the shp2pgsql tool was shipped with the postgis package, I would have expected it to conform to PostGIS 2.5 specification. Why then does it still use this method? Is it for backwards compatibility? Have I misunderstood the docs?
addGeometryColumn
adds a geometry column to an existing table of attributes. I thinkshp2pgsql
create a new table and add a geomtry column. It's a good method. However, for modifying / updating a geometry column, don't use theaddGeometryColumn
function.addGeometryColumn
to add new geom fields. As the doc says, this function is not deprecated for fields creation. This function allows you to specify the dimension.