sql: remove ~ in favor of bitwise_not()#14908
Merged
madelynnblue merged 1 commit intocockroachdb:masterfrom Apr 14, 2017
madelynnblue:tilde-func
Merged
sql: remove ~ in favor of bitwise_not()#14908madelynnblue merged 1 commit intocockroachdb:masterfrom madelynnblue:tilde-func
madelynnblue merged 1 commit intocockroachdb:masterfrom
madelynnblue:tilde-func
Conversation
Member
Contributor
Author
|
After doing all the work to make this, I now dislike it a lot because of all the stuff it removed. I'm unsure how to proceed. |
Member
|
All of this removal seems like a positive thing to me, but if it makes you anxious, I suppose you could just change the old implementation to raise an "unimplemented" error on evaluation. |
Contributor
|
I concur with Jordan, this makes the code more simple. Reviewed 12 of 12 files at r1. Comments from Reviewable |
~ is troublesome because of its precedence. In Postgres, it has an (unexpected) fairly low precedence (see #14877). However in Spanner it has the expected high precedence of a unary operator (https://cloud.google.com/spanner/docs/functions-and-operators#operators). This is problematic because we want to support Postgres SQL correctly, but also have things make sense. In this case we feel that the Postgres operator precedence is incorrect. But in order to not return silently incorrect results that depend on this behavior, we are replacing the operator with an equivalent function. This will cause applications to explicitly error so users can fix them correctly. See discussion in #14814
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
~ is troublesome because of its precedence. In Postgres, it has
an (unexpected) fairly low precedence (see #14877). However in
Spanner it has the expected high precedence of a unary operator
(https://cloud.google.com/spanner/docs/functions-and-operators#operators).
This is problematic because we want to support Postgres SQL correctly,
but also have things make sense. In this case we feel that the Postgres
operator precedence is incorrect. But in order to not return silently
incorrect results that depend on this behavior, we are replacing the
operator with an equivalent function. This will cause applications
to explicitly error so users can fix them correctly.
See discussion in #14814