Skip to content

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

@nguiard

Description

@nguiard

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...

Metadata

Metadata

Assignees

No one assigned

    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