BUG #4647: Geometric functions reorder their parameters randomly - Mailing list pgsql-bugs

From Juho Saarikko
Subject BUG #4647: Geometric functions reorder their parameters randomly
Date
Msg-id 200902120751.n1C7pB44026081@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4647: Geometric functions reorder their parameters randomly  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4647
Logged by:          Juho Saarikko
Email address:      juho.saarikko@gmail.com
PostgreSQL version: 8.3.6
Operating system:   Linux
Description:        Geometric functions reorder their parameters randomly
Details:

According to the online documentation, the ## operator is supposed to return
"Closest point to first operand on second operand". However, in reality it
seems to decide reorder its parameters as a function of them. That is,
sometimes it returns a point on the first operand, and sometimes a point on
the second operand, depending on what those operands are, but seemingly
consistently for a given set of operands.

This behaviour is also present in 8.3.5.


PostgreSQL output (from psql) demonstrating this behaviour:
**************************************

test=# select lseg '((1,1),(1,0))' ## box '((-2,-2),(-4,-4))';
 ?column?
----------
 (1,0)
(1 row)

test=# select lseg '((0,1),(1,0))' ## box '((-2,-2),(-4,-4))';
 ?column?
----------
 (-2,-2)
(1 row)

pgsql-bugs by date:

Previous
From: "Jason"
Date:
Subject: BUG #4646: Default password is patently absurd
Next
From: Swadesh
Date:
Subject: BackUp Problem : PG_graph table - Access Error