-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: cannot project json_object_keys() on a json column #26110
Copy link
Copy link
Closed
Labels
A-sql-jsonJSON handling in SQL.JSON handling in SQL.A-sql-optimizerSQL logical planning and optimizations.SQL logical planning and optimizations.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)X-duplicateClosed as a duplicate of another issue.Closed as a duplicate of another issue.
Description
json_object_keys works against a json string, but not against a json column (as it does in postgres).
CREATE TABLE jsontest (myjson JSONB);
INSERT INTO jsontest (myjson) VALUES ('{"first_name": "Lola", "last_name": "Dog", "location": "NYC", "online" : true, "friends" : 547}');
SELECT jsonb_object_keys(myjson) FROM jsontest;
Yields the error
pq: column name "myjson" not found
While the same steps in postgres yield
jsonb_object_keys
-------------------
online
friends
location
last_name
first_name
(5 rows)
Coackroach information:
I180524 17:40:10.133530 1 util/log/clog.go:1134 [config] file created at: 2018/05/24 17:40:10
I180524 17:40:10.133530 1 util/log/clog.go:1134 [config] running on machine: roach1
I180524 17:40:10.133530 1 util/log/clog.go:1134 [config] binary: CockroachDB CCL v2.0.2 (x86_64-unknown-linux-gnu, built 2018/05/21 14:55:20, go1.10)
I180524 17:40:10.133530 1 util/log/clog.go:1134 [config] arguments: [/cockroach/cockroach start --insecure]
I180524 17:40:10.734765 23 cli/start.go:595 [config] clusterID: 19338980-b351-4a2d-9ced-3531916c62fc
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-jsonJSON handling in SQL.JSON handling in SQL.A-sql-optimizerSQL logical planning and optimizations.SQL logical planning and optimizations.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)X-duplicateClosed as a duplicate of another issue.Closed as a duplicate of another issue.