[postgis-devel] [PostGIS] #520: No check for different srid on operators when index is used
PostGIS
trac at osgeo.org
Sat Jun 18 23:06:01 PDT 2011
#520: No check for different srid on operators when index is used
---------------------+------------------------------------------------------
Reporter: nicklas | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 2.0.0
Component: postgis | Version: trunk
Keywords: |
---------------------+------------------------------------------------------
Comment(by robe):
You are mistaken. What Nicklas is saying is that if you have an index --
its ignore. Here is a standalone example that I ran on 2.0 and didn't
throw an error:
{{{
CREATE TABLE tb1(gid serial primary key, geom geometry);
CREATE INDEX idx_tb1_geom_gist ON tb1 USING gist(geom);
INSERT INTO tb1(geom)
SELECT ST_SetSRID(ST_Point(i,j),srid)
FROM generate_series(-10,10,2) As i
CROSS JOIN generate_series(-10,10,2) As j
CROSS JOIN generate_series(4325,4326) As srid;
SELECT a.gid As a_gid, b.gid As b_gid, ST_SRID(a.geom) As a_srid,
ST_SRID(b.geom) As b_srid
FROM tb1 As a, tb1 As b
WHERE a.geom && b.geom
}}}
Result is:
a_gid b_gid a_srid b_srid
1 1 4325 4325
1 122 4325 4326
If I do this though:
{{{
SELECT a.gid As a_gid, b.gid As b_gid, ST_SRID(a.geom) As a_srid,
ST_SRID(b.geom) As b_srid
FROM tb1 As a, tb1 As b
WHERE a.geom && b.geom
AND ST_SRID(a.geom) = 4325 AND ST_SRID(b.geom) = 4326;
}}}
I do get an error of:
{{{
ERROR: Operation on two geometries with different SRIDs
}}}
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/520#comment:8>
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