#36934 new Bug

BuiltinLookup breaks with params-as-a-tuple in django 6.0

Reported by: Stefan Bühler Owned by:
Component: Database layer (models, ORM) Version: 6.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

BuiltinLookup violates the new policy and returns a list of params from process_lhs and expects a list in as_sql (uses .extend).

Lookup classes that inherit from (or mixed into) BuiltinLookup and overwrite process_lhs in a way that doesn't return a list of params (e.g. calling Col.as_sql through compiler.compile(self.lhs) are broken.

Example: django-netfields: https://github.com/jimfunk/django-postgresql-netfields/blob/f7529f2c97995dbc5b27ea7abcf0f2966269fd96/netfields/lookups.py#L27-L59

The new policy: https://docs.djangoproject.com/en/6.0/releases/6.0/#custom-orm-expressions-should-return-params-as-a-tuple

https://github.com/django/django/pull/20005 looks like it should fix this, and should be packported.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top