[postgis-users] What's the Purpose of the Geometry_Columns Table?

Markus Schaber schabi at logix-tt.com
Tue Sep 5 10:24:11 PDT 2006


Hi, Stephen,

I'm relatively new in the business, so I'll try to speak for all of us
without leaning to much out of the window. :-)

Stephen Frost wrote:
> Can the PostGIS devs comment on if user-defined types with multi-field
> typemods would be sufficient to replace geometry_columns and remove the
> need for the ugly 'AddGeometryColumn()' functions and the various CHECK
> constraints that go along with it?  (Note: geometry_columns could remain
> in the system, it'd just be a view though)

We cannot just drop geometry_columns as well as AddGeometryColumn() and
DropGeometryColumn(). We need those to be OpenGIS compliant, as those
are the standardized "database-independent" way for applications to
handle geometry columns. PostGIS itself works without them just fine.

But we'd be happy to replace geometry_columns with a view, and the
functions with small SQL functions containing a simple ALTER TABLE
ADD/DROP COLUMN statement. That's what we wanted to have from the beginning.

I hope this will also allow us to drop the constraints that
AddGeometryColumn() currently adds to the table to check srid, dimension
and type.

Another problem we currently have is that transferring data via
databases by dumping single tables with "pg_dump --table" and then
inserting those tables into another database loses the geometry_columns
information. We also hope this would automagically be solved by turning
geometry_columns into a view.

It might be helpful to have the typemods nullable, to allow for
mixed-srid / mixed-dimension / mixed-type tables, but I think that we
could handle that with special values, too.

> I'd like to present the idea of:
> create table mydata (
>   wkb_geometry geometry(dims,srid,type)
> );

> to the Postgres Hackers list as a real-world use-case for multi-field
> typemods, but only if the folks around here think it'd actually be
> used..

Yes, I think it will be used and appreciated.

We could cope with a single-field typemod by using a custom data type or
some bit mangling, but a multi-field typemod is much more comfortable.

Thanks,
Markus
-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org



More information about the postgis-users mailing list