django-snowflake icon indicating copy to clipboard operation
django-snowflake copied to clipboard

Add support for interval math with NULL

Open timgraham opened this issue 3 years ago • 0 comments

A queryset like:

Experiment.objects.annotate(shifted=ExpressionWrapper(
    F('completed') - Value(None, output_field=DurationField()),
    output_field=DateField(),
))

generates

SELECT ("experiment"."completed" - INTERVAL 'NULL MICROSECONDS') AS "shifted" FROM "experiment"

which fails with syntax error line 1 at position 0 unexpected 'NULL'.

On other databases, interval math with a null interval results in NULL. Perhaps this could be fixed in Snowflake.

timgraham avatar Nov 25 '21 00:11 timgraham