Search code examples
rustrust-diesel

Does Diesel support the Postgres `point` type?


I'd like to use the point Postgres type. I don't see this type listed here in the types list for Diesel.

What is the correct way to write a model that includes a point column?


Solution

  • Based on this Diesel GitHub issue and the types available in diesel::pg::types and diesel::types, there doesn't seem to be any support for these types.

    To write a model that includes a point column, you would need to make point a value Diesel can understand. This starts by implementing the FromSql trait for a Point type and then implementing all the things needed for that. For such an extension, look at this PR.