Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Select statement did not produce a ResultSet for native query #297

@mva-coinify

Description

@mva-coinify

Describe the bug

When upgrading from Metabase 48.7 to Metabase 52.11.2 and Clickhouse Driver 1.3.4 to 1.53.1, the following query that worked well stopped working:

select create_time as max_time, currency
from table FINAL
where 1=1 [[and create_time <= {{day}} + INTERVAL 30 SECOND]] 

When Metabase variable {{day}} which is of type 'Date' (this seems to be important) is not set, the query fails with "Select statement did not produce a ResultSet for native query". When I set it to some value, the query runs and returns result. I have some other usage of this concept in other cards where the variable is of type Text and it works well after the upgrade, so it seems like something has changed with date handling in the new version of clickhouse driver (or Metabase).

Steps to reproduce

  1. Run specified version of Metabase and Clickhouse Driver, with a clickhouse server 23.12.6.19
  2. Create a Question with the aforementioned query. Make sure to set the {{day}} variable to Date in Metabase.
  3. Run a query with and without the variable set.

Expected behaviour

Should return the result set from the underlying database query, disregarding whether {{day}} is set or not.

Error log

{:database_id 35,
 :started_at #t "2025-02-19T09:00:05.490143999Z[GMT]",
 :via
 [{:status :failed,
   :class clojure.lang.ExceptionInfo,
   :error "Error executing query: Select statement did not produce a ResultSet for native query",
   :stacktrace
   ["--> driver.sql_jdbc.execute$execute_reducible_query$fn__87872$fn__87873.invoke(execute.clj:716)"
    "driver.sql_jdbc.execute$execute_reducible_query$fn__87872.invoke(execute.clj:713)"
    "driver.clickhouse$fn__117139$fn__117141.invoke(clickhouse.clj:111)"
    "driver.sql_jdbc.execute$do_with_resolved_connection87648__87649.invokeStatic(execute.clj:338)"
    "driver.sql_jdbc.execute$do_with_resolved_connection87648__87649.invoke(execute.clj:321)"
    "driver.clickhouse$fn__117139.invokeStatic(clickhouse.clj:88)"
    "driver.clickhouse$fn__117139.invoke(clickhouse.clj:86)"
    "driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:707)"
    "driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:693)"
    "driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:704)"
    "driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:693)"
    "driver.sql_jdbc$fn__116108.invokeStatic(sql_jdbc.clj:79)"
    "driver.sql_jdbc$fn__116108.invoke(sql_jdbc.clj:77)"
    "query_processor.pipeline$_STAR_execute_STAR_.invokeStatic(pipeline.clj:52)"
    "query_processor.pipeline$_STAR_execute_STAR_.invoke(pipeline.clj:39)"
    "query_processor.pipeline$_STAR_run_STAR_.invokeStatic(pipeline.clj:102)"
    "query_processor.pipeline$_STAR_run_STAR_.invoke(pipeline.clj:95)"
    "query_processor.execute$run.invokeStatic(execute.clj:62)"
    "query_processor.execute$run.invoke(execute.clj:56)"
    "query_processor.middleware.update_used_cards$update_used_cards_BANG_76023__76024$fn__76025.invoke(update_used_cards.clj:60)"
    "query_processor.execute$add_native_form_to_result_metadata$fn__76040.invoke(execute.clj:25)"
    "query_processor.execute$add_preprocessed_query_to_result_metadata_for_userland_query$fn__76046.invoke(execute.clj:36)"
    "query_processor.middleware.cache$run_query_with_cache75972__75974.invokeStatic(cache.clj:216)"
    "query_processor.middleware.cache$run_query_with_cache75972__75974.invoke(cache.clj:189)"
    "query_processor.middleware.cache$maybe_return_cached_results$maybe_return_cached_results_STAR___75996.invoke(cache.clj:245)"
    "query_processor.middleware.permissions$check_query_permissions$fn__72666.invoke(permissions.clj:148)"
    "query_processor.middleware.enterprise$check_download_permissions_middleware$fn__73387.invoke(enterprise.clj:51)"
    "query_processor.middleware.enterprise$maybe_apply_column_level_perms_check_middleware$fn__73397.invoke(enterprise.clj:64)"
    "query_processor.execute$execute76073__76074$fn__76075.invoke(execute.clj:94)"
    "query_processor.setup$do_with_qp_setup73941__73942.invokeStatic(setup.clj:225)"
    "query_processor.setup$do_with_qp_setup73941__73942.invoke(setup.clj:216)"
    "query_processor.execute$execute76073__76074.invokeStatic(execute.clj:93)"
    "query_processor.execute$execute76073__76074.invoke(execute.clj:89)"
    "query_processor$process_query_STAR__STAR_.invokeStatic(query_processor.clj:49)"
    "query_processor$process_query_STAR__STAR_.invoke(query_processor.clj:44)"
    "query_processor.middleware.enterprise$fn__73414$handle_audit_app_internal_queries__73415$fn__73417.invoke(enterprise.clj:96)"
    "query_processor.middleware.enterprise$handle_audit_app_internal_queries_middleware$fn__73425.invoke(enterprise.clj:103)"
    "query_processor.middleware.process_userland_query$process_userland_query_middleware78710__78711$fn__78712.invoke(process_userland_query.clj:217)"
    "query_processor.middleware.catch_exceptions$catch_exceptions78775__78776$fn__78777.invoke(catch_exceptions.clj:132)"
    "query_processor$process_query78816__78817$fn__78818.invoke(query_processor.clj:8...	

Configuration

Environment

  • metabase-clickhouse-driver version: 1.53.1
  • metabase-clickhouse-driver configuration: default
  • Metabase version: 52.11.2
  • OS:

ClickHouse server

  • ClickHouse Server version: 23.12.6.19
  • ClickHouse Server non-default settings, if any:
  • CREATE TABLE statements for tables involved:
  • Sample data for all these tables, use clickhouse-obfuscator if necessary

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions