Opened 9 years ago
Closed 4 years ago
#3372 closed defect (fixed)
TopoElementArray cannot be null
Reported by: | strk | Owned by: | strk |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.1.0 |
Component: | topology | Version: | 2.0.x |
Keywords: | Cc: |
Description
Trying to GetTopoElementArray for an empty TopoGeometry fails due to NULL not passing the TopoElementArray domain constraint:
t=# select null::topoelementarray; ERROR: value for domain topoelementarray violates check constraint "dimensions"
I think the check should allow for null…
Change History (11)
comment:1 by , 9 years ago
comment:2 by , 7 years ago
Milestone: | PostGIS 2.0.8 → PostGIS 2.2.6 |
---|
comment:3 by , 7 years ago
Milestone: | PostGIS 2.2.6 → PostGIS 2.2.7 |
---|
comment:4 by , 7 years ago
Milestone: | PostGIS 2.2.7 → PostGIS 2.2.8 |
---|
comment:6 by , 5 years ago
Milestone: | PostGIS 2.3.10 → PostGIS 2.5.4 |
---|
comment:7 by , 5 years ago
Milestone: | PostGIS 2.5.4 → PostGIS 2.5.5 |
---|
comment:8 by , 4 years ago
Milestone: | PostGIS 2.5.5 → PostGIS 3.0.3 |
---|
comment:9 by , 4 years ago
Still doesn't work on PostgreSQL 13.
Is there a reason we can't just change the constraint to:
ALTER DOMAIN topology.topoelementarray DROP CONSTRAINT dimensions; ALTER DOMAIN topology.topoelementarray ADD CONSTRAINT dimensions CHECK ( array_upper(VALUE, 2) = 2 AND array_upper(VALUE, 3) IS NULL);
Then the NULL thing wouldn't violate because NULL is special. Then the below works.
SELECT null::topoelementarray;
comment:10 by , 4 years ago
Milestone: | PostGIS 3.0.3 → PostGIS 3.1.0 |
---|
strk said on IRC okay to make the change, but I feel it's not kosher to do in a micro release so pushing to 3.1.0.
Note:
See TracTickets
for help on using tickets.
Now this is funny, I can create a NULL TopoElementArray like this:
Now I wonder why the "dimensions" constraint only kicks in with a literal ! This is PostgreSQL 9.3.6.
The domain definition is here: https://trac.osgeo.org/postgis/browser/tags/2.2.0/topology/topology.sql.in#L384