Re: [GENERAL] Quick Date/Time Index Question

2011-09-22 Thread Michael Glaesemann
On Sep 22, 2011, at 17:13, David Johnston wrote: > Is there some other way to create an index on only the "date" portion of the > field? The cast from timestamptz to date is time zone dependent, which is why it's volatile and can't be used indexes. However, you can do this: test=# create table

Re: [GENERAL] Quick Date/Time Index Question

2011-09-22 Thread Tim Landscheidt
Tom Lane wrote: >> I have a database field that stores a timestamp to second+ precision; >> however, I want to search against it only to day precision. If I leave the >> field in second precision and try to "WHERE field BETWEEN date0 AND date0" I >> get no results (OK, fine) but then I cast the

Re: [GENERAL] Quick Date/Time Index Question

2011-09-22 Thread Tom Lane
"David Johnston" writes: > I have a database field that stores a timestamp to second+ precision; > however, I want to search against it only to day precision. If I leave the > field in second precision and try to "WHERE field BETWEEN date0 AND date0" I > get no results (OK, fine) but then I cast

Re: [GENERAL] Quick Date/Time Index Question

2011-09-22 Thread Tim Landscheidt
"David Johnston" wrote: > I have a database field that stores a timestamp to second+ precision; > however, I want to search against it only to day precision. If I leave the > field in second precision and try to "WHERE field BETWEEN date0 AND date0" I > get no results (OK, fine) but then I cast

Re: [GENERAL] Quick Date/Time Index Question

2011-09-22 Thread Ben Chobot
On Sep 22, 2011, at 2:13 PM, David Johnston wrote: > Hey, > > On 9.0.4 > > I have a database field that stores a timestamp to second+ precision; > however, I want to search against it only to day precision. If I leave the > field in second precision and try to “WHERE field BETWEEN date0 AND

[GENERAL] Quick Date/Time Index Question

2011-09-22 Thread David Johnston
Hey, On 9.0.4 I have a database field that stores a timestamp to second+ precision; however, I want to search against it only to day precision. If I leave the field in second precision and try to "WHERE field BETWEEN date0 AND date0" I get no results (OK, fine) but then I cast the field to