Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g08CReB46570 for ; Tue, 8 Jan 2002 07:27:46 -0500 (EST) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id g08CAPc55620 for pgsql-sql@postgresql.org; Tue, 8 Jan 2002 07:10:25 -0500 (EST) (envelope-from news) From: Jochem van Dieten X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Error trying to create a functional index. Date: Tue, 08 Jan 2002 13:10:21 +0100 Organization: OnLine Internet Lines: 32 Message-ID: <3C3AE1AD.30508@dev.null> References: <3C397FF1.20706@mportal.hu> <3C3AD7A0.9090304@dev.null> <3C3ADEA7.9090303@mportal.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.tudelft.nl User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.7+) Gecko/20020107 X-Accept-Language: en-us To: pgsql-sql@postgresql.org X-Archive-Number: 200201/138 X-Sequence-Number: 6226 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