Metasploit db_status shows connected to msf but rebuild_cache shows not connected

I am not able to rebuild the db cache although db_status suggests i am connected to the database? Pls help.

msf > db_status

[*] postgresql connected to msf

msf > db_rebuild_cache

[-] The database is not connected

msf > search wordpress

[!] Module database cache not built yet, using slow search

msf > msfdb init

[*] exec: msfdb init
A database appears to be already configured, skipping initialization