mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 10:31:02 +02:00
Error out when using ignored options.
In the theory that it's a better service to the user to refuse doing anything at all rather than ignore his/her commands, print out FATAL errors when options are used that are incompatible with a load command file. See #327 for a case where this did happen. In passing, tweak our report code to avoid printing the footer when we didn't print anything at all previously.
This commit is contained in:
parent
4e36bd3c55
commit
64ab4d28dc
@ -324,7 +324,26 @@
|
||||
before after))
|
||||
(t
|
||||
;; process the files
|
||||
(mapcar #'process-command-file arguments))))
|
||||
;; other options are not going to be used here
|
||||
(let ((cli-options `(("--type" ,type)
|
||||
("--encoding" ,encoding)
|
||||
("--set" ,set)
|
||||
("--with" ,with)
|
||||
("--field" ,field)
|
||||
("--cast" ,cast)
|
||||
("--before" ,before)
|
||||
("--after" ,after))))
|
||||
(loop :for (cli-option-name cli-option-value)
|
||||
:in cli-options
|
||||
:when cli-option-value
|
||||
:do (log-message
|
||||
:fatal
|
||||
"Option ~s is ignored when using a load file"
|
||||
cli-option-name))
|
||||
|
||||
;; when we issued a single error previously, do nothing
|
||||
(unless (remove-if #'null (mapcar #'second cli-options))
|
||||
(mapcar #'process-command-file arguments))))))
|
||||
|
||||
(source-definition-error (c)
|
||||
(log-message :fatal "~a" c)
|
||||
|
||||
@ -133,8 +133,9 @@
|
||||
(when (and ws (not (= ws 0.0))) (format-interval ws nil)))))
|
||||
|
||||
(defun report-pgstate-stats (pgstate legend)
|
||||
(with-slots (read rows errs secs rs ws) pgstate
|
||||
(report-footer legend read rows errs secs rs ws)))
|
||||
(with-slots (tabnames read rows errs secs rs ws) pgstate
|
||||
(when tabnames
|
||||
(report-footer legend read rows errs secs rs ws))))
|
||||
|
||||
;;;
|
||||
;;; Pretty print the whole summary from a state
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user