Skip to content

Conversation

@KekmaTime
Copy link
Contributor

@KekmaTime KekmaTime commented Oct 30, 2025

Add support for SQLite's -> and ->> JSON extraction operators.

The -> operator extracts a JSON subcomponent and returns it as a TEXT JSON representation (always returns Json type, never Jsonb).

The ->> operator extracts a JSON subcomponent and returns it as an SQL TEXT value (unwrapped).

partially completes #4366

@KekmaTime
Copy link
Contributor Author

@weiznich CI is failing on deprecated Command::cargo_bin() in example tests (unrelated to my changes). The new cargo_bin! macro doesn't work with clippy. #[allow(deprecated)] also didn't help. How should I fix this example tests to pass CI?

@weiznich
Copy link
Member

@KekmaTime I've opened #4845 to address this. Let's merge that PR first and then just rebase this one on top.

@weiznich weiznich requested a review from a team October 31, 2025 17:04
@weiznich
Copy link
Member

Seems like this collides with the same operators as defined in the postgres backend if both backends are enabled. I think we should be able to workaround that by rather move the operators + the methods from the extension trait in a central location instead of duplicating them for both backend.

We would need to move:

__diesel_infix_operator!(
RetrieveAsObjectJson,
" -> ",
__diesel_internal_SameResultAsInput,
backend: Pg
);
infix_operator!(RetrieveAsTextJson, " ->> ", Text, backend: Pg);

To https://github.com/diesel-rs/diesel/blob/main/diesel/src/expression/operators.rs#L610

Also we need to move the trait methods to a new trait in a new json_trait_methods file here:

https://github.com/diesel-rs/diesel/tree/main/diesel/src/expression_methods

@KekmaTime
Copy link
Contributor Author

KekmaTime commented Nov 1, 2025

Ack, will update 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants