Jeff Davis <jdavis-pgsql@empires.org> writes:
> In this case you just have a syntax error in your function. You have
> tried to use a single-quoted string inside of a single-quoted string.
> Escape the single quotes by writing "''" instead of "'" inside the
> function definition.
BTW, if you were working in a more recent version of Postgres, you
wouldn't need the wrapper function in the first place. This works
fine in 7.4 and later:
regression=# create table foo(f1 date);
CREATE TABLE
regression=# create index fooi on foo(date_part('month', f1));
CREATE INDEX
regression=#
regards, tom lane