Fix EZP-22333: SQL error in tagcloud with object state policies

## Description
Backport of https://github.com/ezsystems/ezdemo/pull/30 from ezdemo