From 9309d5f2ba00f3d918bc2f7998440be89fbde85b Mon Sep 17 00:00:00 2001
From: Tom Lane
Date: Fri, 22 Oct 2004 17:20:05 +0000
Subject: In ALTER COLUMN TYPE, strip any implicit coercion operations
appearing at the top level of the column's old default expression before
adding an implicit coercion to the new column type. This seems to satisfy
the principle of least surprise, as per discussion of bug #1290.
---
doc/src/sgml/ref/alter_table.sgml | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
(limited to 'doc/src')
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index 263e5024b62..e5856d9bfb4 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -1,5 +1,5 @@
@@ -459,6 +459,22 @@ ALTER TABLE table ALTER COLUMN anycol TYPE anytype;
data.
+
+ The USING option of ALTER TYPE> can actually
+ specify any expression involving the old values of the row; that is, it
+ can refer to other columns as well as the one being converted. This allows
+ very general conversions to be done with the ALTER TYPE>
+ syntax. Because of this flexibility, the USING
+ expression is not applied to the column's default value (if any); the
+ result might not be a constant expression as required for a default.
+ This means that when there is no implicit or assignment cast from old to
+ new type, ALTER TYPE> may fail to convert the default even
+ though a USING clause is supplied. In such cases,
+ drop the default with DROP DEFAULT>, perform the ALTER
+ TYPE>, and then use SET DEFAULT> to add a suitable new
+ default.
+
+
If a table has any descendant tables, it is not permitted to add,
rename, or change the type of a column in the parent table without doing
--
cgit v1.2.3