Fixed issue #9282: Deactivating survey with tokens fails with postgres - patch provided by random1