Re: Aren't lseg_eq and lseg_ne broken? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Aren't lseg_eq and lseg_ne broken?
Date
Msg-id 200211291803.gATI3Yn26305@candle.pha.pa.us
Whole thread Raw
In response to Aren't lseg_eq and lseg_ne broken?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> By chance I just noticed that lseg equality is coded as
> 
> Datum
> lseg_eq(PG_FUNCTION_ARGS)
> {
>     LSEG       *l1 = PG_GETARG_LSEG_P(0);
>     LSEG       *l2 = PG_GETARG_LSEG_P(1);
> 
>     PG_RETURN_BOOL(FPeq(l1->p[0].x, l2->p[0].x) &&
>                    FPeq(l1->p[1].y, l2->p[1].y) &&
>                    FPeq(l1->p[0].x, l2->p[0].x) &&
>                    FPeq(l1->p[1].y, l2->p[1].y));
> }
> 
> Surely this should be
> 
>     PG_RETURN_BOOL(FPeq(l1->p[0].x, l2->p[0].x) &&
>                    FPeq(l1->p[0].y, l2->p[0].y) &&
>                    FPeq(l1->p[1].x, l2->p[1].x) &&
>                    FPeq(l1->p[1].y, l2->p[1].y));

Yep, there could be no possible reason to double-test something like the
original code does.  It must be wrong.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Aren't lseg_eq and lseg_ne broken?
Next
From: Tom Lane
Date:
Subject: Re: nested transactions