[postgis-devel] [PostGIS] #541: unique constraint on geography not enforced on update

PostGIS trac at osgeo.org
Fri Jun 17 16:10:06 PDT 2011


#541: unique constraint on geography not enforced on update
---------------------+------------------------------------------------------
 Reporter:  arno     |       Owner:  pramsey      
     Type:  defect   |      Status:  new          
 Priority:  medium   |   Milestone:  PostGIS 2.0.0
Component:  postgis  |     Version:  trunk        
 Keywords:           |  
---------------------+------------------------------------------------------

Comment(by pramsey):

 I get even less consistent results. Using geometry under 2.0, getting
 this:
 {{{
 postgis20=# CREATE TABLE test (
 postgis20(#     id SERIAL PRIMARY KEY,
 postgis20(#     geom geometry UNIQUE NOT NULL
 postgis20(# );
 NOTICE:  CREATE TABLE will create implicit sequence "test_id_seq" for
 serial column "test.id"
 NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "test_pkey"
 for table "test"
 NOTICE:  CREATE TABLE / UNIQUE will create implicit index "test_geom_key"
 for table "test"
 CREATE TABLE
 postgis20=# INSERT INTO test (geom) VALUES ('POINT(1 3)');
 INSERT 0 1
 postgis20=# INSERT INTO test (geom) VALUES ('POINT(1 2)');
 ERROR:  duplicate key value violates unique constraint "test_geom_key"
 DETAIL:  Key (geom)=(0101000000000000000000F03F0000000000000040) already
 exists.
 postgis20=#
 }}}
 The unique constraint is built using a btree index on geometry which means
 the btree eq and cmp operators are where the action is. This is similar to
 the "can we hash a geometry" problem again. A consistent, comparable hash
 is what we're looking for here.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/541#comment:3>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list