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

backport-2.1: opt,sql: fix correctness with JSON normalization #32214

Merged
merged 1 commit into from
Feb 11, 2019

Conversation

justinj
Copy link
Contributor

@justinj justinj commented Nov 12, 2018

Prior to this commit, we would normalize expressions of the form
a->'b' = c to a @> {"b": c} unconditionally. This was valid in many
important cases because containment is equivalent to equality for scalar
values. However, it is not valid if c is a non-scalar, as this
example illustrates:

'{"a": [1, 2, 3]}'->'a' = [1] => false
=>
'{"a": [1, 2, 3]}' @> {"a": [1]} => true

Since this bug was present in 2.0 I think it's not urgent to get it into
2.1.0, but I will target backporting it to 2.1.1.

Release note (bug fix): Fixed a bug that would incorrectly cause JSON
field access equality comparisons to be true when they should be false.

@justinj justinj requested a review from a team as a code owner November 12, 2018 14:12
@justinj justinj requested a review from a team November 12, 2018 14:12
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@justinj
Copy link
Contributor Author

justinj commented Nov 15, 2018

Adding @andy-kimball as a reviewer since Radu is on vacation

Copy link
Contributor

@andy-kimball andy-kimball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@justinj justinj force-pushed the backport2.1-31751 branch 2 times, most recently from 44f3633 to 48e6517 Compare November 16, 2018 16:17
@RaduBerinde
Copy link
Member

Looks like this has been ready to go for a long time, do you plan to merge it?

Prior to this commit, we would normalize expressions of the form
`a->'b' = c` to `a @> {"b": c}` unconditionally. This was valid in many
important cases because containment is equivalent to equality for scalar
values. However, it is *not* valid if `c` is a non-scalar, as this
example illustrates:

`'{"a": [1, 2, 3]}'->'a' = [1]` => `false`
=>
`'{"a": [1, 2, 3]}' @> {"a": [1]}` => `true`

Since this bug was present in 2.0 I think it's not urgent to get it into
2.1.0, but I will target backporting it to 2.1.1.

Release note (bug fix): Fixed a bug that would incorrectly cause JSON
field access equality comparisons to be true when they should be false.
@RaduBerinde RaduBerinde merged commit 1634c6b into cockroachdb:release-2.1 Feb 11, 2019
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