-
-
Notifications
You must be signed in to change notification settings - Fork 32k
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
Fixed #35778 -- Used JSON_OBJECT database function on PostgreSQL 16+ with server-side bindings. #18622
Fixed #35778 -- Used JSON_OBJECT database function on PostgreSQL 16+ with server-side bindings. #18622
Conversation
I went ahead and marked this as ready for review, just so it has higher visibility. I believe my changes do exactly what they are supposed to do, but I'm open to additional discussion/brainstorming. A little meta discussion There's not a particular reason that we need to prefer using JSON_OBJECT over JSONB_BUILD_OBJECT at this time. We have to support both because of the supported Postgres versions. I presume the reason this was even pursued in the first place is so that when Postgres 16 support is dropped, this function could be simplified. However, that's scheduled for 2027, so we've got a tiny bit of time. |
277a647
to
5075141
Compare
Rebased. I ran the tests locally and they all succeeded, but that's just my specific config. Pushed to run through test suite again. |
@charettes @felixxm Would any/both of you be keen to do an initial review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nessita the patch LGTM, not entirely convinced a release note is warranted given how recent the function is that it's most likely not used in an expression index at this point.
5075141
to
d26eff1
Compare
buildbot, test on oracle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @john-parton 👍
737c75a
to
65156c6
Compare
…with server-side bindings.
65156c6
to
fd26bfa
Compare
buildbot, test on oracle. |
Fixed #35778 -- Use native JSON_OBJECT on postgres 16+ with server-side binding.
Trac ticket number
https://code.djangoproject.com/ticket/35778#ticket
Branch description
In a prior version of Django, there was an attempt to use the
JSON_OBJECT
function on postgres 16+ with server side bindings, but it didn't work because keys must be cast to text. This change makes it so that keys are always cast to text when using postgres. It also wraps the keys in parenthesis on all backends to remove a parsing error while using::
to cast within the context of the json_object function which uses:
to separate keys.Checklist
main
branch.