From f0d1f4ef8c48b2b2b88f13fbaddf0c65bf91cd5c Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Wed, 28 Jun 2017 16:37:27 +0200 Subject: [PATCH] Fix reduce usage with max function. The (reduce #'max ...) requires an initial value to be provided, as the max function wants at least 1 argument, as we can see here: CL-USER> (handler-case (reduce #'max nil) (condition (e) (format t "~a" e))) Too few arguments in call to #: 0 arguments provided, at least 1 required. --- src/pgsql/pgsql-ddl.lisp | 3 ++- src/utils/catalog.lisp | 3 ++- src/utils/report.lisp | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pgsql/pgsql-ddl.lisp b/src/pgsql/pgsql-ddl.lisp index 4e087b4..140f24e 100644 --- a/src/pgsql/pgsql-ddl.lisp +++ b/src/pgsql/pgsql-ddl.lisp @@ -49,7 +49,8 @@ (let ((max (reduce #'max (mapcar #'length (mapcar #'column-name - (table-column-list table)))))) + (table-column-list table))) + :initial-value 0))) (loop :for (col . last?) :on (table-column-list table) :do (progn diff --git a/src/utils/catalog.lisp b/src/utils/catalog.lisp index 6d9207c..761ebf6 100644 --- a/src/utils/catalog.lisp +++ b/src/utils/catalog.lisp @@ -375,7 +375,8 @@ (defmethod max-indexes-per-table ((catalog catalog) &key) "Count how many indexes maximum per table are listed in SCHEMA." - (reduce #'max (mapcar #'max-indexes-per-table (catalog-schema-list catalog)))) + (reduce #'max (mapcar #'max-indexes-per-table (catalog-schema-list catalog)) + :initial-value 0)) ;;; ;;; Not a generic/method because only used for the table object, and we want diff --git a/src/utils/report.lisp b/src/utils/report.lisp index f0076e1..7268e5b 100644 --- a/src/utils/report.lisp +++ b/src/utils/report.lisp @@ -192,7 +192,8 @@ (append (pgstate-tabnames data) (pgstate-tabnames pre) (pgstate-tabnames post) - (list legend)))))) + (list legend)))) + :initial-value 0)) (defun report-full-summary (legend sections total-secs) "Report the full story when given three different sections of reporting."