Sunday, January 17, 2021

In postgresql, ExpressionWrapper and DurationField does not work.

Hi.

I used mariadb and have migrated into postgresql 12 now.
One of source code generates an error on postgresql.

... Q(active_at__lt=now()- ExpressionWrapper(F('configuration__interval') * 1.5 * 1000000 * 60, output_field=DurationField()))) ...

is compile as : str(queryset.query)

"active_at" IS NULL OR "device"."active_at" < ((2021-01-18 02:06:57.738175+00:00 - ((("confirugation"."interval" * 1.5) * ....

And in postgres error log :
U0."active_at" < (('2021-01-18T02:24:04.962734+00:00'::timestamptz - (((U1."wakeup_interval" * 1.5) * 1000000) * 60)))))))

"Interval" keyword is missed in front of (((U1."wakeup_interval".... .

Python 3.7.9, django 2.2.14, psycopg2 2.8.6.

How can I this ORM make use to 'interval' keyword?

Thanks.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1092c23f-52e5-4c74-ba0c-647b19eeb067n%40googlegroups.com.

No comments:

Post a Comment