fix RQLUniqueConstraint behaviour by using a DISTINCT query and allowing
to specify variables that should be used in selection. See usage on
state_of / transition_of relations.
# sync and restart to make sure cwuri does not appear in formssync_schema_props_perms()