diff --git a/src/pgsql/schema.lisp b/src/pgsql/schema.lisp index c63b23a..b0f22d5 100644 --- a/src/pgsql/schema.lisp +++ b/src/pgsql/schema.lisp @@ -14,7 +14,7 @@ case))) (ecase case (:downcase (cl-ppcre:regex-replace-all - "[^a-zA-Z0-9]" (string-downcase identifier) "_")) + "[^a-zA-Z0-9.]" (string-downcase identifier) "_")) (:quote (format nil "\"~a\"" identifier))))) ;;; @@ -189,7 +189,7 @@ "Truncate given TABLE-NAME in database DBNAME" (pomo:with-connection (get-connection-spec dbname) (set-session-gucs *pg-settings*) - (let ((sql (format nil "TRUNCATE ~{~s~^,~};" + (let ((sql (format nil "TRUNCATE ~{~a~^,~};" (loop :for table-name :in table-name-list :collect (apply-identifier-case table-name identifier-case))))) diff --git a/test/csv-before-after.load b/test/csv-before-after.load index efc5490..0af3fd3 100644 --- a/test/csv-before-after.load +++ b/test/csv-before-after.load @@ -9,7 +9,8 @@ LOAD CSV iprange ip4r using (ip-range startIpNum endIpNum), locId ) - WITH fields optionally enclosed by '"', + WITH truncate, + fields optionally enclosed by '"', fields escaped by double-quote, fields terminated by ',' @@ -17,7 +18,7 @@ LOAD CSV BEFORE LOAD DO $$ create extension if not exists ip4r; $$, - $$ drop schema if exists csv; $$, + $$ drop schema if exists csv cascade; $$, $$ create schema csv; $$, $$ create table if not exists csv.blocks (