Postgres: Convert varchar to text

本小妞迷上赌 提交于 2020-03-13 05:34:29

问题


I screwed up and created a column as a varchar(255) where that is no longer sufficient. I've read that varchar has no performance benefits over text on Postgres, and so would like to convert the varchar to a text column in a safe way that preserves the data.

What's the best way for me to do this?


回答1:


ALTER TABLE table1 ALTER COLUMN column1 TYPE text;


来源:https://stackoverflow.com/questions/2813049/postgres-convert-varchar-to-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!