On Jan 12, 7:44 pm, Joe Van Dyk <[email protected]> wrote:
> I have a postgresql function that takes a couple arguments and returns
> a table.
>
> How can I query this function with postgresql without having to use
> raw sql? (i.e. I'd want to put a limit on the rows returned)
>
> This is what I'm doing now, and it's obviously terrible.
>
>     query = "select * from
> search_active_line_items('#{search_term}'::text, ……..)"
>     if limit
>       query << " limit #{ limit }"
>     end
>     DB[query]

DB.from(:search_active_line_items.sql_function(search_term.cast(String), 
...)).limit(limit)

I don't think this is a very common use case, which is why #from
doesn't currently take a virtual row block.  I'd be open to changing
that, though.

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" 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/sequel-talk?hl=en.

Reply via email to