"Jonathan Chum" <jchum@aismedia.com> writes:
> ERROR: Cannot cast type integer to timestamp with time zone
A solution with less notational cruft is to cast the integer to abstime:
regression=# select 1040999196::abstime;
abstime
------------------------
2002-12-27 09:26:36-05
(1 row)
regression=# select to_char(1040999196::abstime, 'Day');
to_char
-----------
Friday
(1 row)
abstime is a deprecated datatype if you believe the manual, but I
seriously doubt that we'll remove it anytime soon. Maybe when Y2038
is upon us (by which time you'd better have found another representation
for your table, anyway).
regards, tom lane