Steve,
> BTW, I tried to create an index on the to_char function and had no
> luck -
> seems like it should work but it doesn't on 7.2.3 or 7.3.1.
That's because functional indexes can't take any arguments other than
column names. Therefore you'd need to:
CREATE FUNCTION to_year (timestamp) RETURNS varchar AS
'SELECT to_char($1, ''YYYY'');'
LANGUAGE 'sql' WITH (ISCACHABLE, ISSTRICT)
(above is 7.2.3 syntax)
Then use the to_year function in place of to_char for creating your
index.
-Josh Berkus