Folks,
This patch adds an example of ALTER COLUMN TYPE with a USING clause.
Thanks to Tom Lane both for writing the feature and making sure I got
it documented right :)
Cheers,
D
--
David Fetter [EMAIL PROTECTED] http://fetter.org/
phone: +1 510 893 6100 mobile: +1 415 235 3778
Remember to vote!
Index: doc/src/sgml/ref/alter_table.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v
retrieving revision 1.76
diff -c -r1.76 alter_table.sgml
*** doc/src/sgml/ref/alter_table.sgml 10 Jan 2005 00:04:43 -0000 1.76
--- doc/src/sgml/ref/alter_table.sgml 12 Jan 2005 09:01:19 -0000
***************
*** 538,543 ****
--- 538,554 ----
</para>
<para>
+ To change an integer containing a UNIX timestamp to a <type>timestamp
+ with time zone</type> via a <literal>USING</literal> clause:
+ <programlisting>
+ ALTER TABLE foo
+ ALTER COLUMN foo_timestamp TYPE timestamp with time zone
+ USING
+ timestamp with time zone 'epoch' + foo_timestamp * interval '1
second';
+ </programlisting>
+ </para>
+
+ <para>
To rename an existing column:
<programlisting>
ALTER TABLE distributors RENAME COLUMN address TO city;
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match