pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Check all four box corners in SP-GiST quad tree <@ search
7+ messages / 1 participants
[nested] [flat]

* pgsql: Check all four box corners in SP-GiST quad tree <@ search
@ 2026-10-30 05:36  John Naylor <john.naylor@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: John Naylor @ 2026-10-30 05:36 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check all four box corners in SP-GiST quad tree <@ search

When the centroid lies outside the query box, spg_quad_inner_consistent()
keeps only the quadrants that contain a corner of the box.  It meant to
test all four corners, but the last step set x back to low.x instead of
y to low.y, so it tested (low.x, high.y) twice and never (high.x, low.y).

With exact comparisons the missing corner would not matter: a box that
does not contain the centroid lies on one side of it on at least one
axis, so (high.x, low.y) shares a quadrant with another corner, but
getQuadrant() compares with FPeq(), which tiebreaks to the lowest
numbered quadrant.

When a box edge lies within EPSILON of the centroid, the corner on that
edge counts as being on the centroid's line, and (high.x, low.y) may be
the only corner in its quadrant.  That quadrant was then skipped.  Fix
the missing corner test.

Discussion: https://postgr.es/m/CANWCAZZZpkwrX0kC4Jo6KM27J6dyBdCDir-PbjEYAS06r%3D4-ag%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/03ba8e591543ab63d5eb230f03e024df54553b5d

Modified Files
--------------
src/backend/access/spgist/spgquadtreeproc.c | 2 +-
src/test/regress/expected/spgist.out        | 9 +++++++++
src/test/regress/sql/spgist.sql             | 5 +++++
3 files changed, 15 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Check all four box corners in SP-GiST quad tree <@ search
@ 2026-10-30 05:36  John Naylor <john.naylor@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: John Naylor @ 2026-10-30 05:36 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check all four box corners in SP-GiST quad tree <@ search

When the centroid lies outside the query box, spg_quad_inner_consistent()
keeps only the quadrants that contain a corner of the box.  It meant to
test all four corners, but the last step set x back to low.x instead of
y to low.y, so it tested (low.x, high.y) twice and never (high.x, low.y).

With exact comparisons the missing corner would not matter: a box that
does not contain the centroid lies on one side of it on at least one
axis, so (high.x, low.y) shares a quadrant with another corner, but
getQuadrant() compares with FPeq(), which tiebreaks to the lowest
numbered quadrant.

When a box edge lies within EPSILON of the centroid, the corner on that
edge counts as being on the centroid's line, and (high.x, low.y) may be
the only corner in its quadrant.  That quadrant was then skipped.  Fix
the missing corner test.

Discussion: https://postgr.es/m/CANWCAZZZpkwrX0kC4Jo6KM27J6dyBdCDir-PbjEYAS06r%3D4-ag%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9ad421a9b970b672136fc681f2001876dec01072

Modified Files
--------------
src/backend/access/spgist/spgquadtreeproc.c | 2 +-
src/test/regress/expected/spgist.out        | 9 +++++++++
src/test/regress/sql/spgist.sql             | 5 +++++
3 files changed, 15 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Check all four box corners in SP-GiST quad tree <@ search
@ 2026-10-30 05:36  John Naylor <john.naylor@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: John Naylor @ 2026-10-30 05:36 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check all four box corners in SP-GiST quad tree <@ search

When the centroid lies outside the query box, spg_quad_inner_consistent()
keeps only the quadrants that contain a corner of the box.  It meant to
test all four corners, but the last step set x back to low.x instead of
y to low.y, so it tested (low.x, high.y) twice and never (high.x, low.y).

With exact comparisons the missing corner would not matter: a box that
does not contain the centroid lies on one side of it on at least one
axis, so (high.x, low.y) shares a quadrant with another corner, but
getQuadrant() compares with FPeq(), which tiebreaks to the lowest
numbered quadrant.

When a box edge lies within EPSILON of the centroid, the corner on that
edge counts as being on the centroid's line, and (high.x, low.y) may be
the only corner in its quadrant.  That quadrant was then skipped.  Fix
the missing corner test.

Discussion: https://postgr.es/m/CANWCAZZZpkwrX0kC4Jo6KM27J6dyBdCDir-PbjEYAS06r%3D4-ag%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9cba87fe947fc3e713bb4ba3be25e34fdb64266d

Modified Files
--------------
src/backend/access/spgist/spgquadtreeproc.c | 2 +-
src/test/regress/expected/spgist.out        | 9 +++++++++
src/test/regress/sql/spgist.sql             | 5 +++++
3 files changed, 15 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Check all four box corners in SP-GiST quad tree <@ search
@ 2026-10-30 05:36  John Naylor <john.naylor@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: John Naylor @ 2026-10-30 05:36 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check all four box corners in SP-GiST quad tree <@ search

When the centroid lies outside the query box, spg_quad_inner_consistent()
keeps only the quadrants that contain a corner of the box.  It meant to
test all four corners, but the last step set x back to low.x instead of
y to low.y, so it tested (low.x, high.y) twice and never (high.x, low.y).

With exact comparisons the missing corner would not matter: a box that
does not contain the centroid lies on one side of it on at least one
axis, so (high.x, low.y) shares a quadrant with another corner, but
getQuadrant() compares with FPeq(), which tiebreaks to the lowest
numbered quadrant.

When a box edge lies within EPSILON of the centroid, the corner on that
edge counts as being on the centroid's line, and (high.x, low.y) may be
the only corner in its quadrant.  That quadrant was then skipped.  Fix
the missing corner test.

Discussion: https://postgr.es/m/CANWCAZZZpkwrX0kC4Jo6KM27J6dyBdCDir-PbjEYAS06r%3D4-ag%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0496d85f9f086de109b06427ef72d22029312227

Modified Files
--------------
src/backend/access/spgist/spgquadtreeproc.c | 2 +-
src/test/regress/expected/spgist.out        | 9 +++++++++
src/test/regress/sql/spgist.sql             | 5 +++++
3 files changed, 15 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Check all four box corners in SP-GiST quad tree <@ search
@ 2026-10-30 05:36  John Naylor <john.naylor@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: John Naylor @ 2026-10-30 05:36 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check all four box corners in SP-GiST quad tree <@ search

When the centroid lies outside the query box, spg_quad_inner_consistent()
keeps only the quadrants that contain a corner of the box.  It meant to
test all four corners, but the last step set x back to low.x instead of
y to low.y, so it tested (low.x, high.y) twice and never (high.x, low.y).

With exact comparisons the missing corner would not matter: a box that
does not contain the centroid lies on one side of it on at least one
axis, so (high.x, low.y) shares a quadrant with another corner, but
getQuadrant() compares with FPeq(), which tiebreaks to the lowest
numbered quadrant.

When a box edge lies within EPSILON of the centroid, the corner on that
edge counts as being on the centroid's line, and (high.x, low.y) may be
the only corner in its quadrant.  That quadrant was then skipped.  Fix
the missing corner test.

Discussion: https://postgr.es/m/CANWCAZZZpkwrX0kC4Jo6KM27J6dyBdCDir-PbjEYAS06r%3D4-ag%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9e3077ff473e17852ad3690c45d8b86198f52986

Modified Files
--------------
src/backend/access/spgist/spgquadtreeproc.c | 2 +-
src/test/regress/expected/spgist.out        | 9 +++++++++
src/test/regress/sql/spgist.sql             | 5 +++++
3 files changed, 15 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Check all four box corners in SP-GiST quad tree <@ search
@ 2026-10-30 05:36  John Naylor <john.naylor@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: John Naylor @ 2026-10-30 05:36 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check all four box corners in SP-GiST quad tree <@ search

When the centroid lies outside the query box, spg_quad_inner_consistent()
keeps only the quadrants that contain a corner of the box.  It meant to
test all four corners, but the last step set x back to low.x instead of
y to low.y, so it tested (low.x, high.y) twice and never (high.x, low.y).

With exact comparisons the missing corner would not matter: a box that
does not contain the centroid lies on one side of it on at least one
axis, so (high.x, low.y) shares a quadrant with another corner, but
getQuadrant() compares with FPeq(), which tiebreaks to the lowest
numbered quadrant.

When a box edge lies within EPSILON of the centroid, the corner on that
edge counts as being on the centroid's line, and (high.x, low.y) may be
the only corner in its quadrant.  That quadrant was then skipped.  Fix
the missing corner test.

Discussion: https://postgr.es/m/CANWCAZZZpkwrX0kC4Jo6KM27J6dyBdCDir-PbjEYAS06r%3D4-ag%40mail.gmail.com
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/328a9a1731292e57a03ec4a5f495d0ed5fc85fba

Modified Files
--------------
src/backend/access/spgist/spgquadtreeproc.c | 2 +-
src/test/regress/expected/spgist.out        | 9 +++++++++
src/test/regress/sql/spgist.sql             | 5 +++++
3 files changed, 15 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Check all four box corners in SP-GiST quad tree <@ search
@ 2026-10-30 05:36  John Naylor <john.naylor@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: John Naylor @ 2026-10-30 05:36 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check all four box corners in SP-GiST quad tree <@ search

When the centroid lies outside the query box, spg_quad_inner_consistent()
keeps only the quadrants that contain a corner of the box.  It meant to
test all four corners, but the last step set x back to low.x instead of
y to low.y, so it tested (low.x, high.y) twice and never (high.x, low.y).

With exact comparisons the missing corner would not matter: a box that
does not contain the centroid lies on one side of it on at least one
axis, so (high.x, low.y) shares a quadrant with another corner, but
getQuadrant() compares with FPeq(), which tiebreaks to the lowest
numbered quadrant.

When a box edge lies within EPSILON of the centroid, the corner on that
edge counts as being on the centroid's line, and (high.x, low.y) may be
the only corner in its quadrant.  That quadrant was then skipped.  Fix
the missing corner test.

Discussion: https://postgr.es/m/CANWCAZZZpkwrX0kC4Jo6KM27J6dyBdCDir-PbjEYAS06r%3D4-ag%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b0d482b33ffd119c8d5619a10734a532ee910ea1

Modified Files
--------------
src/backend/access/spgist/spgquadtreeproc.c | 2 +-
src/test/regress/expected/spgist.out        | 9 +++++++++
src/test/regress/sql/spgist.sql             | 5 +++++
3 files changed, 15 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-10-30 05:36 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-10-30 05:36 pgsql: Check all four box corners in SP-GiST quad tree <@ search John Naylor <john.naylor@postgresql.org>
2026-10-30 05:36 pgsql: Check all four box corners in SP-GiST quad tree <@ search John Naylor <john.naylor@postgresql.org>
2026-10-30 05:36 pgsql: Check all four box corners in SP-GiST quad tree <@ search John Naylor <john.naylor@postgresql.org>
2026-10-30 05:36 pgsql: Check all four box corners in SP-GiST quad tree <@ search John Naylor <john.naylor@postgresql.org>
2026-10-30 05:36 pgsql: Check all four box corners in SP-GiST quad tree <@ search John Naylor <john.naylor@postgresql.org>
2026-10-30 05:36 pgsql: Check all four box corners in SP-GiST quad tree <@ search John Naylor <john.naylor@postgresql.org>
2026-10-30 05:36 pgsql: Check all four box corners in SP-GiST quad tree <@ search John Naylor <john.naylor@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox