CoL wrote:
>
> sure it is, but date_trunc takes this, so what is the way to create a
> date_trunc part or any date function index on a timestamp?
>
> Or it's not possible?
I would tend to believe it is not directly possible. But maybe with a
custom function:
(pseudocode, check whether Day is a reserved word)
CREATE FUNCTION Day(date) RETURNS varchar AS '
BEGIN RETURN Cast(date_trunc('day', $1) AS varchar);
END;
' LANGUAGE 'SQL';
CREATE INDEX eventdateindex ON event (Day(eventstamp));
SELECT Day(eventstamp) FROM event;
Jochem