On Mar 5, 6:08 pm, weheh <[email protected]> wrote:
> Mr. Freeze's code says ...
>
>     q = request.vars.q
>     f = request.vars.field
>     t = request.vars.table
>     rows = db(db[t][f].like(q+"%")).select(db[t]
> [f],distinct=True,orderby=db[t][f])

Have you checked what this generates:

db(db[t][f].like(q+"%"))._select(db[t][f],distinct=True,orderby=db[t]
[f])


>
> The problem is this works with sqlite but not with postgresql.

Look to see if the generated SQL makes any sense, looks right - and
(finally) if you can use that expression directly in postgres to see
if you can get postgres to give you more hints.

But _I'll_ give you a hint:   this seems to work fine when I copy your
example code (above) into my test PyCon registration setup (postgres),
and search for email addresses from (say) gmail...

I suggest starting with looking at the generated SQL string from DAL -
I suspect this will show your problem to be in the q/f/t  strings
themselves.

sqlite is a bit loose w/ SQL statements, so that's not generally a
great test (things working, or not working on SQLITE).

Regards,
- Yarko

> Yarko,
> I'd read the postgreql doc before and not sure it sheds any additional
> light on the matter, or does it? Maybe I'm not understanding it. But
> it seems "like" is supported. So the question is why isn't it working
> with web2py? I don't see anything wrong with Freeze's code.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to