From cb989e1155fe0ed0e40c1c3762ee2b53bf0eb12a Mon Sep 17 00:00:00 2001 From: Ian L Date: Sat, 11 Apr 2020 17:22:02 +0100 Subject: [PATCH] Fix MySQL query to compute number of rows per table (#1128) The CAST should target `unsigned` rather than `integer`, so that we are compatible with MySQL 5.7. Also empty tables might have NULL entries, which we transform to zero entries here, as expected by the Lisp code. Fixes #1127. --- src/sources/mysql/sql/list-table-rows.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sources/mysql/sql/list-table-rows.sql b/src/sources/mysql/sql/list-table-rows.sql index 82f58c8..9509e49 100644 --- a/src/sources/mysql/sql/list-table-rows.sql +++ b/src/sources/mysql/sql/list-table-rows.sql @@ -4,7 +4,7 @@ -- excluding -- filter-list-to-where-clause excluding SELECT table_name, - cast(data_length/avg_row_length as integer) + coalesce(cast(data_length/avg_row_length as unsigned), 0) FROM information_schema.tables WHERE table_schema = '~a' and table_type = 'BASE TABLE'