Re: Bug #747: PostgreSQL doesn't use indexes right sometimes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: j0-postgresql(at)johnzero(dot)hu, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #747: PostgreSQL doesn't use indexes right sometimes
Date: 2002-08-26 19:05:40
Message-ID: 1874.1030388740@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

pgsql-bugs(at)postgresql(dot)org writes:
> Summarized:
> timefield > 'now'::datetime --> NO index
> timefield > 'now'::timestamp --> index is used (OK)

"datetime" is an obsolete type name that will go away entirely in 7.3,
so I cannot get very excited about this. But I believe the issue is
that "timestamp" really means "timestamp with time zone" (in 7.2 anyway)
while "datetime" is translated to "timestamp without time zone", and
from there you fall into the usual traps involving cross-datatype
comparisons.

You'd be well advised to fix all your queries to read
::timestamp with time zone
to make them SQL-spec-compliant and unlikely to break in 7.3.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2002-08-26 22:57:36 Re: Bug #693: python interface doesn't handle int8 correctly.
Previous Message pgsql-bugs 2002-08-26 18:26:13 Bug #747: PostgreSQL doesn't use indexes right sometimes