| От | Christian Ramseyer |
|---|---|
| Тема | Changing varchar length by manipulating pg_attribute |
| Дата | |
| Msg-id | 56963C29.10408@networkz.ch обсуждение исходный текст |
| Ответы |
Re: Changing varchar length by manipulating pg_attribute
|
| Список | pgsql-general |
Hi I have a database in which I'd like to increase the length of a varchar column. Unfortunately, the column is used in various views which then are used in other views, so doing this with ALTER TABLE ALTER COLUMN TYPE is quite a lot of work. I have found this suggestion <http://sniptools.com/databases/resize-a-column-in-a-postgresql-table-without-changing-data> to just update pg_attribute like this: UPDATE pg_attribute SET atttypmod = 35+4 -- new desired length + 4 WHERE attrelid = 'TABLE1'::regclass AND attname = 'COL1'; Is this safe to do in Postgres 9.4? Also, best practice seems to be to use text nowadays, is there even a variant of this that lets me convert a "column from character varying(256)" to "text" without having to recreate all the nested views? Thanks Christian
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера