Hi Jukka,
> Thank you for the SQL. I discovered that the problem in in another
> place. What happens is that if I have the table with POINT and NULL
> geometries first and I try to register the table into
> geometry_columns
> afterwords then it fails.
>
> DELETE FROM geometry_columns WHERE f_table_name='jukka'
> SELECT AddGeometryColumn('jukka', 'geom', 4326, 'POINT', 'XY');
>
the above SQL will surely fail; the clean way to do such a thing is
as shown below:
SELECT DiscardGeometryColumn('jukka', 'geom');
SELECT RecoverGeometryColumn('jukka', 'geom', 4326, 'POINT', 'XY');
a) performing a direct "DELETE FROM geometry_columns" isn't a good
idea;
it will surely remove the row in this table, but will not drop the
related triggers supporting Geometry.
may well be a minor and harmless issue. anyway using
DiscardGeometryColumn()
is what is expected in this case.
b) AddGeometryColumn() will surely fail if the "geom" column already
exists.
an implicit "ALTER TABLE ADD COLUMN geom" will be silently executed,
and will
obviously fail.
AddGeometryColumn() is intended to create from scratch a brand new
column.
in order to register an already defined (and may be, already
populated column)
you are expected to use RecoverGeometryColumn()