oguimbal / pg-mem

An in memory postgres DB instance for your unit tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bytea uses utf8 instead of hex

sangaman opened this issue · comments

Describe the bug

Pg-mem returns bytea types with utf8 encoding, when it should use hex encoding, as per https://www.postgresql.org/docs/current/datatype-binary.html

I think the offending code is here: https://github.com/oguimbal/pg-mem/blob/master/src/datatypes/datatypes.ts#L218 - it's calling bufToString which returns a utf8 encoded string.

To Reproduce

Query data from a bytea field.

pg-mem version

2.6.13