From: Bruce Momjian Date: Mon, 17 Jan 2005 03:02:56 +0000 (+0000) Subject: Mention ALTER COLUMN TYPE in FAQ. X-Git-Tag: REL8_0_0~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=56d982b7d42c34a7da8ba50a3a51396d8b733aaf;p=postgresql Mention ALTER COLUMN TYPE in FAQ. --- diff --git a/doc/FAQ b/doc/FAQ index eb767689e1..1cbbd35a68 100644 --- a/doc/FAQ +++ b/doc/FAQ @@ -1,7 +1,7 @@ Frequently Asked Questions (FAQ) for PostgreSQL - Last updated: Sun Jan 16 21:40:18 EST 2005 + Last updated: Sun Jan 16 22:01:06 EST 2005 Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us) @@ -690,7 +690,10 @@ log_* ALTER TABLE new_table RENAME TO old_table; COMMIT; - To change the data type of a column, do this: + Changing the data type of a column can be done easily in 8.0 and later + with ALTER TABLE ALTER COLUMN TYPE. + + In earlier releases, do this: BEGIN; ALTER TABLE tab ADD COLUMN new_col new_data_type; UPDATE tab SET new_col = CAST(old_col AS new_data_type); diff --git a/doc/src/FAQ/FAQ.html b/doc/src/FAQ/FAQ.html index b69e3c66cc..3117b90e6b 100644 --- a/doc/src/FAQ/FAQ.html +++ b/doc/src/FAQ/FAQ.html @@ -10,7 +10,7 @@ alink="#0000ff">

Frequently Asked Questions (FAQ) for PostgreSQL

-

Last updated: Sun Jan 16 21:40:18 EST 2005

+

Last updated: Sun Jan 16 22:01:06 EST 2005

Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
@@ -854,8 +854,8 @@

4.4) How do you remove a column from a table, or change its data type?

-

DROP COLUMN functionality was added in release 7.3 with - ALTER TABLE DROP COLUMN. In earlier versions, +

DROP COLUMN functionality was added in release 7.3 + with ALTER TABLE DROP COLUMN. In earlier versions, you can do this:

     BEGIN;
@@ -868,7 +868,10 @@
     COMMIT;
 
-

To change the data type of a column, do this:

+

Changing the data type of a column can be done easily in 8.0 + and later with ALTER TABLE ALTER COLUMN TYPE. + +

In earlier releases, do this:

     BEGIN;
     ALTER TABLE tab ADD COLUMN new_col new_data_type;