1

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', 'lone@gmail.com', 'D:\Minton...
                                                             ^
SQL state: 22P02
Character: 373
Nimantha
  • 6,405
  • 6
  • 28
  • 69

1 Answers1

2

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.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263