aquametalabs/aquameta

bundle: can't import two bundles from csv in the same transaction

erichanson opened this issue · 0 comments

bundle.bundle_import_csv() fails when you try to import two bundles in the same transaction with:

aquameta=# begin;
BEGIN
aquameta=# select bundle.bundle_import_csv('/home/eric/dev/aquameta/bundles.private/com.getskeleton.library');
          bundle_import_csv           
--------------------------------------
 a5b6a97f-07af-4827-96d6-2ee7fa8ff8c7
(1 row)

aquameta=# select bundle.bundle_import_csv('/home/eric/dev/aquameta/bundles.private/org.aquameta.pwa');
ERROR:  relation "origin_temp" already exists
CONTEXT:  SQL statement "create temporary table origin_temp(id uuid, name text, head_commit_id uuid, checkout_commit_id uuid) on commit drop"
PL/pgSQL function bundle.bundle_import_csv(text) line 22 at EXECUTE

Looks like origin_temp gets cleaned up on commit if you're in a transaction. Audit and fix.