Re: Inserting into the blob

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Igor Korot <ikorot01(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Inserting into the blob
Date: 2019-06-10 13:38:39
Message-ID: a2e94058-b409-b4d9-4044-53ccb02438be@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 6/9/19 10:06 AM, Igor Korot wrote:
> Hi, Adrian,
>
> On Sun, Jun 9, 2019 at 11:14 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:
>>
>> On 6/9/19 8:28 AM, Igor Korot wrote:
>>> Hi, ALL,
>>> How do I insert the png file (content, not a name) into the BLOB field
>>> in the table i PostgreSQL DB?
>>
>> Are you talking about this data type?:
>>
>> https://www.postgresql.org/docs/11/datatype-binary.html
>>
>> Or this?:
>>
>> https://www.postgresql.org/docs/11/largeobjects.html
>
> Which one is best to hold an images of unknown size?

Probably bytea as it is easier to work with overall.

>
>>
>> What client/language are you using?
>
> psql if possible.

Take a look at(NOTE: need to be superuser):

https://www.postgresql.org/docs/current/functions-admin.html

pg_read_binary_file is similar to pg_read_file, except that the result
is a bytea value; accordingly, no encoding checks are performed. In
combination with the convert_from function, this function can be used to
read a file in a specified encoding:

>
> Thank you.
>
>>
>>
>>>
>>> Thank you.
>>>
>>>
>>>
>>
>>
>> --
>> Adrian Klaver
>> adrian(dot)klaver(at)aklaver(dot)com
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Evaldas Užpalis 2019-06-10 14:48:27 found xmin * from before relfrozenxid *
Previous Message Igor Korot 2019-06-10 12:40:55 Re: Inserting into the blob