2 ms·
FTFA: If you want to change the max length to be larger, postgres will have to rewrite the table, which can take a long time and requires an exclusive table lo
by rosser 13y ago
FTFA:
If you want to change the max length to be larger, postgres will have to rewrite the table, which can take a long time and requires an exclusive table lock for the entirety of the operation.
As of (IIRC) 9.2, this is no longer true. If you alter a varchar column to be narrower than it currently is, you'll rewrite the table. If you make it wider, or convert from varchar(n) to text, you won't.
EDIT: And if you're willing to hack the system catalogs instead of using an ALTER TABLE, you can even get around the rewrite to narrow a varchar(n) column. See: http://stackoverflow.com/a/7732880 http://stackoverflow.com/a/7732880