[postgis-users] Re: Error messages in PostGIS
Rosangela Silva
rosangela.silva at zenitpolar.com.br
Thu May 22 10:45:50 PDT 2003
Hi,
Thanks for information. Is everything ok now.
But, if I've already created a spatial table with SRID = -1
how can I convert this table (and all its elements) for SRID=4326?
Is it possible??
Thanks
Rosângela
rosangela.silva wrote:
> Hello all,
>
> I'm having two problems with PostGIS that I don't know
> how to solve them. I don't have much experience with database
> management. Could you help me, please?
>
> I DROP a table continent, but I don't DROP the spatial
> index before, and when I try to execute the sql again
> I receive the message below:
>
> $ psql -d geobusca -f continent.sql
> ERROR: Relation 'continent' already exists
> psql:continent.sql:1: ERROR: Relation 'continent' already exists
> ERROR: Cannot insert a duplicate key into unique index geometry_columns_pk
> WARNING: Error occurred while executing PL/pgSQL function addgeometrycolumn
> WARNING: line 39 at execute statement
> psql:continent.sql:2: WARNING: line 39 at execute statementng PL/pgSQL function
> psql:continent.sql:2: ERROR: Cannot insert a duplicate key into unique index ge
> ometry_columns_pk
You need to delete from geometry_columns where f_table_name = 'continent'.
This is done automatically if you use dropGeometryColumn() befor dropping
the table.
>
> In other case, I delete a record from a spatial table and when I try to
> insert the same record again (with some changes) I received the message
> below:
>
> gisdb=# INSERT INTO wpt (wpt_waypointID, wpt_Name, the_geom) VALUES (9, 'TUN
> L25', GeometryFromText('POINT(-46.63758 -23.97345)', 4326));
> ERROR: ExecInsert: rejected due to CHECK constraint "$1" on "wpt"
> ERROR: ExecInsert: rejected due to CHECK constraint "$1" on "wpt"
> gisdb=#
The CHECK constraint "$1" tries to force geometry SRID as specified in
the geometry_columns. You have removed the information related to
the specified table, thus the check is rejected.
>
> I'm using LATLONG/WGS84 and the wpt table is:
> Table "public.wpt"
> Column | Type | Modifiers
> --------------------+---------------------+-----------
> wpt_waypointid | bigint |
> wpt_name | character varying |
> the_geom | geometry |
> Check constraints: "$1" (srid(the_geom) = -1)
> "$2" ((geometrytype(the_geom) = 'POINT'::text) OR (the_geom IS NULL))
>
> But I used the sintaxe bellow to create the table:
> CREATE TABLE wpt (wpt_waypointID bigint, wpt_Name varchar);
> SELECT AddGeometryColumn('geobusca','wpt','the_geom', 4326,'POINT',2);
>
> What can I have to do?
The creation sql seems good, but you have to use DropGeometryColumn()
on the table before dropping the table itself.
If the problems also occurs immediatly after table creation (you never
tried to drop anything) try omitting the first parameter from
AddGeometryColumn.
--strk;
----- Original Message -----
From: Rosangela Silva
To: postgis-users at postgis.refractions.net
Sent: Thursday, May 22, 2003 12:02 PM
Subject: Error messages in PostGIS
Hello all,
I'm having two problems with PostGIS that I don't know
how to solve them. I don't have much experience with database
management. Could you help me, please?
I DROP a table continent, but I don't DROP the spatial
index before, and when I try to execute the sql again
I receive the message below:
$ psql -d geobusca -f continent.sql
ERROR: Relation 'continent' already exists
psql:continent.sql:1: ERROR: Relation 'continent' already exists
ERROR: Cannot insert a duplicate key into unique index geometry_columns_pk
WARNING: Error occurred while executing PL/pgSQL function addgeometrycolumn
WARNING: line 39 at execute statement
psql:continent.sql:2: WARNING: line 39 at execute statementng PL/pgSQL function
psql:continent.sql:2: ERROR: Cannot insert a duplicate key into unique index ge
ometry_columns_pk
In other case, I delete a record from a spatial table and when I try to
insert the same record again (with some changes) I received the message
below:
gisdb=# INSERT INTO wpt (wpt_waypointID, wpt_Name, the_geom) VALUES (9, 'TUN
L25', GeometryFromText('POINT(-46.63758 -23.97345)', 4326));
ERROR: ExecInsert: rejected due to CHECK constraint "$1" on "wpt"
ERROR: ExecInsert: rejected due to CHECK constraint "$1" on "wpt"
gisdb=#
I'm using LATLONG/WGS84 and the wpt table is:
Table "public.wpt"
Column | Type | Modifiers
--------------------+---------------------+-----------
wpt_waypointid | bigint |
wpt_name | character varying |
the_geom | geometry |
Check constraints: "$1" (srid(the_geom) = -1)
"$2" ((geometrytype(the_geom) = 'POINT'::text) OR (the_geom IS NULL))
But I used the sintaxe bellow to create the table:
CREATE TABLE wpt (wpt_waypointID bigint, wpt_Name varchar);
SELECT AddGeometryColumn('geobusca','wpt','the_geom', 4326,'POINT',2);
What can I have to do?
Thanks
Rosângela.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20030522/f4dafb9f/attachment.html>
More information about the postgis-users
mailing list