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

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, 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-03 07:36:17
Message-ID: 20220903073617.aaukdstlpe7uivt7@jrouhaud
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Fri, Sep 01, 2022 at 09:55:15PM +0200, Daniel Gustafsson wrote:
> > 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?

Yeah, there are unfortunately a lot of problems around those and NaN, with
multiple reports in the past (I recall [1] and [2] but there were others).
There was a CF entry that tried to improve things [3], part of it was committed
but not all [4], and clearly some more work is needed.

[1] https://www.postgresql.org/message-id/flat/CAGf+fX70rWFOk5cd00uMfa__0yP+vtQg5ck7c2Onb-Yczp0URA(at)mail(dot)gmail(dot)com
[2] https://www.postgresql.org/message-id/20210330095751.x5hnqbqcxilzwjlm@nol
[3] https://commitfest.postgresql.org/38/2710/
[4] https://www.postgresql.org/message-id/3558828.1659045056@sss.pgh.pa.us

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-09-03 08:06:19 Re: Avoid erroring out when unable to remove or parse logical rewrite files to save checkpoint work
Previous Message Julien Rouhaud 2022-09-03 07:09:03 Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error