SOLVED: How can I manually insert a .png or .jpeg file into bytea column in PostgreSQL?

I'm currently using PostgreSQL 4.38 on Windows 10, I'm trying to insert an image (.png file) manually into bytea column in PostgreSQL, but upon executing the data, it says that invalid input syntax for type bytea. What should be the right procedure to insert an image manually in bytea column in PostgreSQL?

The error I am getting is

ERROR:  invalid input syntax for type bytea
LINE 3: ...yn', 'Lyn', '123456', '234567', '[email protected]', 'D:\Minton...
                                                             ^
SQL state: 22P02
Character: 373

Solution 1:

Problem solved :)

pg_read_binary_file('D:\Folder\Folder\FileName_.png')::bytea,

That requires either superuser privileges or membership in the pg_read_server_files system role.