Skip to content

Error when applying migration that creates a GIST index on a CIDR type #676

@EricStG

Description

@EricStG

I have an entity with a property of ValueTuple<IPAddress, int> type:

public class Entity
{
    public int Id { get; set; }
    public (IPAddress address, int subnet) Network { get; set; }
}

And in the model builder, I create an index using the GIST type on Network:

entity.HasIndex(e => e.Network)
    .HasName("Entity")
    .ForNpgsqlHasMethod("gist");

Generating the migration works, but executing it, I get the following:

42704: data type cidr has no default operator class for access method "gist"

Essentially, I would like to be able to pass inet_iops when creating the index in order to generate a statement similar to:

CREATE  INDEX "Entity_Network_key"
    ON "Entity" USING GIST
    ("Network" inet_ops)

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