pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Radoslaw Stachowiak <radek@alter.pl>
To: pgsql-admin@postgresql.org
Subject: 7.2 timetz/time/current_time improper behaviour report
Date: Thu, 28 Mar 2002 15:34:19 +0100
Message-ID: <20020328143419.GE19576@blue.alter.pl> (raw)

Examples:
mlot=# create temp table dddd ( t1 time,t2 timetz );
CREATE

mlot=# insert into dddd values ( now() , now() );
ERROR:  column "t1" is of type 'time without time zone' but expression is of type 'timestamp with time zone'
        You will need to rewrite or cast the expression

ok, i know that now() has timezone, so it does not fit to 'time'.

mlot=# insert into dddd values (current_time,now());
INSERT 618593 1

mlot=# select * from dddd;
       t1        |         t2
-----------------+--------------------
 15:27:47.065969 | 15:27:47.065969+01
(1 row)

ok, BUT:
mlot=# select current_time;
       timetz
--------------------
 15:28:08.930204+01


so current_time is timetz type, so why I was able to insert it without cast
into t1 field while I couldnt do it with now() ??

more:

mlot=# select * from dddd where current_time between t2 AND t2;
 t1 | t2
----+----
(0 rows)

and:

mlot=# select * from dddd where current_time between t1 AND t1;
ERROR:  Unable to identify an operator '>=' for types 'time with time zone' and 'time without time zone'
        You will have to retype this query using an explicit cast

so current_time is definitely timetz type.

BUG?: insert into dddd values (current_time,now()); should not work.

please correct me if'm wrong.

-- 
radoslaw.stachowiak.........................................http://alter.pl/



Message-ID: <20020328143419.GE19576@blue.alter.pl>
Permalink:  ../20020328143419.GE19576@blue.alter.pl/
Also on:    postgresql.org/message-id/20020328143419.GE19576@blue.alter.pl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: radek@alter.pl
  Subject: Re: 7.2 timetz/time/current_time improper behaviour report
  In-Reply-To: <20020328143419.GE19576@blue.alter.pl>
  References: <20020328143419.GE19576@blue.alter.pl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox