Search code examples
sqlpostgresqlgeospatialpostgisgeography

PostGIS: register a "geometry" column without AddGeometryColumn


The usual way to create a geometry column is AddGeometryColumn, however I have to work with pre-existing columns, so I can't use that function (as far as I know).

Thanks to the PostGIS docs, I can already register the column in the "geometry_columns" table, however AddGeometryColumn seems to do more than create a column and add a row in geometry_columns, for example it adds checks on the column.


So my question is what: what do I need to do to register the column manually, besides adding a row in geometry_columns ?

(for example, is there a modified version AddGeometryColumn that works with an existing column ?)


Solution

  • The easiest way of doing it on existing columns is using the function Populate_Geometry_Columns:
    https://postgis.net/docs/Populate_Geometry_Columns.html

    In other words: The function you are asking for is already there :-)

    HTH Nicklas