Fix #8852 (crash when removing invalid postgres table from project)