From 2e4339691ac0f6960b4f67e2408aa9eb33f47cae Mon Sep 17 00:00:00 2001 From: ales-albert-kilbergr <79090159+ales-albert-kilbergr@users.noreply.github.com> Date: Sat, 1 Apr 2023 17:43:37 +0200 Subject: [PATCH] Fix: deal with bigint types in objects stored as jsonb Currently a pg library fails when processing objects for jsonb columns which contains bigints because JSON.stringify by default does not know how to deal with it. --- packages/pg/lib/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pg/lib/utils.js b/packages/pg/lib/utils.js index d63fe68f1..47823a306 100644 --- a/packages/pg/lib/utils.js +++ b/packages/pg/lib/utils.js @@ -78,7 +78,7 @@ function prepareObject(val, seen) { return prepareValue(val.toPostgres(prepareValue), seen) } - return JSON.stringify(val) + return JSON.stringify(val, (_, val) => typeof val === 'bigint' ? val.toString() : val) } function pad(number, digits) {