Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#5610 closed defect (fixed)

ST_SetPoint on a line with NaN Z values

Reported by: 3nids Owned by: robe
Priority: medium Milestone: PostGIS 3.0.11
Component: postgis Version: 3.4.x
Keywords: Cc:

Description

Using ST_SetPoint on a line with a NaN Z fails

select st_setpoint(
st_makeline(ARRAY[ST_MakePoint(1,2,'Nan'), ST_MakePoint(3,4,10), ST_MakePoint(5,6, 20)]),
2, ST_MakePoint(5,6, 'Nan'))

Fails with Geometry contains invalid coordinates

Tested with docker images (postgis/postgis), this fails in Postgis 3.3 and 3.4 but works in 3.1 and 3.2.

What is the correct approach to set several Z values to NaN on a linestring?

Change History (20)

comment:2 by robe, 5 months ago

Milestone: PostGIS 3.4.1PostGIS 3.4.2

Why would you want to do this? Nan as an argument breaks so many operations.

But I guess this is a regression since you said it's working in 3.1 even though I don't understand the value of having Nan in a coordinate.

It's possible it broke during the PostgreSQL transition to how they handle floats which I forget when that happened I'm thinking around our postgis 3.2 release

comment:3 by 3nids, 5 months ago

How would you handle null values in linestring without NaN?

comment:4 by robe, 5 months ago

Why would you want NULL values in a linestring. Makes sense the who linestring is null, but coordinates in a linestring being NULL? I don't understand the utility of that.

comment:5 by robe, 5 months ago

I took a closer look at this and traced it back to a commit I made, to prevent a crash

in #5319

I'm deliberating if there is a better solution. I was just assuming these strange things happen not intentionally as I couldn't think of a purpose of why one would need to do this.

comment:6 by robe, 5 months ago

Owner: changed from pramsey to robe

Looking closer at that ticket. It's possible I was mistaken about ST_SetPoint triggering a crash and perhaps I was looking at it nested in another call. Let me do some tests again, taking out that check I put in, and if I can't make it crash, I'll take that logic out.

comment:7 by Regina Obe <lr@…>, 5 months ago

In c7d5374/git:

Revert #5319
no nonfinite reject needed for ST_SetPoint
References #5610 for PostGIS 3.5.0

comment:8 by robe, 5 months ago

Milestone: PostGIS 3.4.2PostGIS 3.1.11

comment:9 by Regina Obe <lr@…>, 5 months ago

In 47ecd24/git:

Revert #5319
no nonfinite reject needed for ST_SetPoint
References #5610 for PostGIS 3.4.2

comment:10 by Regina Obe <lr@…>, 5 months ago

In 8e1a2e22/git:

Revert #5319
no nonfinite reject needed for ST_SetPoint
References #5610 for PostGIS 3.3.6

comment:11 by Regina Obe <lr@…>, 5 months ago

In b6702c5/git:

Revert #5319
no nonfinite reject needed for ST_SetPoint
References #5610 for PostGIS 3.2.7

comment:12 by Regina Obe <lr@…>, 5 months ago

In 46ba92a/git:

Revert #5319
no nonfinite reject needed for ST_SetPoint
References #5610 for PostGIS 3.1.11

comment:13 by Regina Obe <lr@…>, 5 months ago

Resolution: fixed
Status: newclosed

In a56cd922/git:

Revert #5319
no nonfinite reject needed for ST_SetPoint
Closes #5610 for PostGIS 3.0.11

comment:14 by robe, 5 months ago

Milestone: PostGIS 3.1.11PostGIS 3.0.11

comment:15 by Regina Obe <lr@…>, 5 months ago

In 19f290f/git:

FIX ST_SetPoint tests

  • Force casing since some systems output NaN and some nan

References #5610 for PostGIS 3.5.0

comment:16 by Regina Obe <lr@…>, 5 months ago

In 8e74985/git:

FIX ST_SetPoint tests

  • Force casing since some systems output NaN and some nan

References #5610 for PostGIS 3.4.2

comment:17 by Regina Obe <lr@…>, 5 months ago

In 198ddd7f/git:

FIX ST_SetPoint tests

  • Force casing since some systems output NaN and some nan

References #5610 for PostGIS 3.3.6dev

comment:18 by Regina Obe <lr@…>, 5 months ago

In 1859a69e/git:

FIX ST_SetPoint tests

  • Force casing since some systems output NaN and some nan

References #5610 for PostGIS 3.2.7

comment:19 by Regina Obe <lr@…>, 5 months ago

In 9214a9fb/git:

FIX ST_SetPoint tests

  • Force casing since some systems output NaN and some nan

References #5610 for PostGIS 3.1.11

comment:20 by Regina Obe <lr@…>, 5 months ago

In 77f4df7/git:

FIX ST_SetPoint tests

  • Force casing since some systems output NaN and some nan

References #5610 for PostGIS 3.0.11

Note: See TracTickets for help on using tickets.