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

5.7.x #4587

Closed
wants to merge 4 commits into from
Closed

5.7.x #4587

wants to merge 4 commits into from

Conversation

Weakky
Copy link
Contributor

@Weakky Weakky commented Dec 18, 2023

No description provided.

aqrln and others added 4 commits December 18, 2023 15:05
…4547)

Currently we coerce database NULL values to empty scalar lists in the
regular code path that converts quaint values to `PrismaValue`s, but
this was missing in the new code path that converts the results of JSON
aggregation to `PrismaValue`s when using `relationJoins` preview feature.

Fixes: prisma/prisma#22303
Functions in PostgreSQL can only accept up to 100 arguments, which means that we can't build an object with more than 50 fields using `JSON_BUILD_OBJECT`. To work around that, we chunk the fields into subsets of 50 fields or less, build one or more JSONB objects using one or more `JSONB_BUILD_OBJECT` invocations, and merge them together using the `||` operator (which is not possible with plain JSON).

Another alternative that was considered and prototyped first was using `ROW_TO_JSON` but it turned out to not be a suitable replacement for several reasons, the final deal breaker [being the limit of the length of field names](hasura/graphql-engine#4004 (comment)) (63 characters). Other problems included the lack of support for `ROW_TO_JSON` on MySQL, which would have required us to have conditional logic in the query builder on the `sql-query-connector` level, which would introduce logic dependent on connector capabilities at an inappropriate abstraction layer, and difficulties in building the query compatible with `ROW_TO_JSON` without overfetching data because we would need to select additional fields (e.g. for filtering and order by) to be able to forward them to a query above without an easy way to exclude them from being added to the JSON object.

The workaround with JSONB doesn't suffer from these issues, and is completely isolated on the quaint level without leaking to the query engine.


Fixes: prisma/prisma#22298
Closes: #4550
@Weakky Weakky requested a review from a team as a code owner December 18, 2023 17:31
@Weakky Weakky requested review from laplab and jkomyno and removed request for a team December 18, 2023 17:31
@Weakky Weakky closed this Dec 18, 2023
Copy link

codspeed-hq bot commented Dec 18, 2023

CodSpeed Performance Report

Merging #4587 will not alter performance

⚠️ No base runs were found

Falling back to comparing 5.7.x (0ca5ccb) with main (c16f468)

Summary

✅ 11 untouched benchmarks

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

Successfully merging this pull request may close these issues.

2 participants