From: Jochem van Dieten <nomail@dev.null>
To: pgsql-sql@postgresql.org
Subject: Re: Error trying to create a functional index.
Date: Tue, 08 Jan 2002 13:10:21 +0100
Message-ID: <3C3AE1AD.30508@dev.null> (raw)
References: <b01eaea0.0201030725.51661db3@posting.google.com>
<a1229v$2a19$1@news.tht.net>
<3C397FF1.20706@mportal.hu>
<3C3AD7A0.9090304@dev.null>
<3C3ADEA7.9090303@mportal.hu>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: nomail@dev.null
Subject: Re: Error trying to create a functional index.
In-Reply-To: <3C3AE1AD.30508@dev.null>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox