From 7fc0812f79608313c70051175b234a92cc6baf08 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Tue, 29 Mar 2016 21:02:31 +0200 Subject: [PATCH] Can't reduce an empty list with the max function. The max function requires at least 1 argument to be given, and in the case where we have no table to load it then fails badly, as show here: CL-USER> (handler-case (reduce #'max nil) (condition (c) (format nil "~a" c))) "invalid number of arguments: 0" Of course Common Lisp comes with a very easy way around that problem: CL-USER> (reduce #'max nil :initial-value 0) 0 Fix #381. --- src/utils/schema-structs.lisp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/schema-structs.lisp b/src/utils/schema-structs.lisp index 58cd482..af4cff2 100644 --- a/src/utils/schema-structs.lisp +++ b/src/utils/schema-structs.lisp @@ -322,7 +322,8 @@ "Count how many indexes maximum per table are listed in SCHEMA." (reduce #'max (mapcar #'length (mapcar #'table-index-list - (schema-table-list schema))))) + (schema-table-list schema))) + :initial-value 0)) "Count how many indexes maximum per table are listed in SCHEMA." (defmethod max-indexes-per-table ((catalog catalog) &key)