Skip to content

Using NumericRange with IntegerRangeField generates invalid SQL with latest psycopg #209

@vbabiy

Description

@vbabiy

If you have a serializer like this with a IntegerRangeField

class StuffSerializer(serializers.ModelSerializer):
    numbers = IntegerRangeField(
        default=NumericRange(lower=0, upper=86400),
        required=False,
        allow_null=True,
    )

At creation time it will create a query that has a double cast '(,)'::numrange::int4range

This happens because NumericRange is casted by the psycopq transformer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions