cube icon indicating copy to clipboard operation
cube copied to clipboard

Cube does not handles a new metabase query?

Open A-Lasso opened this issue 1 month ago • 1 comments

Describe the bug Since the last big version change on Metabase cloud (v1.49.*) we started having an sql query that fails, we think that cube doesn't support the new query that seems to be for a postgresql database (since cube acts like that database type). In the past something like this happened but cube time fixed it, so I was hoping it was something like that again.

To Reproduce

Steps to reproduce the behavior:

  1. Connect a database from metabase to cube.
  2. Wait some time for the query to show.
  3. Go to 'Query History'
  4. Click on filter 'With Errors'=Yes
  5. See errors on 'Query History'

Screenshots image image

Version: [0.35.29],[0.35.26] and I don't remember with which cube version we started with this logs (I know this two still have it).

Additional context The query (at the end it seems it changes the 'ct.relname' to be the dynamic tables, I don't know what exactly this query does) :

SELECT
  tmp.TABLE_CAT,
  tmp.TABLE_SCHEM,
  tmp.TABLE_NAME,
  tmp.NON_UNIQUE,
  tmp.INDEX_QUALIFIER,
  tmp.INDEX_NAME,
  tmp.TYPE,
  tmp.ORDINAL_POSITION,
  trim(
    both '"'
    from
      pg_catalog.pg_get_indexdef(tmp.CI_OID, tmp.ORDINAL_POSITION, false)
  ) AS COLUMN_NAME,
  CASE
    tmp.AM_NAME
    WHEN 'btree' THEN CASE
      tmp.I_INDOPTION [tmp.ORDINAL_POSITION - 1] & 1 :: smallint
      WHEN 1 THEN 'D'
      ELSE 'A'
    END
    ELSE NULL
  END AS ASC_OR_DESC,
  tmp.CARDINALITY,
  tmp.PAGES,
  tmp.FILTER_CONDITION
FROM
  (
    SELECT
      NULL AS TABLE_CAT,
      n.nspname AS TABLE_SCHEM,
      ct.relname AS TABLE_NAME,
      NOT i.indisunique AS NON_UNIQUE,
      NULL AS INDEX_QUALIFIER,
      ci.relname AS INDEX_NAME,
      CASE
        i.indisclustered
        WHEN true THEN 1
        ELSE CASE
          am.amname
          WHEN 'hash' THEN 2
          ELSE 3
        END
      END AS TYPE,
      (information_schema._pg_expandarray(i.indkey)).n AS ORDINAL_POSITION,
      ci.reltuples AS CARDINALITY,
      ci.relpages AS PAGES,
      pg_catalog.pg_get_expr(i.indpred, i.indrelid) AS FILTER_CONDITION,
      ci.oid AS CI_OID,
      i.indoption AS I_INDOPTION,
      am.amname AS AM_NAME
    FROM
      pg_catalog.pg_class ct
      JOIN pg_catalog.pg_namespace n ON (ct.relnamespace = n.oid)
      JOIN pg_catalog.pg_index i ON (ct.oid = i.indrelid)
      JOIN pg_catalog.pg_class ci ON (ci.oid = i.indexrelid)
      JOIN pg_catalog.pg_am am ON (ci.relam = am.oid)
    WHERE
      true
      AND n.nspname = 'public'
      AND ct.relname = 'IT_Assistance_Needed'
  ) AS tmp
ORDER BY
  NON_UNIQUE,
  TYPE,
  INDEX_NAME,
  ORDINAL_POSITION

A-Lasso avatar May 09 '24 16:05 A-Lasso

@A-Lasso Thanks for reporting this!

igorlukanin avatar May 13 '24 11:05 igorlukanin