This function should be replaced by a built in function strposrev in future versions of postgresql --Boshomi