-
Notifications
You must be signed in to change notification settings - Fork 4.1k
UNION on json columns doesn't work #35260
Copy link
Copy link
Closed
Labels
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.docs-known-limitation
Description
Describe the problem
Came across this while trying to union two selects that contained a json column, and narrowed it down to the json column. The following example fails:
To Reproduce
> CREATE TABLE t1 (j JSON);
> CREATE TABLE t2 (j JSON);
> INSERT INTO t1 VALUES ('{"a": "b"}');
> INSERT INTO t2 VALUES ('{"c": "d"}');
> (SELECT j FROM t1) UNION (SELECT j FROM t2);
Output is pq: unable to encode table key: *tree.DJSON
Expected behavior
If this is related to #24436 (not key-encoding JSON values) then a clearer error message. Otherwise I would expect:
j
+------------+
{"a": "b"}
{"c": "d"}
(2 rows)
Environment:
- CockroachDB version: 2.1.4
- Server OS: MacOS High Sierra
- Client app:
cockroach sql
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
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.docs-known-limitation