Polynomially Bounded Valuations in Higher-Order Logics over Relational Databases