Cockroach: sql: unsupported binary operator: <jsonb> #>> <string>

Created on 17 Oct 2019  路  3Comments  路  Source: cockroachdb/cockroach

CREATE TABLE users (
    uuid UUID NOT NULL,
    username VARCHAR(255) NULL,
    settings JSONB NULL,
    CONSTRAINT "primary" PRIMARY KEY (uuid ASC),
    UNIQUE INDEX users_uuid_key (uuid ASC),
    FAMILY "primary" (uuid, username, settings)
);
INSERT INTO users (uuid,username,settings) VALUES 
('6bb54756-3761-4104-ae9e-90058029e513','test','{"contacts": {"tg": "test"}}');
SELECT * FROM users AS u WHERE u.settings #>> '{contacts,tg}' = 'test'
SQL Error [22023]: ERROR: unsupported binary operator: <jsonb> #>> <string>

Environment:

  • CockroachDB version: 19.1.5
  • Server OS: Debian
  • Client app DBeaver 6.2.2

Most helpful comment

@intech we supported #>> string[] in 19.1. Unfortunately, we did not support implicitly converting string -> string[]. We now support this in 19.2 due to https://github.com/cockroachdb/cockroach/issues/23299. Let me know if that makes sense.

All 3 comments

This now works in 19.2:
```[email protected]:53822/movr> SELECT * FROM users1 AS u WHERE u.settings #>> '{contacts,tg}' = 'test';
uuid | username | settings
+--------------------------------------+----------+------------------------------+
6bb54756-3761-4104-ae9e-90058029e513 | test | {"contacts": {"tg": "test"}}
(1 row)

Time: 10.982ms
```
We have a beta publicly available and expect to release 19.2 in the near future. Let us know if you have additional questions.

@awoods187 In docs is wrong information for version 19.1.5:
https://www.cockroachlabs.com/docs/stable/functions-and-operators.html#supported-operations

@intech we supported #>> string[] in 19.1. Unfortunately, we did not support implicitly converting string -> string[]. We now support this in 19.2 due to https://github.com/cockroachdb/cockroach/issues/23299. Let me know if that makes sense.

Was this page helpful?
0 / 5 - 0 ratings