Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-20.2: opt: fix normalization of st_distance when use_spheroid parameter used #55852

Merged
merged 1 commit into from
Nov 5, 2020

Conversation

rytaft
Copy link
Collaborator

@rytaft rytaft commented Oct 22, 2020

Backport 1/1 commits from #55739.

/cc @cockroachdb/release


This commit fixes the normalization rule that converts st_distance to
st_dwithin or st_dwithinexclusive, which was broken in the case when
the use_spheroid parameter was used. Prior to this commit, the rule was
assigning the use_spheroid parameter as the 3rd parameter to st_dwithin
or st_dwithinexclusive and the distance parameter as the 4th, but that
order does not match the function signatures. This commit fixes the issue
by assigning distance as the 3rd parameter and use_spheroid as the 4th
if it exists.

Fixes #55675

Release note (bug fix): Fixed an internal error that could occur during
query planning when the use_spheroid parameter was used in the ST_Distance
function as part of a filter predicate. For example, SELECT ... WHERE ST_Distance(geog1, geog2, false) < 10 previously caused an error. This
has now been fixed.

@rytaft rytaft requested a review from a team as a code owner October 22, 2020 12:03
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rytaft rytaft requested a review from a team October 22, 2020 12:04
@rytaft
Copy link
Collaborator Author

rytaft commented Oct 22, 2020

I'll wait to merge this until 20.2.1

This commit fixes the normalization rule that converts st_distance to
st_dwithin or st_dwithinexclusive, which was broken in the case when
the use_spheroid parameter was used. Prior to this commit, the rule was
assigning the use_spheroid parameter as the 3rd parameter to st_dwithin
or st_dwithinexclusive and the distance parameter as the 4th, but that
order does not match the function signatures. This commit fixes the issue
by assigning distance as the 3rd parameter and use_spheroid as the 4th
if it exists.

Fixes cockroachdb#55675

Release note (bug fix): Fixed an internal error that could occur during
query planning when the use_spheroid parameter was used in the ST_Distance
function as part of a filter predicate. For example, `SELECT ... WHERE
ST_Distance(geog1, geog2, false) < 10` previously caused an error. This
has now been fixed.
@otan
Copy link
Contributor

otan commented Nov 3, 2020

( i think we can merge this now :D )

@rytaft rytaft merged commit d488789 into cockroachdb:release-20.2 Nov 5, 2020
@rytaft rytaft deleted the backport20.2-55739 branch November 5, 2020 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants