Populate_Geometry_Columns — Ensures geometry columns have appropriate spatial constraints
and exist in the geometry_columns
table.
text Populate_Geometry_Columns(
)
;
int Populate_Geometry_Columns(
oid relation_oid)
;
Ensures geometry columns have appropriate spatial constraints and
exist in the geometry_columns
table. In particular,
this means that every geometry column belonging to a table has at least
three constraints:
enforce_dims_the_geom
- ensures every
geometry has the same dimension (see ST_NDims)
enforce_geotype_the_geom
- ensures every
geometry is of the same type (see GeometryType)
enforce_srid_the_geom
- ensures every
geometry is in the same projection (see ST_SRID)
If a table oid
is provided, this function
tries to determine the srid, dimension, and geometry type of all
geometry columns in the table, adding contraints as necessary. If
successful, an appropriate row is inserted into the geometry_columns
table, otherwise, the exception is caught and an error notice is raised
describing the problem.
If the oid
of a view is provided, as with a
table oid, this function tries to determine the srid, dimension, and
type of all the geometries in the view, inserting appropriate entries
into the geometry_columns
table, but nothing is done
to enforce contraints.
The parameterless variant is a simple wrapper for the parameterized
variant that first truncates and repopulates the geometry_columns table
for every spatial table and view in the database, adding spatial
contraints to tables where appropriate. It returns a summary of the
number of geometry columns detected in the database and the number that
were inserted into the geometry_columns
table. The
parameterized version simply returns the number of rows inserted into
the geometry_columns
table.
Availability: 1.4.0