Received: from ara.zf.jcu.cz (ara.zf.jcu.cz [160.217.161.4]) by postgresql.org (Postfix) with ESMTP id 0D6FF475DF3 for ; Wed, 27 Mar 2002 06:07:06 -0500 (EST) Received: from ara.zf.jcu.cz (LOCALHOST [127.0.0.1]) by ara.zf.jcu.cz (8.12.1/8.12.1/Debian -5) with ESMTP id g2RB76BK018174; Wed, 27 Mar 2002 12:07:06 +0100 Received: (from zakkr@localhost) by ara.zf.jcu.cz (8.12.1/8.12.1/Debian -5) id g2RB76WF018173; Wed, 27 Mar 2002 12:07:06 +0100 Date: Wed, 27 Mar 2002 12:07:06 +0100 From: Karel Zak To: mark@vestnesis.lv Cc: pgsql-admin@postgresql.org Subject: Re: timestamp in 7.2 Message-ID: <20020327120706.B29369@zf.jcu.cz> References: <3CA1C15A.29615.58FACD5@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3CA1C15A.29615.58FACD5@localhost>; from mark@vestnesis.lv on Wed, Mar 27, 2002 at 12:55:54PM +0200 X-Archive-Number: 200203/322 X-Sequence-Number: 3856 On Wed, Mar 27, 2002 at 12:55:54PM +0200, mark@vestnesis.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 http://home.zf.jcu.cz/~zakkr/ C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz