Skip to content

fix(pg / neon/ PS): Do not parse JSON - send it directly to engines#24269

Merged
SevInf merged 4 commits intomainfrom
fix/bigint-conversion
May 29, 2024
Merged

fix(pg / neon/ PS): Do not parse JSON - send it directly to engines#24269
SevInf merged 4 commits intomainfrom
fix/bigint-conversion

Conversation

@Druue
Copy link
Copy Markdown
Contributor

@Druue Druue commented May 23, 2024

We ran into an issue where the handling for JSON parsing was inconsistent for bigints nested inside of JSON relations:

This is the result of a native PG query. Note how the outer value is a string as expected but the inner is a number which would yield conversion errors
image

As we now send handle JSON parsing in engines, rust is fully capable of handling i64 values and can therefore parse it correctly leading to correct bigint values

{
  id: 'a0eeea10-7911-4af2-0000-01400b5718d2',
  intId: 1374511782084n,
  user: {
    id: 'a0eeea10-7911-4af2-0000-01400b5718d2',
    intId: 1374511782084n,
    name: 'Christopher Addison'
  }
}

fix #23926
related prisma/prisma-engines#4883

Note to be aware of:

  • If we end up supporting further driver adapters in the future that support JSON but do not allow for custom type parsing as PG, Neon, and PS do, we may run into issues

@Druue Druue requested a review from a team as a code owner May 23, 2024 14:01
@Druue Druue requested review from jkomyno and removed request for a team May 23, 2024 14:01
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented May 23, 2024

size-limit report 📦

Path Size
packages/client/runtime/library.js 179.82 KB (0%)
packages/client/runtime/library.d.ts 81 B (0%)
packages/client/runtime/binary.js 600.89 KB (0%)
packages/client/runtime/binary.d.ts 26 B (0%)
packages/client/runtime/edge.js 159.02 KB (0%)
packages/client/runtime/edge-esm.js 158.91 KB (0%)
packages/client/runtime/wasm.js 114.9 KB (0%)
packages/client/runtime/index-browser.js 33.77 KB (0%)
packages/client/runtime/index-browser.d.ts 89 B (0%)
packages/cli/build/index.js 2.09 MB (-0.01% 🔽)
packages/client/prisma-client-0.0.0.tgz 2.93 MB (-0.15% 🔽)
packages/cli/prisma-0.0.0.tgz 3.73 MB (-0.12% 🔽)
packages/bundle-size/da-workers-libsql/output.tgz 857.86 KB (+0.02% 🔺)
packages/bundle-size/da-workers-neon/output.tgz 934.79 KB (+0.04% 🔺)
packages/bundle-size/da-workers-pg/output.tgz 953.37 KB (+0.04% 🔺)
packages/bundle-size/da-workers-pg-worker/output.tgz 909.08 KB (+0.04% 🔺)
packages/bundle-size/da-workers-planetscale/output.tgz 870.85 KB (+0.02% 🔺)
packages/bundle-size/da-workers-d1/output.tgz 830.92 KB (+0.02% 🔺)

@Druue Druue added this to the 5.15.0 milestone May 23, 2024
@Druue Druue requested review from SevInf and Weakky and removed request for jkomyno May 23, 2024 14:32
Copy link
Copy Markdown
Contributor

@SevInf SevInf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, when engine update makes it into the repo and we see green tests

SevInf added a commit to prisma/prisma-engines that referenced this pull request May 24, 2024
…an correctly handle `i64`s (#4883)"

This reverts commit f742678.

Temporary reverting the change. It is interdependent with
prisma/prisma#24269 and neither PR works correctly without the other.
The plan was to let engines CI to temporarily go red and fix it
immediately by merging client PR. However, engine release pipeline is
broken for unrelated reason and this is not possible. Just to limit
amount of broken things in progress, we are reverting original PR. It is
expected we restore it with no changes once release pipeline is fixed.
SevInf added a commit to prisma/prisma-engines that referenced this pull request May 24, 2024
…an correctly handle `i64`s (#4883)" (#4886)

This reverts commit f742678.

Temporary reverting the change. It is interdependent with
prisma/prisma#24269 and neither PR works correctly without the other.
The plan was to let engines CI to temporarily go red and fix it
immediately by merging client PR. However, engine release pipeline is
broken for unrelated reason and this is not possible. Just to limit
amount of broken things in progress, we are reverting original PR. It is
expected we restore it with no changes once release pipeline is fixed.
@SevInf SevInf force-pushed the fix/bigint-conversion branch from f3019f5 to f5ef2b4 Compare May 29, 2024 08:40
@SevInf SevInf force-pushed the fix/bigint-conversion branch from f5ef2b4 to d0c7135 Compare May 29, 2024 11:23
@SevInf
Copy link
Copy Markdown
Contributor

SevInf commented May 29, 2024

Should be good to merge once green

@SevInf SevInf merged commit 8085a02 into main May 29, 2024
@SevInf SevInf deleted the fix/bigint-conversion branch May 29, 2024 12:18
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.

Inconsistent column data: Unexpected conversion failure from Number to BigInt error when using @prisma/adapter-pg

2 participants