Re: parse error in create index - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: parse error in create index
Date
Msg-id Pine.BSF.4.21.0102081456090.55852-100000@megazone23.bigpanda.com
Whole thread Raw
In response to parse error in create index  (Hubert Palme <palme@uni-wuppertal.de>)
List pgsql-sql
You can use two quote characters to get a single quote in the quoted
string, so ''month''

On Thu, 8 Feb 2001, Hubert Palme wrote:

> 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!



pgsql-sql by date:

Previous
From: Jelle Ouwerkerk
Date:
Subject: fetching the id of a new row
Next
From: "Kim Yunhan"
Date:
Subject: Index Problem