Re: Error trying to create a functional index.

From: Jochem van Dieten <nomail(at)dev(dot)null>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Error trying to create a functional index.
Date: 2002-01-08 12:10:21
Message-ID: 3C3AE1AD.30508@dev.null
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ty 2002-01-08 14:48:47 Meta Data/Schema/DDL
Previous Message CoL 2002-01-08 11:57:27 Re: Error trying to create a functional index.