Here is a problem I got while experiencing with date type:
when  I use adate = 'today'::Date explain shows me postgres will use
index, but adate::Date = 'today'::Date (which is the same expression )doesn't 
use index.  This happens for 6.4.2 and 6.5 cvs.

	Regards,

		Oleg

PS.
 btw, how I can find 'something' older than a month, i.e.
 select * from titles where adate::date > 'today'::Date - '1 month'::timespan;



apod=> vacuum analyze;
VACUUM
apod=> explain select count(*) from titles where adate::Date = 'today'::Date;
NOTICE:  QUERY PLAN:

Aggregate  (cost=64.10 size=0 width=0)
  ->  Seq Scan on titles  (cost=64.10 size=699 width=12)

EXPLAIN
apod=> explain select count(*) from titles where adate = 'today'::Date;
NOTICE:  QUERY PLAN:

Aggregate  (cost=2.04 size=0 width=0)
  ->  Index Scan using idx_adate on titles  (cost=2.04 size=1 width=12)

EXPLAIN
apod=> select version();
version                                                           
------------------------------------------------------------------
PostgreSQL 6.4.2 on i586-pc-linux-gnu, compiled by gcc egcs-2.91.5
(1 row)

apod=> \d titles

Table    = titles
+----------------------------------+----------------------------------+-------+
|              Field               |              Type                | Length|
+----------------------------------+----------------------------------+-------+
| url                              | char()                           |    13 |
| adate                            | date                             |     4 |
| atitle                           | text                             |   var |
+----------------------------------+----------------------------------+-------+
Indices:  idx_adate
          idx_atitle
          idx_url
a

_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83


Mon, 3 May 1999 21:35:55 +0400 (MSD)
Oleg Bartunov <oleg@sai.msu.su>
adate::Date is equiv. to adate if adate is type of Date ? 
>  btw, how I can find 'something' older than a month, i.e.
>  select * from titles
>   where adate::date > 'today'::Date - '1 month'::timespan;

  select * from titles
   where adate::date < 'today'::Date - '1 month'::timespan;

??

                       - Tom

-- 
Thomas Lockhart				lockhart@alumni.caltech.edu
South Pasadena, California

Tue, 04 May 1999 02:06:04 +0000
Thomas Lockhart <lockhart@alumni.caltech.edu>
Re: [HACKERS] adate::Date is equiv. to adate if adate is type of Date
	?