Mechanical stability of piezoelectric properties in ferroelectric perovskites