Re: Howto change column length

Поиск
Список
Период
Сортировка
От wsheldah@lexmark.com
Тема Re: Howto change column length
Дата
Msg-id 200111061859.NAA20551@interlock2.lexmark.com
обсуждение исходный текст
Ответ на Howto change column length  ("DC" <danc@bspmail.com>)
Список pgsql-general

The short answer is to copy the info to a temp table, drop the table, recreate
the table with the correct attributes, and copy the data back from the temp
table.  HOWEVER, if you have foreign keys or triggers that reference the table,
they will become invalid through the above procedure.  So you need to make a
backup of the database with pg_dump, edit the CREATE TABLE statement in the
backup file so the column has the correct length, drop the database, and
recreate the database using the backup file.  There's an article at
http://techdocs.postgresql.org that describes the process in greater detail.

I understand that 7.3 might have support for ALTER TABLE DROP COLUMN.



"DC" <danc%bspmail.com@interlock.lexmark.com> on 11/05/2001 12:21:12 PM

Please respond to "DC" <danc%bspmail.com@interlock.lexmark.com>

To:   pgsql-general%postgresql.org@interlock.lexmark.com
cc:    (bcc: Wesley Sheldahl/Lex/Lexmark)
Subject:  [GENERAL] Howto change column length


I have a column (ie name varchar(10))
and I want to alter it to varchar(20)
I've looked throught the docementation and web for examples (no luck),
can anyone help?

thx



---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly







В списке pgsql-general по дате отправления:

Предыдущее
От: Jason Earl
Дата:
Сообщение: Re: data integrity
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Null value representation in the array data structure