471,306 Members | 839 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,306 software developers and data experts.

Problem with create index



Hmmm... am i doing anything really silly?

tradein_clients=# CREATE INDEX profile_master2 on profile_master (lower( btrim(email) ) );
ERROR: parser: parse error at or near "(" at character 61
tradein_clients=#
Regds
mallah.

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #1
2 1588
On Tue, 11 Nov 2003, Rajesh Kumar Mallah wrote:
Hmmm... am i doing anything really silly?
Functional indexes on 7.3 and earlier only allow a function over one or
more columns (which would disallow the below as a function over a function
over a column). The usual workaround would be to make an immutable
function that does both functions on its argument something like:

create function lower_btrim(text) returns text as 'select
lower(btrim($1));' language 'sql' immutable;
create index profile_master2 on profile_master(lower_btrim(email));

In 7.4 I believe the below should work.
tradein_clients=# CREATE INDEX profile_master2 on profile_master (lower( btrim(email) ) );
ERROR: parser: parse error at or near "(" at character 61


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #2
On Tuesday 11 Nov 2003 2:00 pm, Stephan Szabo wrote:
On Tue, 11 Nov 2003, Rajesh Kumar Mallah wrote:
Hmmm... am i doing anything really silly?
Functional indexes on 7.3 and earlier only allow a function over one or
more columns (which would disallow the below as a function over a function
over a column). The usual workaround would be to make an immutable
function that does both functions on its argument something like:

create function lower_btrim(text) returns text as 'select
lower(btrim($1));' language 'sql' immutable;
create index profile_master2 on profile_master(lower_btrim(email));

Thanks for the work around


In 7.4 I believe the below should work.
tradein_clients=# CREATE INDEX profile_master2 on profile_master (lower(
btrim(email) ) ); ERROR: parser: parse error at or near "(" at character
61


Yes it does work

template1=# CREATE INDEX profile_master2 on t_a(lower(btrim(email)));
CREATE INDEX
template1=#
template1=# CREATE unique INDEX profile_master3 on t_a(lower(btrim(email)));
CREATE INDEX
template1=#
Regds
Mallah.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Guy Deprez | last post: by
6 posts views Thread by Rajesh Kumar Mallah | last post: by
4 posts views Thread by Fan Ruo Xin | last post: by
4 posts views Thread by Jagdip Singh | last post: by
20 posts views Thread by Development - multi.art.studio | last post: by
7 posts views Thread by Salvador | last post: by
reply views Thread by Spacen Jasset | last post: by
4 posts views Thread by Laurence Breeze | last post: by
3 posts views Thread by mearvk | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.