db_text: properly initialize memory when caching tables
(cherry picked from commit 204d08bb18110599317324fefbd64ecc77e6784f)