Re: How can I insert the image as a blob in the table

Поиск
Список
Период
Сортировка
От Igor Korot
Тема Re: How can I insert the image as a blob in the table
Дата
Msg-id CA+FnnTy-Liwojw_B-ocFQWif7SWmjoqSwVAOCS29Sd01V9YXWQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How can I insert the image as a blob in the table  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: How can I insert the image as a blob in the table  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
Hi, David,


On Sun, Apr 11, 2021 at 6:24 PM David G. Johnston
<david.g.johnston@gmail.com> wrote:
>
> On Sun, Apr 11, 2021 at 2:04 PM Igor Korot <ikorot01@gmail.com> wrote:
>>
>> Hi, ALL,
>> I have an image on my hard drive and I'd like to store it in the BLOB
>> column of the images table.
>>
>> Is there a simple SQL to do that in PostgreSQL?
>>
>
> SQL proper has no concept of "your hard drive".  You need to define what you plan to use as an in between layer that
canproduce SQL AND see "your hard drive" (i.e., what database client).  Also, BLOB isn't an actual thing in PostgreSQL
proper(though generic client APIs may use that term), so I presume you mean to store the contents in a "bytea" typed
column. You could also convert the binary to a encoded text compatible type (e.g., base64) and use a text field
instead.
>
> If you can decide on what client interface you want to use there should be existing resources on the web walking
throughhow to do this using that client interface. 

Something like this:

INSERT INTO images(image) VALES( loadfile( /home/igor/my_image) );

Looking to run it from gAdmin in the Terminal.

Thank you.

>
> David J.
>



В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: How can I insert the image as a blob in the table
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: How can I insert the image as a blob in the table