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

Carl Anderson carl.anderson at co.fulton.ga.us
Tue Jun 1 06:01:01 PDT 2004


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.





-- 
Carl Anderson
GIS Manager, Fulton County E&CD
404.730.8026
carl.anderson at co.fulton.ga.us




More information about the postgis-devel mailing list