Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to the new SQL/JSON PG17 JSON_VALUE/JSON_QUERY functions #3304

Open
roji opened this issue Sep 28, 2024 · 2 comments · May be fixed by #3490
Open

Switch to the new SQL/JSON PG17 JSON_VALUE/JSON_QUERY functions #3304

roji opened this issue Sep 28, 2024 · 2 comments · May be fixed by #3490
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@roji
Copy link
Member

roji commented Sep 28, 2024

PG17 introduced support for the standardized SQL/JSON functions, specifically JSON_VALUE() and JSON_QUERY() - we should consider switching to those when the compatibility mode is set to PG17. One notable advantage is that e.g. JSON_VALUE() allows specifying the return type; we currently use the -> operator and wrap the result in a cast, which may be less efficient and also doesn't support JSON-specific conversions (for example, getting a binary out of JSON is likely to do base64 decoding automatically, without us having to manually take care of it).

Another possibility is to switch from jsonb_to_recordset to the new JSON_TABLE().

@roji
Copy link
Member Author

roji commented Mar 5, 2025

SQL Server will be introducing support for the same RETURNING clause (which is part of the ANSI SQL standard), the EF-side tracking issue is dotnet/efcore#35729. Implement this in EF's relational layer, to support both SQL Server and PG at the same time.

@roji roji changed the title Switch to the new SQL/JSON PG17 JSON functions Switch to the new SQL/JSON PG17 JSON_VALUE/JSON_QUERY functions Mar 6, 2025
roji added a commit to roji/efcore.pg that referenced this issue Mar 6, 2025
@roji roji linked a pull request Mar 6, 2025 that will close this issue
roji added a commit to roji/efcore.pg that referenced this issue Mar 6, 2025
@roji
Copy link
Member Author

roji commented Mar 6, 2025

Possibly looking at JSON_TABLE() is tracked by #3491.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant