Skip to content

Commit 45ff23b

Browse files
ben-ebflovilmart
authored andcommitted
postgres: Ensure that setting a value to undefined is a no-op on writes. (#5065) (#5069)
1 parent 4b5fb84 commit 45ff23b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1442,7 +1442,10 @@ export class PostgresStorageAdapter implements StorageAdapter {
14421442

14431443
for (const fieldName in update) {
14441444
const fieldValue = update[fieldName];
1445-
if (fieldValue === null) {
1445+
// Drop any undefined values.
1446+
if (typeof fieldValue === 'undefined') {
1447+
delete update[fieldName];
1448+
} else if (fieldValue === null) {
14461449
updatePatterns.push(`$${index}:name = NULL`);
14471450
values.push(fieldName);
14481451
index += 1;

0 commit comments

Comments
 (0)