Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cube does not handles a new metabase query? #8251

Open
A-Lasso opened this issue May 9, 2024 · 1 comment
Open

Cube does not handles a new metabase query? #8251

A-Lasso opened this issue May 9, 2024 · 1 comment
Assignees
Labels
api:sql Issues related to SQL API bug Something isn't working

Comments

@A-Lasso
Copy link

A-Lasso commented May 9, 2024

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
@igorlukanin igorlukanin added bug Something isn't working api:sql Issues related to SQL API labels May 13, 2024
@igorlukanin
Copy link
Member

@A-Lasso Thanks for reporting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:sql Issues related to SQL API bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants