Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Create appdb tables in its own connection (#65171)

Nathan Voxlandd0f5d01eeab5
diff --git a/src/metabase/search/appdb/index.clj b/src/metabase/search/appdb/index.clj
index d32e093f6ea..5e659bab09f 100644
--- a/src/metabase/search/appdb/index.clj
+++ b/src/metabase/search/appdb/index.clj
@@ -185,7 +185,9 @@
(defn create-table!
"Create an index table with the given name. Should fail if it already exists."
[table-name]
- (t2/with-transaction [_]
+ ;; Create with a separate transaction so that postgresql will complete the index creations before returning,
+ ;; even when already running in a transaction
+ (t2/with-transaction [_ (mdb/app-db)]
(-> (sql.helpers/create-table table-name)
(sql.helpers/with-columns (specialization/table-schema base-schema))
t2/query)