Jie Liang <[EMAIL PROTECTED]> writes:
>      v_url:= $1||''%'';                
>      for rec in select id,url from urlinfo where url like v_url order by
> url loop

[ is slow ]

LIKE index optimization doesn't happen if the LIKE pattern is a variable
when the plan is created.

In 7.1 you can work around this problem by using plpgsql's FOR ... EXECUTE
notation, but I don't think there's any good answer in 7.0.

for rec in execute ''select id,url from urlinfo where url like 
''||quote_literal(v_url)||'' order by url'' loop

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl

Reply via email to