Skip to content

Cannot use jiff-sqlx with SQLx's query! and query_as! macros #272

@BurntSushi

Description

@BurntSushi

I attempted to migrate one of my projects from chrono to jiff using the jiff-sqlx crate, but it appears that jiff-sqlx is not compatible with the query! and query_as! macros which are used for static type checking of SQL queries (not to be confused with the query and query_as functions).

I've created a minimal reproducer here: https://github.com/tonyfinn/jiff-sqlx-poc/tree/main

but the gist is that if you don't enable any of the other time crates then a crate using sqlx fails to build as it there is no From<()> implementation for the jiff_sqlx types, and tells you you need to enable the time feature to use the TIMESTAMPTZ type (example error output) and if you do enable the other time crates then it complains that e.g. time::OffsetDateTime and jiff_sqlx::Timestamp are not the same type.

(Let me know if you want me to file this as a seperate issue, just keeping it with the existing sqlx discussion as its newly implemented)

I suspect this will require changes inside sqlx to make it work

Originally posted by @tonyfinn in #240 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions