aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/src/sgml/func.sgml15
-rw-r--r--src/include/catalog/pg_proc.h4
2 files changed, 17 insertions, 2 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 7eb2c4c6b13..bc34c96542c 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -1,5 +1,5 @@
<!--
-$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.252 2005/06/07 07:08:34 neilc Exp $
+$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.253 2005/06/09 16:35:08 momjian Exp $
PostgreSQL documentation
-->
@@ -4082,6 +4082,13 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})');
argument is the value to be formatted and the second argument is a
template that defines the output or input format.
</para>
+ <para>
+ The <function>to_timestamp</function> function can also take a single
+ <type>double precision</type> argument to convert from Unix epoch to
+ <type>timestamp with time zone</type>.
+ (<type>Integer</type> Unix epochs are implicitly cast to
+ <type>double precision</type>.)
+ </para>
<table id="functions-formatting-table">
<title>Formatting Functions</title>
@@ -4139,6 +4146,12 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})');
<entry><literal>to_timestamp('05&nbsp;Dec&nbsp;2000', 'DD&nbsp;Mon&nbsp;YYYY')</literal></entry>
</row>
<row>
+ <entry><literal><function>to_timestamp</function>(<type>double precision</type>)</literal></entry>
+ <entry><type>timestamp with time zone</type></entry>
+ <entry>convert UNIX epoch to time stamp</entry>
+ <entry><literal>to_timestamp(200120400)</literal></entry>
+ </row>
+ <row>
<entry><literal><function>to_number</function>(<type>text</type>, <type>text</type>)</literal></entry>
<entry><type>numeric</type></entry>
<entry>convert string to numeric</entry>
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index 9f5c2d8e0e3..5bf7753dcea 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.364 2005/06/07 07:08:34 neilc Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.365 2005/06/09 16:35:09 momjian Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
@@ -1459,6 +1459,8 @@ DATA(insert OID = 1156 ( timestamptz_ge PGNSP PGUID 12 f f t f i 2 16 "1184 1
DESCR("greater-than-or-equal");
DATA(insert OID = 1157 ( timestamptz_gt PGNSP PGUID 12 f f t f i 2 16 "1184 1184" _null_ _null_ _null_ timestamp_gt - _null_ ));
DESCR("greater-than");
+DATA(insert OID = 1158 ( to_timestamp PGNSP PGUID 14 f f t f i 1 1184 "701" _null_ _null_ _null_ "select (\'epoch\'::timestamptz + $1 * \'1 second\'::interval)" - _null_ ));
+DESCR("convert UNIX epoch to timestamptz");
DATA(insert OID = 1159 ( timezone PGNSP PGUID 12 f f t f i 2 1114 "25 1184" _null_ _null_ _null_ timestamptz_zone - _null_ ));
DESCR("adjust timestamp to new time zone");