fix(engine): fix variable instance query for postgres

related to CAM-982