Opened 12 years ago

Closed 12 years ago

#2060 closed defect (fixed)

GetTopoGeomElementArray: ERROR: value for domain topoelementarray violates check constraint "dimensions"

Reported by: strk Owned by: strk
Priority: medium Milestone: PostGIS 2.0.2
Component: topology Version: 2.0.x
Keywords: history Cc:

Description

I created a TopoGeometry with this call:

insert into city_data.fph (g) 
select CreateTopoGeom('city_data', 3, 3, '{{1,1},{2,1}}');

Which produced these records in the relation table:

 topogeo_id | layer_id | element_id | element_type 
------------+----------+------------+--------------
          4 |        3 |          1 |            1
          4 |        3 |          2 |            1
(2 rows)

But then GetTopoGeomElementArray can't get its result:

 select GetTopoGeomElementArray(g) from city_data.fp;
ERROR:  value for domain topoelementarray violates check constraint "dimensions"

There's indeed some confusion between what's an id and what's a type, I suspect the function isn't well tested for that…

Change History (5)

comment:1 by strk, 12 years ago

But it's interesting that there's no "dimensions" constraint in topology.sql, so maybe I'm using an old installation ?!

comment:2 by strk, 12 years ago

OOps, there is:

CREATE DOMAIN topology.TopoElement AS integer[]
  CONSTRAINT DIMENSIONS CHECK (
    array_upper(VALUE, 2) IS NULL
    AND array_upper(VALUE, 1) = 2
  );

comment:3 by strk, 12 years ago

Sorry, the above is for "TopoElement", while for "TopoElementArray" it is:

CREATE DOMAIN topology.TopoElementArray AS integer[][]
  CONSTRAINT DIMENSIONS CHECK (
    array_upper(VALUE, 2) IS NOT NULL
    AND array_upper(VALUE, 2) = 2
    AND array_upper(VALUE, 3) IS NULL
  );

comment:4 by strk, 12 years ago

Guess what it is ? You can't have a NULL value !

Boils down to this:

SELECT NULL::topology.TopoElementArray;

Which gives you the error:

ERROR:  value for domain topoelementarray violates check constraint "dimensions"

And this is as of:

 PostgreSQL 9.1.6 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit

comment:5 by strk, 12 years ago

Keywords: history added
Resolution: fixed
Status: newclosed

Fixed by r10501 in 2.0 branch and r10502 in trunk

Note: See TracTickets for help on using tickets.