fix `ProgrammingError: 1046 (3D000): No database selected` bug