[postgis-devel] Re: [postgis-users] usage of AddGeometryColumn etc.

strk strk at keybit.net
Tue Jun 1 09:00:28 PDT 2004


On Tue, Jun 01, 2004 at 09:01:01AM -0400, Carl Anderson wrote:
> strk wrote:
> >On Tue, Jun 01, 2004 at 01:19:47PM +0200, Hubert Fröhlich wrote:
> >
> >>Hi list,
> >>
> >>I have a table with a geometry column.
> >>
> >>
> >>
> >>test=# create table demo(col1 text);
> >>test=#  select AddGeometryColumn('', 'demo', 
> >>'pgpoly','31494','MULTIPOLYGON',2);
> >>                                    
> >>addgeometrycolumn                                      
> >>----------------------------------------------------------------------------------------------
> >>Geometry column pgpoly added to table public.demo WITH a SRID of 31494 
> >>and type MULTIPOLYGON
> >>(1 row)
> >>
> >>When I drop the table without dropping the geometry column first
> >>
> >>test=# drop table demo;
> >>DROP TABLE
> >>test=# select * from geometry_columns;
> >>f_table_catalog | f_table_schema | f_table_name | f_geometry_column | 
> >>coord_dimension | srid  |     type     | attrelid | varattnum | stats
> >>-----------------+----------------+--------------+-------------------+-----------------+-------+--------------+----------+-----------+-------
> >>               | public         | demo         | pgpoly            
> >>|               2 | 31494 | MULTIPOLYGON |  5391696 |         3 |
> >>(1 row)
> >>
> >>
> >>I learn that DROP TABLE did not remove my geometry fully - I have to
> >>- either delete the entry in geometry_columns.
> >>- or execute a DropGeometryColumn(....) before DROPing the table.
> >>
> >>a) It would be quite comfortable just DROPping tables ... Is it intended 
> >>or possible to improve the functions this way?
> >
> >
> >Not intended.
> >Postgresql guys does not approve triggers on system catalogues.
> >
> >Maybe, the next AddGeoemtryColumn call could 'detect' those
> >spurious records in geometry_columns and get rid of them, or
> >just always replace records there.
> >
> >What users think `bout this ?
> >
> 
> My last post to [postgis-devel] was an update to update_geometry_stats()
> that NULLed attrelid before repopulating it. (among other things)
> 
> As a side effect of that activity after update_geometry_stats() any 
> entry in geometry_coulmns with a NULL attrelid is an unreachable table 
> and could be deleted.  Not that I think its a good idea to automate the 
> delete though.

Again, triggers on system tables are not seen with simpaty.
If you guys write down every occurrence of the stale record problem
we can find out an ad-hoc solution (like adding check in AddGeometryColumn
which I think is the one function making noise about it).

--strk;

PS: I've just committed changes in the postgis.sql.in file to make
    find_extent and build_histogram2d (and update_geometry_stats)
     better support schema in the way you suggested.

> 
> 
> 
> 
> 
> -- 
> Carl Anderson
> GIS Manager, Fulton County E&CD
> 404.730.8026
> carl.anderson at co.fulton.ga.us
> 
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel



More information about the postgis-devel mailing list