Skip to content

Inserting Buffer / ArrayBuffer values for BYTEA fields are corrupt under HTTP client #118

Closed
@andyjy

Description

@andyjy

Inserting binary data by passing a Buffer or ArrayBuffer value works fine under the webhook client (handled by the underlying pg implementation), but is unimplemented under the http client and silently breaks, instead inserting corrupted values representing the result of causing JSON.stringify() on the Buffer value.

Steps to reproduce

CREATE TABLE example (
    binary_data BYTEA
);
const sql = neon(DATABASE_URL);
await sql`INSERT INTO example VALUES (${Buffer.from('test')})`

Expected result

SELECT CONVERT_FROM(binary_data, 'utf8') FROM example;
> 'test'

Actual result

SELECT CONVERT_FROM(binary_data, 'utf8') FROM example;
> '{"data":[xx, xx, xx...],"format":"Buffer"}'

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions