我想知道如何将“bytea”格式的图片插入到我的PostgreSQL数据库表中。我已经在论坛上搜索了几个小时,看到了同样的问题被发布了数十次,但是还没有找到一个答案。我只看到如何将.jpeg文件插入到旧列中,这不是我所需要的。
这是数据库表格:
create table category (
"id_category" SERIAL,
"category_name" TEXT,
"category_image" bytea,
constraint id_cat_pkey primary key ("id_category"))without oids;
当我添加新行时,它不能正常工作:
insert into category(category_name,category_image) values('tablette', lo_import('D:\image.jpg'));