'How to use postgreSQL to display an Image to SAP Crystal Reports through a table

First off, allow me to state that I'm new to this software and extremely inexperienced in it. I have been working whenever possible to try and find online solutions that will allow me to add an image to a postgreSQL table. This image in turn, I want to have displayed on SAP Crystal Reports. However, I haven't found any solutions to my specific problem.

As of currently, I have two tables. One that has a users information ( first_name, last_name, id, and years_of_experience ). The other table I want to hold the users photo ( id, image??? ). This is so I can have a table with photos and a table with personal information and have them combine where the id is the same.

For most online solutions I have seen people using the bytea data type in a table, however, whenever I try to implement it, it decides to throw an error.

In the following code:

  • "id" is an int
  • "image" is a bytea
INSERT INTO bethany VALUES ( id, img )
     VALUES ( 100617, lo_import('C:\Users\user\Desktop\100617.jpg') );

ERROR: column "img" is of type bytea but expression is of type oid LINE 2: 100617, lo_import('C:\Users\user\Desktop\100617.jpg'));

HINT: You will need to rewrite or cast the expression.

Any information more experienced people can provide would be greatly appreciated. Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source