Answer the question
In order to leave comments, you need to log in
How to insert bytecode into PostgreSQL?
I am writing a server on Heroku with PostgreSQL.
I want to store an image in a table so that I can send it and save it in the sqlite database in the Android phone (in the sqlite database I specified the blob type).
For a photo in postgresql, I specified the data type bytea.
But after writing the request, an error occurs:
ERROR: invalid input syntax for type bytea
The request itself:
insert into table(name, img) values('toy', bytea('C:\Users\anya\Desktop\games\robot.png'))
Answer the question
In order to leave comments, you need to log in
First, there is no bytecode in image files. Secondly, it is better not to store images in the database, this has a bad effect on performance. Thirdly, if it’s already pinned down, you should use the appropriate functions to read the file in bytea
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question