Increasing the size of character varying type in postgres without data loss

后端 未结 6 2096
春和景丽
春和景丽 2021-02-06 20:54

I need to increase the size of a character varying(60) field in a postgres database table without data loss.

I have this command

alter table client_deta         


        
6条回答
  •  一生所求
    2021-02-06 21:32

    Yes. But it will rewrite this table and lock it exclusively for duration of rewriting — any query trying to access this table will wait until rewrite finishes.

    Consider changing type to text and using check constraint for limiting size — changing constraint would not rewrite or lock a table.

提交回复
热议问题