Hasura - CockroachDB Compatibility
As CockroachDB supports PostgreSQL, the way it functions with Hasura is also very similar. However, there are a few incompatibilities to be aware of.
Incompatibilities and unsupported features
The most up-to-date list of unsupported Postgres features can be found on the CockroachDB website.
Currently, the following features are supported with CockroachDB and Hasura:
Queries are fully supported, but please note that GraphQL key ordering in JSON objects is not guaranteed.
This is because CockroachDB implements the
JSONB variant of the Postgres JSON types, which do not preserve key ordering.
treatment by either enabling the
HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES environment variable or
bespoke JSON parsing client-side.
Querying from all kinds of tables and views is currently supported. This includes local, reference, and distributed tables. All the tables can be tracked from the Hasura Console.
The following table describes the supported relationships based on the supported joins in CockroachDB:
|To Local||To Reference||To Distributed|
|From Local||Object, Array||Object, Array|
|From Reference||Object, Array||Object, Array|
|From Distributed||Object||Object, Array|
The Hasura Console allows you to add all the supported relationships.
All permissions work on CockroachDB like on Postgres without any restrictions.
CockroachDB, and therefore Hasura, does not yet support user-defined functions (UDFs) on a stable release. However, UDF support has recently been added to CockroachDB Beta (see issue), so watch this space!
Mutations are supported in GraphQL Engine with the exception of fetching relationship data as part of
is not yet supported.
Live Queries and Streaming Subscriptions are supported with CockroachDB.
CockroachDB does not yet support creating triggers (see issue) on reference tables. Hence, this is currently not supported.
Naming conventions are currently only implemented as an experimental feature on Postgres sources. See docs.