Deleted schema still appearing

We have deleted a schema in our database but it still appears in the Metabase application even though we cannot access any tables from that schema when we click on it in Metabase.
I know it was an old issue that was solved in Metabase 0.35.0 and I don't know why it is occurring.
I'm using Metabase v.046.1 with Postgres.
Below is an excerpt from the log containing the problem when trying to access this schema.

fe253500-807c-4bb5-9620-52471b136cd7] 2023-06-16T23:35:54-03:00 DEBUG metabase.server.middleware.log GET /api/table/513/query_metadata 200 13.0 ms (8 chamadas ao banco de dados) Conexões de banco de dados do aplicativo: 0 / 15 Threads do Jetty: 5 / 50 (2 ocioso, 0 na fila) (104 total de threads ativas) Consultas ativas: 0 (0 na fila)
[fe253500-807c-4bb5-9620-52471b136cd7] 2023-06-16T23:35:55-03:00 ERROR metabase.query-processor.middleware.catch-exceptions Erro ao processar a consulta: ERROR: relation "siasg_23.d_cmpr_compra" does not exist
Position: 149
{:database_id 2,
:started_at #t "2023-06-16T23:35:54.716851-03:00[America/Sao_Paulo]",
:via
[{:status :failed,
:class clojure.lang.ExceptionInfo,
:error "Erro ao executar consulta: ERROR: relation "siasg_23.d_cmpr_compra" does not exist\n Position: 149",
:stacktrace
["--> driver.sql_jdbc.execute$execute_reducible_query$fn__71786.invoke(execute.clj:505)"
"driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:502)"
"driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:489)"
"driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:497)"
"driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:489)"
"driver.sql_jdbc$fn__105090.invokeStatic(sql_jdbc.clj:63)"
"driver.sql_jdbc$fn__105090.invoke(sql_jdbc.clj:61)"
"query_processor.context$executef.invokeStatic(context.clj:60)"
"query_processor.context$executef.invoke(context.clj:49)"
"query_processor.context.default$default_runf.invokeStatic(default.clj:68)"
"query_processor.context.default$default_runf.invoke(default.clj:66)"
"query_processor.context$runf.invokeStatic(context.clj:46)"
"query_processor.context$runf.invoke(context.clj:40)"
"query_processor.reducible$identity_qp.invokeStatic(reducible.clj:15)"
"query_processor.reducible$identity_qp.invoke(reducible.clj:12)"
"query_processor.middleware.cache$maybe_return_cached_results$maybe_return_cached_results_STAR___69171.invoke(cache.clj:224)"
"query_processor.middleware.permissions$check_query_permissions$fn__64643.invoke(permissions.clj:126)"
"query_processor.middleware.mbql_to_native$mbql__GT_native$fn__68062.invoke(mbql_to_native.clj:24)"
"query_processor$fn__70690$combined_post_process__70695$combined_post_process_STAR___70696.invoke(query_processor.clj:243)"
"query_processor$fn__70690$combined_pre_process__70691$combined_pre_process_STAR___70692.invoke(query_processor.clj:240)"
"query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__69082$fn__69087.invoke(resolve_database_and_driver.clj:36)"
"driver$do_with_driver.invokeStatic(driver.clj:90)"
"driver$do_with_driver.invoke(driver.clj:86)"
"query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__69082.invoke(resolve_database_and_driver.clj:35)"
"query_processor.middleware.fetch_source_query$resolve_card_id_source_tables$fn__64952.invoke(fetch_source_query.clj:310)"
"query_processor.middleware.store$initialize_store$fn__65130$fn__65131.invoke(store.clj:12)"
"query_processor.store$do_with_store.invokeStatic(store.clj:47)"
"query_processor.store$do_with_store.invoke(store.clj:41)"
"query_processor.middleware.store$initialize_store$fn__65130.invoke(store.clj:11)"
"query_processor.middleware.normalize_query$normalize$fn__69371.invoke(normalize_query.clj:25)"
"query_processor.middleware.constraints$add_default_userland_constraints$fn__66308.invoke(constraints.clj:54)"
"query_processor.middleware.process_userland_query$process_userland_query$fn__69307.invoke(process_userland_query.clj:150)"
"query_processor.middleware.catch_exceptions$catch_exceptions$fn__69684.invoke(catch_exceptions.clj:171)"
"query_processor.reducible$async_qp$qp_STAR___59455$thunk__59457.invoke(reducible.clj:103)"
"query_processor.reducible$async_qp$qp_STAR___59455.invoke(reducible.clj:109)"
"query_processor.reducible$async_qp$qp_STAR___59455.invoke(reducible.clj:94)"
"query_processor.reducible$sync_qp$qp_STAR___59467.doInvoke(reducible.clj:129)"
"query_processor$process_userland_query.invokeStatic(query_processor.clj:362)"
"query_processor$process_userland_query.doInvoke(query_processor.clj:358)"
"query_processor$fn__70738$process_query_and_save_execution_BANG___70747$fn__70750.invoke(query_processor.clj:373)"
"query_processor$fn__70738$process_query_and_save_execution_BANG___70747.invoke(query_processor.clj:366)"
"query_processor$fn__70783$process_query_and_save_with_max_results_constraints_BANG___70792$fn__70795.invoke(query_processor.clj:385)"
"query_processor$fn__70783$process_query_and_save_with_max_results_constraints_BANG___70792.invoke(query_processor.clj:378)"
"api.dataset$run_query_async$fn__86539.invoke(dataset.clj:73)"
"query_processor.streaming$streaming_response_STAR_$fn__54305$fn__54306.invoke(streaming.clj:166)"
"query_processor.streaming$streaming_response_STAR_$fn__54305.invoke(streaming.clj:165)"
"async.streaming_response$do_f_STAR_.invokeStatic(streaming_response.clj:69)"
"async.streaming_response$do_f_STAR_.invoke(streaming_response.clj:67)"
"async.streaming_response$do_f_async$task__36922.invoke(streaming_response.clj:88)"],
:error_type :invalid-query,
:ex-data
{:driver :postgres,
:sql
["-- Metabase:: userID: 7 queryType: MBQL queryHash: 59d72faf563de4bd8b2b144be11f4b5255ff127cac89c574a1c820204a3030c9"
"SELECT"
" COUNT() AS "count""
"FROM"
" "siasg_23"."d_cmpr_compra""],
:params nil,
:type :invalid-query}}],
:state "42P01",
:error_type :invalid-query,
:json_query
{:type "query",
:database 2,
:query {:source-table 513, :aggregation [["count"]]},
:parameters [],
:middleware {:js-int-to-string? true, :add-default-userland-constraints? true}},
:native {:query "SELECT COUNT(
) AS "count" FROM "siasg_23"."d_cmpr_compra"", :params nil},
:status :failed,
:class org.postgresql.util.PSQLException,
:stacktrace
["org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676)"
"org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366)"
"org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356)"
"org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:496)"
"org.postgresql.jdbc.PgStatement.execute(PgStatement.java:413)"
"org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:333)"
"org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:319)"
"org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:295)"
"org.postgresql.jdbc.PgStatement.execute(PgStatement.java:290)"
"com.mchange.v2.c3p0.impl.NewProxyStatement.execute(NewProxyStatement.java:75)"
"--> driver.sql_jdbc.execute$fn__71711.invokeStatic(execute.clj:384)"
"driver.sql_jdbc.execute$fn__71711.invoke(execute.clj:382)"
"driver.sql_jdbc.execute$execute_statement_or_prepared_statement_BANG_.invokeStatic(execute.clj:392)"
"driver.sql_jdbc.execute$execute_statement_or_prepared_statement_BANG_.invoke(execute.clj:389)"
"driver.sql_jdbc.execute$execute_reducible_query$fn__71786.invoke(execute.clj:503)"
"driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:502)"
"driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:489)"
"driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:497)"
"driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:489)"
"driver.sql_jdbc$fn__105090.invokeStatic(sql_jdbc.clj:63)"
"driver.sql_jdbc$fn__105090.invoke(sql_jdbc.clj:61)"
"query_processor.context$executef.invokeStatic(context.clj:60)"
"query_processor.context$executef.invoke(context.clj:49)"
"query_processor.context.default$default_runf.invokeStatic(default.clj:68)"
"query_processor.context.default$default_runf.invoke(default.clj:66)"
"query_processor.context$runf.invokeStatic(context.clj:46)"
"query_processor.context$runf.invoke(context.clj:40)"
"query_processor.reducible$identity_qp.invokeStatic(reducible.clj:15)"
"query_processor.reducible$identity_qp.invoke(reducible.clj:12)"
"query_processor.middleware.cache$maybe_return_cached_results$maybe_return_cached_results_STAR___69171.invoke(cache.clj:224)"
"query_processor.middleware.permissions$check_query_permissions$fn__64643.invoke(permissions.clj:126)"
"query_processor.middleware.mbql_to_native$mbql__GT_native$fn__68062.invoke(mbql_to_native.clj:24)"
"query_processor$fn__70690$combined_post_process__70695$combined_post_process_STAR___70696.invoke(query_processor.clj:243)"
"query_processor$fn__70690$combined_pre_process__70691$combined_pre_process_STAR___70692.invoke(query_processor.clj:240)"
"query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__69082$fn__69087.invoke(resolve_database_and_driver.clj:36)"
"driver$do_with_driver.invokeStatic(driver.clj:90)"
"driver$do_with_driver.invoke(driver.clj:86)"
"query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__69082.invoke(resolve_database_and_driver.clj:35)"
"query_processor.middleware.fetch_source_query$resolve_card_id_source_tables$fn__64952.invoke(fetch_source_query.clj:310)"
"query_processor.middleware.store$initialize_store$fn__65130$fn__65131.invoke(store.clj:12)"
"query_processor.store$do_with_store.invokeStatic(store.clj:47)"
"query_processor.store$do_with_store.invoke(store.clj:41)"
"query_processor.middleware.store$initialize_store$fn__65130.invoke(store.clj:11)"
"query_processor.middleware.normalize_query$normalize$fn__69371.invoke(normalize_query.clj:25)"
"query_processor.middleware.constraints$add_default_userland_constraints$fn__66308.invoke(constraints.clj:54)"
"query_processor.middleware.process_userland_query$process_userland_query$fn__69307.invoke(process_userland_query.clj:150)"
"query_processor.middleware.catch_exceptions$catch_exceptions$fn__69684.invoke(catch_exceptions.clj:171)"
"query_processor.reducible$async_qp$qp_STAR___59455$thunk__59457.invoke(reducible.clj:103)"
"query_processor.reducible$async_qp$qp_STAR___59455.invoke(reducible.clj:109)"
"query_processor.reducible$async_qp$qp_STAR___59455.invoke(reducible.clj:94)"
"query_processor.reducible$sync_qp$qp_STAR___59467.doInvoke(reducible.clj:129)"
"query_processor$process_userland_query.invokeStatic(query_processor.clj:362)"
"query_processor$process_userland_query.doInvoke(query_processor.clj:358)"
"query_processor$fn__70738$process_query_and_save_execution_BANG___70747$fn__70750.invoke(query_processor.clj:373)"
"query_processor$fn__70738$process_query_and_save_execution_BANG___70747.invoke(query_processor.clj:366)"
"query_processor$fn__70783$process_query_and_save_with_max_results_constraints_BANG___70792$fn__70795.invoke(query_processor.clj:385)"
"query_processor$fn__70783$process_query_and_save_with_max_results_constraints_BANG___70792.invoke(query_processor.clj:378)"
"api.dataset$run_query_async$fn__86539.invoke(dataset.clj:73)"
"query_processor.streaming$streaming_response_STAR_$fn__54305$fn__54306.invoke(streaming.clj:166)"
"query_processor.streaming$streaming_response_STAR_$fn__54305.invoke(streaming.clj:165)"
"async.streaming_response$do_f_STAR_.invokeStatic(streaming_response.clj:69)"
"async.streaming_response$do_f_STAR_.invoke(streaming_response.clj:67)"
"async.streaming_response$do_f_async$task__36922.invoke(streaming_response.clj:88)"],
:card_id nil,
:context :ad-hoc,
:error "ERROR: relation "siasg_23.d_cmpr_compra" does not exist\n Position: 149",
:row_count 0,
:running_time 0,
:preprocessed
{:type :query,
:database 2,
:query {:source-table 513, :aggregation [[:aggregation-options [:count] {:name "count"}]]},
:middleware {:js-int-to-string? true, :add-default-userland-constraints? true},
:info {:executed-by 7, :context :ad-hoc}},
:data {:rows [], :cols []}}

Either force a scan and or delete the data from the app db

1 Like

Thanks @Luiggi! I forced the scan and it worked!