index c753eb6300735e682403e51966744dfb74c8eafd..17b0f3667dabaa1df5c6142bb36dc7f1b483373d 100644 (file)
<!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.87 2006年07月04日 18:07:24 tgl Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.88 2006年08月03日 20:57:06 tgl Exp $
PostgreSQL documentation
-->
</programlisting>
</para>
+ <para>
+ The same, when the column has a default expression that won't automatically
+ cast to the new datatype:
+<programlisting>
+ALTER TABLE foo
+ ALTER COLUMN foo_timestamp DROP DEFAULT,
+ ALTER COLUMN foo_timestamp TYPE timestamp with time zone
+ USING
+ timestamp with time zone 'epoch' + foo_timestamp * interval '1 second',
+ ALTER COLUMN foo_timestamp SET DEFAULT now();
+</programlisting>
+ </para>
+
<para>
To rename an existing column:
<programlisting>
index 3b408b411a6acd9d1c26743f019262cb6724ea5d..cd4c4eb2304deca6a08529986e3621cc66cda322 100644 (file)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.198 2006年07月31日 20:09:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.199 2006年08月03日 20:57:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2000,7 +2000,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
ATSimplePermissions(rel, true);
ATSimpleRecursion(wqueue, rel, cmd, recurse);
/* No command-specific prep needed */
- pass = AT_PASS_ADD_CONSTR;
+ pass = cmd->def ? AT_PASS_ADD_CONSTR : AT_PASS_DROP;
break;
case AT_DropNotNull: /* ALTER COLUMN DROP NOT NULL */
ATSimplePermissions(rel, false);