converted tie rewinders from plpgsql to sql, unquoted the function parameters, quoted referenced db objects.