Re: Fix typo function circle_same (src/backend/utils/adt/geo_ops.c)

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix typo function circle_same (src/backend/utils/adt/geo_ops.c)
Date: 2022-09-02 19:55:15
Message-ID: 3D72A7AE-9ED8-4AD5-B152-2C276FC5D886@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 2 Sep 2022, at 21:22, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
>
> Em sex., 2 de set. de 2022 às 16:15, Daniel Gustafsson <daniel(at)yesql(dot)se <mailto:daniel(at)yesql(dot)se>> escreveu:
> > On 2 Sep 2022, at 21:08, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com <mailto:ranier(dot)vf(at)gmail(dot)com>> wrote:
>
> > At function circle_same the second isnan test is wrong.
>
> Yeah, that seems pretty wrong. Did you attempt to procure a test for when this
> yields the wrong result?
> Hi Daniel,
> Unfortunately not.

On HEAD, the below query yields what seems to be the wrong result for the "same
as" operator:

postgres=# select '<(0,0),NaN>'::circle ~= '<(0,0),1>'::circle;
?column?
----------
t
(1 row)

With the patch applied, it returns the expected:

postgres=# select '<(0,0),NaN>'::circle ~= '<(0,0),1>'::circle;
?column?
----------
f
(1 row)

There seems to be surprisingly few tests around these geo operators?

This was introduced in c4c340088 so any fix needs to be backpatched to v12. I
will do some more testing and digging to verify and will take care of it.

--
Daniel Gustafsson https://vmware.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-09-02 20:12:29 Re: Minimum bison and flex versions
Previous Message Ranier Vilela 2022-09-02 19:22:25 Re: Fix typo function circle_same (src/backend/utils/adt/geo_ops.c)