0

We are using CockroachDB. We are trying to "import" a .sql dump file using command

cockroach sql --database=database name < file-name.sql --insecure

After pressing the enter the tables without Jsonb are created in the database and throwing an error saying:

pq: cluster version does not support JSONB (>= 2.0 required
Error: pq: cluster version does not support JSONB (>= 2.0 required)
Failed running "sql"

Our cluster version is same as the version of cockroachdb v2.0.5(Latest). We already tried to upgrade and things like that but no luck.

Our cluster build version:

build:CCL v2.0.5 @ 2018/08/13 17:59:42 (go1.10)

Bharath Kuppala
  • 176
  • 1
  • 3
  • 14

1 Answers1

0

CockroachDB distinguishes between build version (v2.0.5 in your instance) and cluster version. The cluster version can lag the build version in order to allow downgrades. (Once the cluster version has been bumped you can no longer downgrade). In the unreleased v2.1 series, we've added functionality to automatically bump the cluster version after all nodes in the cluster have been upgraded. But in v2.0.x you have to do this manually. To check the cluster version:

root@:26257/> SHOW CLUSTER SETTING version;
+---------+
| version |
+---------+
|     1.1 |
+---------+

Here I'm running v1.1.7. If I upgrade the binary to v2.0.5, the cluster version is unchanged:

root@:26257/> SHOW CLUSTER SETTING version;
+---------+
| version |
+---------+
| 1.1     |
+---------+

In order to upgrade the cluster version we need to finalize the upgrade:

root@:26257/> SET CLUSTER SETTING version = crdb_internal.node_executable_version();
SET CLUSTER SETTING

root@:26257/> SHOW CLUSTER SETTING version;
+---------+
| version |
+---------+
| 2.0     |
+---------+

See all this tutorial on upgrading a cluster. If you've performed all of these steps and SHOW CLUSTER SETTING version is indicating 2.0 and your JSONB column is still not work, then we'll need to dig deeper into what is going on.

Peter Mattis
  • 607
  • 3
  • 7