Re: parse error in create index

From: palme(at)uni-wuppertal(dot)de (Hubert Palme)
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: Hubert Palme <palme(at)uni-wuppertal(dot)de>, pgsql-sql(at)postgresql(dot)org
Subject: Re: parse error in create index
Date: 2001-02-08 22:39:11
Message-ID: 14979.8207.255434.213797@palme-pc.urz.Uni-Wuppertal.DE
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Stephan Szabo wrote:
>
> Functional indexes cannot currently take constant values to the function,
> so it's complaining about the constant 'month'. The current workaround is
> probably to create a function that does the date_part('month', <arg>) for
> you and then use that function in the index creation.

Hmm... Perhaps, it's better I post to the novice group, because I'm new
to SQL.

Anyway -- That's my trial:

adressen=> CREATE FUNCTION geb_monat (date) RETURNS integer AS
adressen-> 'SELECT date_part('month', $1)::integer;'
adressen-> LANGUAGE 'sql';
ERROR: parser: parse error at or near "month"

The point are the nested strings, I guess. How can I render a "'" in an
SQL string?

Thanks for your help!

--
Hubert Palme
palme(at)uni-wuppertal(dot)de

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2001-02-08 22:56:52 Re: parse error in create index
Previous Message Hubert Palme 2001-02-08 22:29:31 Re: parse error in create index