Refrain from TRUNCAT'ing an empty list of tables.

Fixed #789.
This commit is contained in:
Dimitri Fontaine 2018-06-15 17:46:31 +02:00
parent 8c2cda75e5
commit a0bac47101
3 changed files with 33 additions and 4 deletions

View File

@ -167,10 +167,14 @@
(schema (table-list catalog-or-table))
(table (list catalog-or-table)))))
(sql
(format nil "TRUNCATE ~{~a~^,~};" target-list)))
(pgsql-execute sql)
;; return how many tables we just TRUNCATEd
(length target-list)))
(when target-list
(format nil "TRUNCATE ~{~a~^,~};" target-list))))
(if target-list
(progn
(pgsql-execute sql)
;; return how many tables we just TRUNCATEd
(length target-list))
0)))
(defun disable-triggers (table-name)
"Disable triggers on TABLE-NAME. Needs to be called with a PostgreSQL

17
test/mysql/db789.load Normal file
View File

@ -0,0 +1,17 @@
LOAD DATABASE
FROM mysql://root@localhost/db789
INTO postgres:///pgloader
WITH data only, truncate, create no tables
MATERIALIZE VIEWS proceed
INCLUDING ONLY TABLE NAMES MATCHING 'proceed'
BEFORE LOAD DO
$$ drop schema if exists matview cascade; $$,
$$ drop schema if exists db789 cascade; $$,
$$ create schema db789; $$,
$$ create table db789.refrain (id char(1) primary key); $$,
$$ create table db789.proceed (id char(1) primary key); $$;

8
test/mysql/db789.sql vendored Normal file
View File

@ -0,0 +1,8 @@
drop database if exists db789;
create database db789;
use db789;
create table refrain (id char(1) primary key);
insert into refrain values ('a'), ('b'), ('c'), ('d');
create view proceed as select * from refrain where id > 'b';