From 2dc733c4d6b0a76c3444b3eace1bbd0d42f9a0d9 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Sun, 20 Nov 2016 17:17:15 +0100 Subject: [PATCH] Fix corner case in creating indexes again. When the option "drop indexes" is in use in loading data from a file, we collect the indexes from the PostgreSQL catalogs and then issue DROP commands against them before the load, then CREATE commands when it's done. The CREATE is done in parallel, and we create an lparallel kernel for that. The kernel must have a worker-count of at least 1, and we where not considering the case of 0 indexes on the target table. Fix #484. --- src/pgsql/pgsql-create-schema.lisp | 3 ++- test/csv-filename-pattern.load | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pgsql/pgsql-create-schema.lisp b/src/pgsql/pgsql-create-schema.lisp index c7879bc..9b20cba 100644 --- a/src/pgsql/pgsql-create-schema.lisp +++ b/src/pgsql/pgsql-create-schema.lisp @@ -295,7 +295,8 @@ (section :post) drop-indexes) "Create the indexes that we dropped previously." - (when drop-indexes + (when (and drop-indexes + (< 0 (count-indexes catalog))) (let* ((*preserve-index-names* t) ;; we get the list of indexes from PostgreSQL catalogs, so don't ;; question their spelling, just quote them. diff --git a/test/csv-filename-pattern.load b/test/csv-filename-pattern.load index 65da029..1a15640 100644 --- a/test/csv-filename-pattern.load +++ b/test/csv-filename-pattern.load @@ -7,8 +7,10 @@ load csv with fields optionally enclosed by '"', fields terminated by ',', truncate, - workers = 8, - concurrency = 1 + disable triggers, + drop indexes + -- workers = 8, + -- concurrency = 1 before load do $$ drop table if exists matching; $$,