Opened 5 years ago

Closed 5 years ago

#4599 closed defect (fixed)

ST_AddPoint doesn't work with index -1

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

Description

As reported in https://lists.osgeo.org/pipermail/postgis-users/2019-December/043765.html:

On Mon, Dec 9, 2019 at 8:43 PM Charlton Galvarino  wrote:
>
> Hello, PostGIS.  I have some legacy functions on my hand that I am bringing out of the Dark Ages.
>
> Once upon a time, I needed to take advantage of the "position" parameter to explicitly indicate that I wanted to append to a linestring.
>
> select st_astext(st_addpoint(st_makeline(st_makepoint(0, 0), st_makepoint(1, 1)), st_makepoint(2,2), -1));
>         st_astext
> -------------------------
>  LINESTRING(0 0,1 1,2 2)
>
> Apparently that is now the same thing had I left off the -1 completely.
>
> select st_astext(st_addpoint(st_makeline(st_makepoint(0, 0), st_makepoint(1, 1)), st_makepoint(2,2)));
>         st_astext
> -------------------------
>  LINESTRING(0 0,1 1,2 2)
>
> However, if I left the -1 in there which still seems to support the current documentation, https://postgis.net/docs/ST_AddPoint.html, psql protesteth.
>
> select st_astext(st_addpoint(st_makeline(st_makepoint(0, 0), st_makepoint(1, 1)), st_makepoint(2,2), -1));
> ERROR:  Invalid offset
>
> Perhaps the doc should drop the -1, too?

The issue was introduced in rf9e9411add7a32e4bdc907967c6664242a257ac4 so I'd expect 2.5, 3.0 and master to be affected.

Change History (5)

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

Resolution: fixed
Status: assignedclosed

In bbbd77d/git:

LWGEOM_addpoint: Accept -1 as a valid position

Closes #4599
Closes https://github.com/postgis/postgis/pull/521

comment:2 by Algunenano, 5 years ago

Resolution: fixed
Status: closedreopened

I still need to backport this to 3.0 and 2.5

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

In 6a44fcb9/git:

LWGEOM_addpoint: Accept -1 as a valid position

References #4599

comment:4 by Algunenano, 5 years ago

Backported to 2.5 in 81754c5

comment:5 by Algunenano, 5 years ago

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.