Re: [SQL] indexing a datetime by date - Mailing list pgsql-sql

From Thomas Lockhart
Subject Re: [SQL] indexing a datetime by date
Date
Msg-id 37006BB5.E5720D9@alumni.caltech.edu
Whole thread Raw
In response to RE: [SQL] indexing a datetime by date  ("Jackson, DeJuan" <djackson@cpsgroup.com>)
Responses Re: [SQL] indexing a datetime by date  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
> Your index creation syntax is good but there's a bug in function 
> indexes which require you to specify the ops. Try:
>  create index when_ndx3 on notes (date(when) date_ops);
> Which won't work because the date(datetime) function isn't trusted.
> You can change this yourself in the system tables or you can use 
> PL/PGSQL (the only trustable PL in PostgreSQL that I've found) to 
> create another conversion function and use it instead.  Or you can as 
> Thomas Lockhart (or is it Tom Lane) if he'd create a trusted function 
> for the conversions in 6.5.

Tom, does this ring a bell with you? istm that (almost) all builtin
functions should be trusted, but I haven't done anything explicit
about it that I can remember.

In your new role as System Table Berserker, perhaps you would want to
fix this? :)
                      - Tom


pgsql-sql by date:

Previous
From: "Jackson, DeJuan"
Date:
Subject: RE: [SQL] indexing a datetime by date
Next
From: Herouth Maoz
Date:
Subject: Re: [GENERAL] Returning an integer from a date