-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: SELECT DISTINCT jsoncol->foo is broken #24436
Copy link
Copy link
Closed
Labels
A-sql-encodingRelating to the SQL/KV encoding.Relating to the SQL/KV encoding.A-sql-executionRelating to SQL execution.Relating to SQL execution.A-sql-jsonJSON handling in SQL.JSON handling in SQL.C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.S-3-ux-surpriseIssue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.docs-donedocs-known-limitation
Milestone
Description
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)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-encodingRelating to the SQL/KV encoding.Relating to the SQL/KV encoding.A-sql-executionRelating to SQL execution.Relating to SQL execution.A-sql-jsonJSON handling in SQL.JSON handling in SQL.C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.S-3-ux-surpriseIssue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.docs-donedocs-known-limitation