fix delete device on postgresql