Issue with Beekeeper Postgres client

Hello everyone,

I’m trying to use the application Beekeper Studio community edition , but when I connect to CrateDB I get a connection error.

I access the ‘Doc’ schema as a ‘crate’ superuser.
The default port is open.
CrateDB runs as a cluster using docker. There is a container every host and all vista are connected with docker ‘host’ network.

Error:

Could not create execution plan from logical plan because of: Couldn't find (SELECT 1 FROM (el)) in SourceSymbols{inputs={typelem=INPUT(4), typnamespace=INPUT(2), nspname=INPUT(5), oid=INPUT(1), typrelid=INPUT(3), typname=INPUT(0), oid=INPUT(6)}, nonDeterministicFunctions={}}:
Eval[nspname AS schema, typname AS typename, oid AS typeid]
  └ Filter[((typrelid = 0) OR (SELECT (relkind = 'c') FROM (c)))]
    └ CorrelatedJoin[typname, oid, typnamespace, typrelid, typelem, nspname, oid, (SELECT (relkind = 'c') FROM (c)), (SELECT 1 FROM (el))]
      └ CorrelatedJoin[typname, oid, typnamespace, typrelid, typelem, nspname, oid, (SELECT (relkind = 'c') FROM (c))]
        └ Filter[(NOT EXISTS (SELECT 1 FROM (el)))]
          └ HashJoin[(oid = typnamespace)]
            ├ Rename[typname, oid, typnamespace, typrelid, typelem] AS t
            │  └ Collect[pg_catalog.pg_type | [typname, oid, typnamespace, typrelid, typelem] | true]
            └ Rename[nspname, oid] AS n
              └ Collect[pg_catalog.pg_namespace | [nspname, oid] | (NOT (nspname = ANY(['pg_catalog', 'information_schema'])))]
        └ SubPlan
          └ Eval[(relkind = 'c')]
            └ Rename[(relkind = 'c')] AS c
              └ Limit[2::bigint;0::bigint]
                └ Collect[pg_catalog.pg_class | [(relkind = 'c')] | (oid = _cast(typrelid, 'regclass'))]
      └ SubPlan
        └ Eval[1]
          └ Rename[1] AS el
            └ Limit[1;0]
              └ Collect[pg_catalog.pg_type | [1] | ((oid = typelem) AND (typarray = oid))]
1 Like

This seems to be a bug in CrateDB with a combination of correlated subqueries and JOINs.

Beekeeper Studio is trying to run the following query:

SELECT      n.nspname as schema, t.typname as typename, t.oid::int4 as typeid
      FROM        pg_type t
      LEFT JOIN   pg_catalog.pg_namespace n ON n.oid = t.typnamespace
      WHERE       (t.typrelid = 0 OR (SELECT c.relkind = 'c' FROM pg_catalog.pg_class c WHERE c.oid = t.typrelid))
      AND     NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type el WHERE el.oid = t.typelem AND el.typarray = t.oid)
      AND     n.nspname NOT IN ('pg_catalog', 'information_schema');

I opened a bug issue in the crate/crate repo:


If you are looking for an IDE to work with CrateDB you might want to look into DBeaver.

Thanks for reporting this :blue_heart:

1 Like