Re: extract and time zones

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: extract and time zones
Date: 2003-08-01 15:42:57
Message-ID: 1059752577.7505.600.camel@haggis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

On Fri, 2003-08-01 at 10:19, Dennis Gearon wrote:
> Don't know the answer to your question, but how did you type all those commands in one second? :-)

From a script?

$ psql -a -f bar.sql template1
drop table bar;
DROP TABLE
create table bar (f1 timestamp);
CREATE TABLE
insert into bar values (current_timestamp);
INSERT 17010 1
insert into bar values (current_timestamp);
INSERT 17011 1
select extract(epoch from f1) from bar;
date_part
------------------
1059752510.67238
1059752510.69783
(2 rows)

> Oscar Estevez Lopez wrote:
>
> > Um, and what about this?
> >
> > $ uname -a
> > FreeBSD caneli 4.7-RELEASE FreeBSD 4.7-RELEASE #1: Fri May 9 02:30:11 CEST 2003 root(at)caneli:/usr/obj/usr/src/sys/CANELI i386
> >
> > $ psql --version
> > psql (PostgreSQL) 7.2.2
> > contains support for: readline, history, multibyte
> > Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
> > Portions Copyright (c) 1996, Regents of the University of California
> > Read the file COPYRIGHT or use the command \copyright to see the
> > usage and distribution terms.
> >
> > create table t1( d timestamp(0) without time zone );
> > CREATE
> >
> > insert into t1 values( current_timestamp );
> > INSERT 26251 1
> >
> >
> > select * from t1;
> > d
> > ---------------------
> > 2003-08-01 13:30:38
> > (1 row)
> >
> > select extract( epoch from d ) from t1;
> > date_part
> > ------------
> > 1059744638
> > (1 row)
> >
> > select extract( epoch from d::timestamp ) from t1;
> > date_part
> > ------------
> > 1059737438
> > (1 row)
> >
> > d : 1059744638
> > d::timestamp : 1059737438
> >
> > ??
> >
> > Does 'epoch from d' check time zone and 'epoch from d::timestamp' doesn't?
> >
> >
> >
> >
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
--
+-----------------------------------------------------------------+
| Ron Johnson, Jr. Home: ron(dot)l(dot)johnson(at)cox(dot)net |
| Jefferson, LA USA |
| |
| "I'm not a vegetarian because I love animals, I'm a vegetarian |
| because I hate vegetables!" |
| unknown |
+-----------------------------------------------------------------+

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2003-08-01 16:56:04 Re: PG 7.3.1 with ssl on linux hangs (testcase available)
Previous Message Dennis Gearon 2003-08-01 15:19:25 Re: extract and time zones

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2003-08-01 15:46:58 Re: surppressing column names in COPY format
Previous Message scott.marlowe 2003-08-01 15:40:33 Re: Integrating the field auto-increment