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

sql: a string is considered to exist if it matches a primitive JSON string #35001

Closed
losinggeneration opened this issue Feb 15, 2019 · 1 comment
Assignees

Comments

@losinggeneration
Copy link

Describe the problem

Based on the documentation for Postgres JSON the following should be true:

SELECT '"foo"'::jsonb ? 'foo';

To Reproduce

Postgres:

psql (11.1 (Debian 11.1-2), server 11.0 (Debian 11.0-1.pgdg90+2))
postgres=# SELECT '"foo"'::jsonb ? 'foo';
 ?column? 
----------
 t
(1 row)

Cockroach:

psql (11.1 (Debian 11.1-2), server 9.5.0)
root=# SELECT '"foo"'::jsonb ? 'foo';
?column? 
----------
 f
(1 row)

Expected behavior
I would expect "foo" to equal the primitive value 'foo' considering the other examples on that page yielded the same results between the two implementations in other cases I tried.

Environment:

  • CockroachDB version [v2.1.4]
  • Server OS: [Debian buster/sid, Docker 18.09.1 build 4c52b90]
  • Client app [any]
@justinj
Copy link
Contributor

justinj commented Feb 15, 2019

Thanks for the report @losinggeneration! I've opened to #35005 fix this.

@justinj justinj changed the title A string is considered to exist if it matches a primitive JSON string sql: a string is considered to exist if it matches a primitive JSON string Feb 15, 2019
justinj pushed a commit to justinj/cockroach that referenced this issue Feb 19, 2019
Fixes cockroachdb#35001.

Release note (sql change): The semantics of the JSON '?' operator when
applied to JSON strings has been changed to match Postgres. Now, a JSON
string '?'s a string when the two are equal.
justinj pushed a commit to justinj/cockroach that referenced this issue Feb 23, 2019
Fixes cockroachdb#35001.

Release note (sql change): The semantics of the JSON '?' operator when
applied to JSON strings has been changed to match Postgres. Now, a JSON
string '?'s a string when the two are equal.
craig bot pushed a commit that referenced this issue Feb 23, 2019
35005: sql: fix semantics of JSON ? operator on strings r=justinj a=justinj

Fixes #35001.

Release note (sql change): The semantics of the JSON '?' operator when
applied to JSON strings has been changed to match Postgres. Now, a JSON
string '?'s a string when the two are equal.

Co-authored-by: Justin Jaffray <[email protected]>
@craig craig bot closed this as completed in #35005 Feb 23, 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

No branches or pull requests

2 participants