Re: why doesn't an index help my simple query? - Mailing list pgsql-novice

From Dima Tkach
Subject Re: why doesn't an index help my simple query?
Date
Msg-id 3ED8EA70.20006@openratings.com
Whole thread Raw
In response to Re: why doesn't an index help my simple query?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
>
>>Should the plain 'timestamp' type really default to a different type
>>than what all the rest of the timestamp operators prefer?
>
>
> Tell me about it :-(.  SQL92 specifies that "timestamp" means "timestamp
> without time zone", but this is an utterly brain-dead default IMHO.
> You can check the PG list archives if you want to see past flamewars
> about the issue.  As a member of the losing side I will gracefully
> retire...
>

But is *this* really the issue here?

It seems to me, that everything would work as expected if the planner
tried to cast the *constant* side of the operator to the column type,
and not the other way around - i.e., in this case, it coverts the
original condition into something like
'time::timestamp with timezone < now ()'
if instead it did
'time < now()::timestamp', it would work, (and be able to use the
index), wouldn't it?

Is there some technical difficulty here, making it too complicated to
implement?

Dima




pgsql-novice by date:

Previous
From: Frank Bax
Date:
Subject: Re: Examples of accessing postgresql with scripts?
Next
From: Nabil Sayegh
Date:
Subject: Re: Create Table Unique problem... bug?