Skip to content

jsonb inserted incorrectly when used with slonik #5

Open
@random-string

Description

@random-string

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});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions