mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 10:31:02 +02:00
Ensure unquoted file names for logs and data.
The previous code could create files having as an example the following, unhelpful name: \"errors\"/\"err\".\"errors\".log. Fix #808.
This commit is contained in:
parent
ee44f19815
commit
8930734bea
@ -69,7 +69,9 @@
|
||||
|
||||
(defmethod pgtable-initialize-reject-files ((table pgtable) dbname)
|
||||
"Prepare TABLE for being able to deal with rejected rows (log them)."
|
||||
(let* ((table-name (format-table-name (pgtable-name table)))
|
||||
(let* ((dbname (pgloader.quoting:ensure-unquoted dbname))
|
||||
(table-name (pgloader.quoting:ensure-unquoted
|
||||
(table-name (pgtable-name table))))
|
||||
(data-pathname (reject-data-file table-name dbname))
|
||||
(logs-pathname (reject-log-file table-name dbname)))
|
||||
;; we also use that facility for things that are not tables
|
||||
@ -83,13 +85,17 @@
|
||||
(with-open-file (data data-pathname
|
||||
:direction :output
|
||||
:if-exists :rename
|
||||
:if-does-not-exist nil)))
|
||||
:if-does-not-exist nil)
|
||||
;; avoid a warning about DATA being some unused lexical variable
|
||||
(pathname data)))
|
||||
|
||||
(when (probe-file logs-pathname)
|
||||
(with-open-file (logs logs-pathname
|
||||
:direction :output
|
||||
:if-exists :rename
|
||||
:if-does-not-exist nil)))
|
||||
:if-does-not-exist nil)
|
||||
;; avoid a warning about LOGS being some unused lexical variable
|
||||
(pathname logs)))
|
||||
|
||||
;; set the properties to the right pathnames
|
||||
(setf (pgtable-reject-data table) data-pathname
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user