Skip to content

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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