Skip to content

Ability to use sqlx without serde (and potentially syn) #4070

@CathalMullan

Description

@CathalMullan

I have found these related issues/pull requests

No directly related issues.

Description

Currently, sqlx always depends on serde.

It's pulled in mainly through the "offline" sqlx-core capability, which is not exposed as a feature at the sqlx level.

For sqlx-postgres, it's also used to handle parsing JSON query plans, in order to mark columns as nullable.

If serde was to becomes optional, it would then be relatively simple to make a syn free build too.

The only additional changes needed would be removing use of thiserror, and disabling the "attributes" tracing feature (which is unused anyways).

From my quick proof of concept, this would result in the compile time of a minimal build of sqlx (runtime-smol,postgres,migrate) dropping from 21s to 16s.

Prefered solution

Expose "offline" as a feature (enabled by default) for sqlx, allowing for it to be disabled.

Move the nullable columns logic in sqlx-postgres to the DB instead, removing the need to parse any query plans on the library side.

Only depend on serde through relevant features. (offline, json, ...)

And optionally remove use of thiserror, tracing/attributes.

Is this a breaking change? Why or why not?

Yes, this would be a breaking change, due to moving "offline" to be a sqlx feature again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions