Re: indexing date_part

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <jdavis-pgsql(at)empires(dot)org>
Cc: DEV <dev(at)umpa-us(dot)com>, PgSQL General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: indexing date_part
Date: 2005-02-28 21:05:11
Message-ID: 26002.1109624711@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeff Davis <jdavis-pgsql(at)empires(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Shachar Shemesh 2005-02-28 21:09:38 Re: Unicode support on Win32
Previous Message Markus Wollny 2005-02-28 21:00:32 Re: Problems with pgcrypto and special characters