Thread: BUG #12877: Altitude not respected in order by and group by

BUG #12877: Altitude not respected in order by and group by

From
m8r-444fqh@mailinator.com
Date:
The following bug has been logged on the website:

Bug reference:      12877
Logged by:          m8r-444fqh
Email address:      m8r-444fqh@mailinator.com
PostgreSQL version: 9.3.4
Operating system:   centos
Description:

-- "PostgreSQL 9.3.4 on x86_64-unknown-linux-gnu, compiled by gcc (GCC)
4.4.7 20120313 (Red Hat 4.4.7-4), 64-bit"
-- Postgis: "2.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1"

create table v001 ( edge bigint, vertex geometry(PointZ,4326) );

insert into v001 values
( 19757751000,st_geomfromtext('POINT Z (-87.63394 41.8868 0)',4326)),
( 19757752000,st_geomfromtext('POINT Z (-87.63394 41.8868 0)',4326)),
( 19757763000,st_geomfromtext('POINT Z (-87.63394 41.8868 0)',4326)),
( 19791042000,st_geomfromtext('POINT Z (-87.63394 41.8868 -1)',4326)),
( 721078263000,st_geomfromtext('POINT Z (-87.63394 41.8868 0)',4326)),
( 721078269000,st_geomfromtext('POINT Z (-87.63394 41.8868 -1)',4326));

-- 1.Query, fails to sort altitude:
select edge, st_astext( vertex ) from v001
 order by vertex,edge;

-- 1.Results:
-- 19757751000;"POINT Z (-87.63394 41.8868 0)"
-- 19757752000;"POINT Z (-87.63394 41.8868 0)"
-- 19757763000;"POINT Z (-87.63394 41.8868 0)"
-- 19791042000;"POINT Z (-87.63394 41.8868 -1)"
-- 721078263000;"POINT Z (-87.63394 41.8868 0)"
-- 721078269000;"POINT Z (-87.63394 41.8868 -1)"

-- 2.Query, fails to respect altitude:
select array_agg( edge ) as edges, st_astext(vertex) from v001
group by vertex;

-- 2.Results:
--
"{19757751000,19757752000,19757763000,19791042000,721078263000,721078269000}";"POINT
Z (-87.63394 41.8868 0)"

Re: BUG #12877: Altitude not respected in order by and group by

From
Tom Lane
Date:
m8r-444fqh@mailinator.com writes:
> -- 1.Query, fails to sort altitude:
> select edge, st_astext( vertex ) from v001
>  order by vertex,edge;
> -- 2.Query, fails to respect altitude:
> select array_agg( edge ) as edges, st_astext(vertex) from v001
> group by vertex;

It's not entirely clear to me that those *should* do something with
altitude, but in any case this is not a Postgres issue it's a Postgis
issue.  You need to take it up on the postgis mailing lists.

            regards, tom lane