Skip to content

Use of unqualified "id" column in _create_model_filter #308

Description

@ercpe

https://github.com/etianen/django-watson/blob/master/watson/search.py#L568 creates a unqualified Cast for the primary key column, which fails if the QuerySet has JOINs (e.g. because it's already filtered):

SELECT ("id"::text) AS "watson_pk_str"
FROM "model_a_table" U0 
INNER JOIN "model_b_table" U1 ON (U0."foo_id" = U1."id") 
WHERE U1."bar" = 20

The Cast should use U0.id as the column selector.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions