From ed4f3b740608d18fb8d81758bffb0d6edbdf5ab4 Mon Sep 17 00:00:00 2001 From: Gil Mizrahi Date: Mon, 3 Apr 2023 14:49:46 +0300 Subject: [PATCH] feature(server): CockroachDB now supports distinct. Document and test PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8596 GitOrigin-RevId: 3dbc5fccb1d4387041a5a80794158c4f50b70848 --- .../cockroachdb/hasura-cockroachdb-compatibility.mdx | 5 ++--- server/lib/api-tests/src/Test/Queries/DistinctSpec.hs | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/docs/databases/postgres/cockroachdb/hasura-cockroachdb-compatibility.mdx b/docs/docs/databases/postgres/cockroachdb/hasura-cockroachdb-compatibility.mdx index a1d54942cfe..7ba5577c066 100644 --- a/docs/docs/databases/postgres/cockroachdb/hasura-cockroachdb-compatibility.mdx +++ b/docs/docs/databases/postgres/cockroachdb/hasura-cockroachdb-compatibility.mdx @@ -29,9 +29,8 @@ Currently, the following features are supported with CockroachDB and Hasura: ## Queries -Queries are fully supported except for queries containing `distinct_on` arguments, [see issue](https://github.com/cockroachdb/cockroach/issues/90763), 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. +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. Please also note that SERIAL columns will produce numbers that overflow JavaScript numbers. These will need special treatment by either enabling the diff --git a/server/lib/api-tests/src/Test/Queries/DistinctSpec.hs b/server/lib/api-tests/src/Test/Queries/DistinctSpec.hs index 246faa770f9..da9acbae588 100644 --- a/server/lib/api-tests/src/Test/Queries/DistinctSpec.hs +++ b/server/lib/api-tests/src/Test/Queries/DistinctSpec.hs @@ -10,6 +10,7 @@ import Data.Aeson (Value) import Data.List.NonEmpty qualified as NE import Harness.Backend.BigQuery qualified as BigQuery import Harness.Backend.Citus qualified as Citus +import Harness.Backend.Cockroach qualified as Cockroach import Harness.Backend.Postgres qualified as Postgres import Harness.GraphqlEngine (postGraphql) import Harness.Quoter.Graphql (graphql) @@ -36,6 +37,11 @@ spec = do [ Citus.setupTablesAction schema testEnv ] }, + (Fixture.fixture $ Fixture.Backend Cockroach.backendTypeMetadata) + { Fixture.setupTeardown = \(testEnv, _) -> + [ Cockroach.setupTablesAction schema testEnv + ] + }, (Fixture.fixture $ Fixture.Backend BigQuery.backendTypeMetadata) { Fixture.setupTeardown = \(testEnv, _) -> [ BigQuery.setupTablesAction schema testEnv