Fix EZP-22333: SQL error in tagcloud with object state policies
(cherry picked from commit d8cd4f64c5be1650bf6c56f103adfb4a4263c71c)