Skip to content
This repository was archived by the owner on Apr 25, 2023. It is now read-only.
This repository was archived by the owner on Apr 25, 2023. It is now read-only.

Can't deserialize some Postgres types #64

Closed

Description

@kyleu

When querying certain postgres types, quaint throws Error querying the database: error deserializing column N: cannot convert between the Rust type `core::option::Option<alloc::string::String>` and the Postgres type `XXX` , where XXX is one of:

  • money
  • date
  • time
  • timetz*
  • timestamptz
  • interval*
  • xml*
  • bytea
  • bit varying
  • cidr*
  • inet*
  • macaddr
  • point
  • box*
  • circle*
  • path*
  • polygon*
  • tsquery*
  • tsvector*

*: not fully supported by tokio-postgres

Some of these types are pretty obscure (though I do use them all), but some like "timestamptz" are fairly common. The type json is an odd one, since you've already got a variant for Json in ParameterizedValue, but it doesn't seem to work

It would be fine if values of unsupported types were returned as a string, users can transform them to the proper types in client code

Activity

  1. pimeys commented on Jan 18, 2020

    @pimeys
    Contributor

    You can support support JSON by enabling the json-1 type in your Cargo.toml. For other types I'm more than happy to get a pull request. We might not need them in Prisma, but they should be quite easy to add in https://github.com/prisma/quaint/blob/master/src/connector/postgres/conversion.rs

  2. pimeys commented on Jan 18, 2020

    @pimeys
    Contributor

    Wait, actually we miss one thing to make that happen.

  3. pimeys commented on Jan 18, 2020

    @pimeys
    Contributor

    This should fix the json deserializing b9d6dcd

    In a similar manner we could add support for other types, following the list in the postgres documentation. https://docs.rs/tokio-postgres/0.5.1/tokio_postgres/types/struct.Type.html

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