7.2 timetz/time/current_time improper behaviour report

From: Radoslaw Stachowiak <radek(at)alter(dot)pl>
To: pgsql-admin(at)postgresql(dot)org
Subject: 7.2 timetz/time/current_time improper behaviour report
Date: 2002-03-28 14:34:19
Message-ID: 20020328143419.GE19576@blue.alter.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2002-03-28 14:40:35 Re: Last_Inserted Value
Previous Message Andre Schubert 2002-03-28 12:37:48 Re: Last_Inserted Value