I am totally new to Postgres and I have created a database using pgAdmin4. I would like to ask if it is possible to add a column to my table that contains images.
I am totally new to Postgres and I have created a database using pgAdmin4. I would like to ask if it is possible to add a column to my table that contains images.
Short answer:
You can create table with column type as bytea.
Using:
insert into images(image_name, image_raw) values('image.png', bytea('D:\image.jpg'));
Long answer: Storing Images in DB - Yea or Nay?
Tip: don't save images in the database, save them on the filesystem and save the path of the image in the database in a text column.
However, if you must save an image you should use bytea column (similar to BLOB in other databases). Use the following command to add a bytea column to an existing table:
alter table_name add column column_name bytea;