JuliaDatabases / LibPQ.jl

A Julia wrapper for libpq
MIT License
217 stars 51 forks source link

Can't store Vector{UInt8} as expected in bytea #285

Open nguiard opened 11 months ago

nguiard commented 11 months ago

Hi, I'm trying to store a Vector{UInt8} in a bytea column but am getting unexpected results. Maybe you have an idea of what I'm doing wrong or if this is a bug?

create database test;
create table data (
    id      int8    primary key generated always as identity,
    content bytea   not null
);
using LibPQ
c = LibPQ.Connection("dbname=test host=/var/run/postgresql")
tostore = Vector{UInt8}([1,2,3,4])
execute(c, "insert into data (content) values (\$1)", [tostore])

When doing select * from data;, I then expect the content column to print \x01020304, but it shows \x7b312c322c332c347d, and I'm a little bit lost as to why that happens...