Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#4670 closed defect (fixed)

St_AddPoint always adds the new point in position 0 for each position provided apart for -1 or leaving it out

Reported by: pizzuga Owned by: Algunenano
Priority: medium Milestone: PostGIS 2.5.5
Component: postgis Version: 2.5.x -- EOL
Keywords: Cc:

Description

In my Debian 9.12 (both postgres 11 and 12 are running on the same machine and both affected by the bug) with postgis_full_version as:

POSTGIS="3.0.1 ec2a9aa" [EXTENSION] PGSQL="120" GEOS="3.7.1-CAPI-1.11.1 27a5e771" PROJ="Rel. 4.9.3, 15 August 2016" LIBXML="2.9.4" LIBJSON="0.12.1" LIBPROTOBUF="1.2.1" WAGYU="0.4.3 (Internal)"

and

POSTGIS="2.5.4" [EXTENSION] PGSQL="110" GEOS="3.7.1-CAPI-1.11.1 27a5e771" PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.1.2, released 2016/10/24" LIBXML="2.9.4" LIBJSON="0.12.1" LIBPROTOBUF="1.2.1" (core procs from "2.5.2 r17328" need upgrade) RASTER (raster procs from "2.5.2 r17328" need upgrade)

St_AddPoint adds the new point always as start point for each value inside the possible valid range. -1 or leaving it out works like expected, maybe due to the correction in #4599.

Attached an example to reproduce the bug.

Attachments (1)

St_AddPoint.sql (6.8 KB ) - added by pizzuga 5 years ago.

Download all attachments as: .zip

Change History (6)

by pizzuga, 5 years ago

Attachment: St_AddPoint.sql added

comment:1 by Algunenano, 5 years ago

Milestone: PostGIS 2.5.5
Owner: changed from pramsey to Algunenano

Simpler repro:

# SELECT ST_AsText(ST_AddPoint('LINESTRING(0 0, 1 1, 3 3, 4 4)'::geometry, 'POINT(2 2)'::geometry, 2));
            st_astext            
---------------------------------
 LINESTRING(2 2,0 0,1 1,3 3,4 4)

comment:2 by Raúl Marín <git@…>, 5 years ago

In b6b33b0d/git:

ST_AddPoint: Fix bug when a positive position is requested

References #4670
Introduced in #4599, so backpatching through 2.5

comment:3 by Raúl Marín <git@…>, 5 years ago

In c3a45a7/git:

ST_AddPoint: Fix bug when a positive position is requested

References #4670
Introduced in #4599, so backpatching through 2.5

comment:4 by Raúl Marín <git@…>, 5 years ago

Resolution: fixed
Status: newclosed

In 10318f5/git:

ST_AddPoint: Fix bug when a positive position is requested

Closes #4670
Introduced in #4599, so backpatching through 2.5

comment:5 by Algunenano, 5 years ago

It should be fixed now. Thanks for the report.

Note: See TracTickets for help on using tickets.