Ever since the querset-refactor merge, params in the 'tables' argument
don't seem to be filled. The documentation describes the arguments
'params' and 'select_params' as being for where and select statements,
respectively. Do we need a "tables_params" argument as well?
Here's a code sample of where I'm using tables params (it's for full-
text searching in postgres):
> Ever since the querset-refactor merge, params in the 'tables' argument
> don't seem to be filled. The documentation describes the arguments
> 'params' and 'select_params' as being for where and select statements,
> respectively. Do we need a "tables_params" argument as well?
> Here's a code sample of where I'm using tables params (it's for full-
> text searching in postgres):
> The database engine usually can't fill that in anyways, you should
> probably quote it yourself (correct me if I'm wrong).
> On May 13, 9:15 am, Dave Lowe <dave.je...@gmail.com> wrote:
> > Ever since the querset-refactor merge, params in the 'tables' argument
> > don't seem to be filled. The documentation describes the arguments
> > 'params' and 'select_params' as being for where and select statements,
> > respectively. Do we need a "tables_params" argument as well?
> > Here's a code sample of where I'm using tables params (it's for full-
> > text searching in postgres):
Dave Lowe wrote: > It worked prior to qsrf-merge. I have tried adding the quotes though, > without success.
> On May 13, 9:59 am, David Cramer <dcra...@gmail.com> wrote: >> The database engine usually can't fill that in anyways, you should >> probably quote it yourself (correct me if I'm wrong).
>> On May 13, 9:15 am, Dave Lowe <dave.je...@gmail.com> wrote:
>>> Ever since the querset-refactor merge, params in the 'tables' argument >>> don't seem to be filled. The documentation describes the arguments >>> 'params' and 'select_params' as being for where and select statements, >>> respectively. Do we need a "tables_params" argument as well? >>> Here's a code sample of where I'm using tables params (it's for full- >>> text searching in postgres): >>> results = Product.objects.extra( >>> select={ >>> 'rank': "rank_cd(textsearchable, >>> query, 32)", >>> }, >>> tables=["to_tsquery(%s) as query"], >>> where=["textsearchable @@ query"], >>> params=[terms], >>> order_by=('-rank',) >>> ) >>> The error message by the way is: ProgrammingError: relation >>> "to_tsquery(2) as query" does not exist.
I've seen this too, also trying to do PgSQL FTS, and posted about it in django-users
it seems that two things are changed from pre-QSRF: params aren't processed for the 'tables=' argument, and the tables= arguments are quoted now, so you end up with something like
SELECT ... FROM "to_tsquery(%s) as query" ...
where before QSRF it would have executed
SELECT ... FROM to_tsquery('value of terms') as query ...
as a workaround, you can repeat the call to to_tsquery() and use select_params=, as in:
Don't know how big of a hit it is to have to call to_tsquery() multiple times even with the same args. But this isn't really just a fulltext search issue, it could come up with other PgSQL functions that are more heavyweight.
> Dave Lowe wrote:
> > It worked prior to qsrf-merge. I have tried adding the quotes though,
> > without success.
> > On May 13, 9:59 am, David Cramer <dcra...@gmail.com> wrote:
> >> The database engine usually can't fill that in anyways, you should
> >> probably quote it yourself (correct me if I'm wrong).
> >> On May 13, 9:15 am, Dave Lowe <dave.je...@gmail.com> wrote:
> >>> Ever since the querset-refactor merge, params in the 'tables' argument
> >>> don't seem to be filled. The documentation describes the arguments
> >>> 'params' and 'select_params' as being for where and select statements,
> >>> respectively. Do we need a "tables_params" argument as well?
> >>> Here's a code sample of where I'm using tables params (it's for full-
> >>> text searching in postgres):
> >>> results = Product.objects.extra(
> >>> select={
> >>> 'rank': "rank_cd(textsearchable,
> >>> query, 32)",
> >>> },
> >>> tables=["to_tsquery(%s) as query"],
> >>> where=["textsearchable @@ query"],
> >>> params=[terms],
> >>> order_by=('-rank',)
> >>> )
> >>> The error message by the way is: ProgrammingError: relation
> >>> "to_tsquery(2) as query" does not exist.
> I've seen this too, also trying to do PgSQL FTS, and posted about it in
> django-users
> it seems that two things are changed from pre-QSRF: params aren't
> processed for the 'tables=' argument, and the tables= arguments are
> quoted now, so you end up with something like
> SELECT ... FROM "to_tsquery(%s) as query" ...
> where before QSRF it would have executed
> SELECT ... FROM to_tsquery('value of terms') as query ...
> as a workaround, you can repeat the call to to_tsquery() and use
> select_params=, as in:
> Don't know how big of a hit it is to have to call to_tsquery() multiple
> times even with the same args. But this isn't really just a fulltext
> search issue, it could come up with other PgSQL functions that are more
> heavyweight.