Sample Header Ad - 728x90

Postgres varchar(100)[] -> text[] column conversion

3 votes
1 answer
1899 views
I need to change a column type from varchar(100)[] to text[]. The table has >100M rows and heavy write load, so I'd like to avoid taking an access exclusive lock and rewriting the index. I saw in [this question](https://dba.stackexchange.com/q/189890/112479) that non-array varchar to text changes manage this, so I was wondering: does the same apply with array columns? [The docs](https://www.postgresql.org/docs/13/sql-altertable.html#SQL-ALTERTABLE-NOTES) + [the mailing list](https://www.postgresql.org/message-id/flat/CAMp9%3DExXtH0NeF%2BLTsNrew_oXycAJTNVKbRYnqgoEAT01t%3D67A%40mail.gmail.com) say that this change will be quick if: > the old type is either binary coercible to the new type or an unconstrained domain over the new type) Is that the case for varchar(100)[] to text[]?
Asked by Felipe (317 rep)
Jun 8, 2021, 02:33 AM
Last activity: Jun 10, 2021, 01:42 AM