gajus / gajus/postgres-bridge

jsonb inserted incorrectly when used with slonik

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
28
Forks
3
PR merge metrics
No merged PRs in 30d

Description

The following query inserts a JSON object to a table with a JSONB column.

```
UPDATE public.property_history
SET attributes = ${sql.jsonb(attributes ?? null)}, status = ${status}
WHERE id = ${id}
```

When utilizing slonik using
```
await createPool(pgConnString!, {typeParsers});
```

it inserts correctly as an object.

However the same query inserts the object as a stringified string when using:
```
const PgPool = createPostgresBridge(postgres);
await createPool(pgConnString!, {PgPool, typeParsers});
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.