Re: timestamp in 7.2

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: mark(at)vestnesis(dot)lv
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: timestamp in 7.2
Date: 2002-03-27 11:07:06
Message-ID: 20020327120706.B29369@zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wed, Mar 27, 2002 at 12:55:54PM +0200, mark(at)vestnesis(dot)lv wrote:
> Hello all.
>
> I'v migrated my data to 7.2.
> Now I'm testing aplications, but looks like timestamp function in
> postgres is broken:
> klienti=# select date(now());
> date
> ------------
> 2002-03-27
> (1 row)
>
> klienti=# select timestamp(date(now()));
> ERROR: parser: parse error at or near "date"

I thing better is use some cast method instead cast by function call:

test=# SELECT CAST( now() AS date ), now()::date, 'now'::date::timestamp;
now | now | timestamptz
------------+------------+------------------------
2002-03-27 | 2002-03-27 | 2002-03-27 00:00:00+01
(1 row)

>
> I need to make querys with timestamp(date,time);
> But timestamp don't work even with sample from manual:
>
> klienti=# select timestamp(date '1998-02-24',time '23:07');
> ERROR: parser: parse error at or near "date"

test=# select date '1998-02-24' + time '23:07';
?column?
---------------------
1998-02-24 23:07:00
(1 row)

test=# select timestamp '1998-02-24 23:07';
timestamptz
------------------------
1998-02-24 23:07:00+01
(1 row)

Karel

--
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
http://home.zf.jcu.cz/~zakkr/

C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Jodi Kanter 2002-03-27 15:45:30 join vs. IN statement
Previous Message mark 2002-03-27 10:55:54 timestamp in 7.2