[1.7.x] Fixed #23954 -- Added special text/varchar PostgreSQL indexes in migrations

Thanks adityagupta104 for the report and Tim Graham for the review.
Backport of 8d7a48027e from master.