Re: Bug #747: PostgreSQL doesn't use indexes right sometimes - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Bug #747: PostgreSQL doesn't use indexes right sometimes
Date
Msg-id 1874.1030388740@sss.pgh.pa.us
Whole thread Raw
In response to Bug #747: PostgreSQL doesn't use indexes right sometimes  (pgsql-bugs@postgresql.org)
List pgsql-bugs
pgsql-bugs@postgresql.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

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: Bug #747: PostgreSQL doesn't use indexes right sometimes
Next
From: Bruce Momjian
Date:
Subject: Re: Bug #693: python interface doesn't handle int8 correctly.