Skip site navigation (1) Skip section navigation (2)

functional indexes

From: Daniel Kalchev <daniel(at)digsys(dot)bg>
To: pgsql-hackers(at)hub(dot)org
Subject: functional indexes
Date: 1998-09-26 09:53:59
Message-ID: 199809260953.MAA06545@dcave.digsys.bg (view raw or flat)
Thread:
Lists: pgsql-hackers
With the current snapshot, there seems to be problem with functional indexes. 
Example:

CREATE TABLE timelog (loginname text, site varchar(16), start_time datetime, 
elapsed timespan);
CREATE FUNCTION datetime_day (datetime ) RETURNS float8 AS 'select 
date_part(''day'', $1)' LANGUAGE 'SQL';
INSERT INTO timelog values ('abc','varna','Thu 01 Jan 23:23:34 1998 EET','@ 10 
mins');
INSERT INTO timelog values ('abc','sofia','Thu 01 Jan 23:23:34 1998 EET','@ 2 
hours 10 mins');

$ psql test
Welcome to the POSTGRESQL interactive sql monitor:
  Please read the file COPYRIGHT for copyright terms of POSTGRESQL

   type \? for help on slash commands
   type \q to quit
   type \g or terminate with semicolon to execute query
 You are currently connected to the database: test

test=> create index timelog_date_idx on timelog (datetime_day(start_time));
ERROR:  DefineIndex: (null) class not found
test=> 

Also, using date_part() directly in the index definition:

test=> create index timelog_date_idx on timelog (datetime_part('day', 
start_time));
ERROR:  parser: parse error at or near "'"


Can something be done about this before 6.4 is released?

Daniel



Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 1998-09-26 21:18:07
Subject: NOTIFY interlock broken (was Yipes, I'm getting bit by duplicate tuples)
Previous:From: Nick BastinDate: 1998-09-26 01:07:43
Subject: Re: [HACKERS] How to destroy your entire Postgres installation

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group