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: SELECT DISTINCT jsoncol->foo is broken #24436

Closed
benesch opened this issue Apr 2, 2018 · 7 comments
Closed

sql: SELECT DISTINCT jsoncol->foo is broken #24436

benesch opened this issue Apr 2, 2018 · 7 comments
Labels
A-sql-encoding Relating to the SQL/KV encoding. A-sql-execution Relating to SQL execution. A-sql-json JSON handling in SQL. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. docs-done docs-known-limitation S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.
Milestone

Comments

@benesch
Copy link
Contributor

benesch commented Apr 2, 2018

Realistic reproduction:

> create table t (ext json);
> insert into t values ('{"foo": "bar"}');
> select distinct ext->'foo' from t;
pq: unable to encode table key: *tree.DJSON

Minimal reproduction:

> select distinct '{}'::json;
pq: unable to encode table key: *tree.DJSON

@justinj suggests that this is because we can't currently key-encode JSON values. As a workaround:

> select distinct ext->>'foo' from t;
+-------------+
| ext->>'foo' |
+-------------+
| bar         |
+-------------+
(2 rows)
@benesch
Copy link
Contributor Author

benesch commented Apr 2, 2018

/cc @nstewart

@jordanlewis jordanlewis added this to the 2.1 milestone Apr 11, 2018
@jordanlewis jordanlewis added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Apr 11, 2018
@knz knz added the A-sql-json JSON handling in SQL. label Apr 27, 2018
@knz knz added the A-sql-encoding Relating to the SQL/KV encoding. label May 5, 2018
@knz knz added the A-sql-execution Relating to SQL execution. label May 5, 2018
@nstewart nstewart added the S-3-productivity Severe issues that impede the productivity of CockroachDB developers. label Sep 18, 2018
@awoods187
Copy link
Contributor

Do we have a plan to address this in 2.1 bug fixing period @jordanlewis ?

@jordanlewis
Copy link
Member

Unfortunately this isn't fixable in 2.1 - it's too much work. We could potentially put a better error message for it, but I'm not sure it's worth the effort.

@knz knz modified the milestones: 2.1, 2.2 Oct 5, 2018
@knz knz added S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption. and removed S-3-productivity Severe issues that impede the productivity of CockroachDB developers. labels Oct 5, 2018
@sploiselle
Copy link
Contributor

@justinj Can I get a quick blurb describing this known limitation w/r/t the impact to user experience? Ideally, we need it by Friday 10/26 for the 2.1 Known Limitations page. Posting it on this issue and/or pinging me would be great.

@RaduBerinde
Copy link
Member

Similar case that hits the same error: SELECT DISTINCT json_array_elements('[10, 200, 200, 300, 400]');

@knz
Copy link
Contributor

knz commented Mar 18, 2019

I have added telemetry links inside CockroachDB to the underlying/overarching issue #35706.

@jordanlewis
Copy link
Member

Closing as duplicate of #35706.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-encoding Relating to the SQL/KV encoding. A-sql-execution Relating to SQL execution. A-sql-json JSON handling in SQL. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. docs-done docs-known-limitation S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.
Projects
None yet
Development

No branches or pull requests

9 participants