Update query such that it matches the behaviour of other DB when using the classes option of objects()