Skip to content

Commit cb989e1

Browse files
authored
Fix MySQL query to compute number of rows per table (dimitri#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 dimitri#1127.
1 parent 86b6a5c commit cb989e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/sources/mysql/sql/list-table-rows.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-- excluding
55
-- filter-list-to-where-clause excluding
66
SELECT table_name,
7-
cast(data_length/avg_row_length as integer)
7+
coalesce(cast(data_length/avg_row_length as unsigned), 0)
88
FROM information_schema.tables
99
WHERE table_schema = '~a'
1010
and table_type = 'BASE TABLE'

0 commit comments

Comments
 (0)