7.2 timetz/time/current_time improper behaviour report - Mailing list pgsql-admin

From Radoslaw Stachowiak
Subject 7.2 timetz/time/current_time improper behaviour report
Date
Msg-id 20020328143419.GE19576@blue.alter.pl
Whole thread Raw
List pgsql-admin
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/

pgsql-admin by date:

Previous
From: Andre Schubert
Date:
Subject: Re: Last_Inserted Value
Next
From: Tom Lane
Date:
Subject: Re: Last_Inserted Value