pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Igor Korot <ikorot01@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Inserting into the blob
Date: Mon, 10 Jun 2019 06:38:39 -0700
Message-ID: <a2e94058-b409-b4d9-4044-53ccb02438be@aklaver.com> (raw)
In-Reply-To: <CA+FnnTx-8TO-ny5UXhHVf8rXwS0vrU9EQtQHv0ZTbAfPz5HbcQ@mail.gmail.com>
References: <CA+FnnTzRCOPGDjyfeR32c7btgtLES12t_k8RB7d-fU+2v9+CZQ@mail.gmail.com>
	<6cbb4f03-7c05-4473-330d-b220b0a9ec7b@aklaver.com>
	<CA+FnnTx-8TO-ny5UXhHVf8rXwS0vrU9EQtQHv0ZTbAfPz5HbcQ@mail.gmail.com>

On 6/9/19 10:06 AM, Igor Korot wrote:
> Hi, Adrian,
> 
> On Sun, Jun 9, 2019 at 11:14 PM Adrian Klaver <adrian.klaver@aklaver.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.klaver@aklaver.com
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (13+ messages)  latest in thread

Message-ID: <a2e94058-b409-b4d9-4044-53ccb02438be@aklaver.com>
Permalink:  ../a2e94058-b409-b4d9-4044-53ccb02438be@aklaver.com/
Also on:    postgresql.org/message-id/a2e94058-b409-b4d9-4044-53ccb02438be@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, ikorot01@gmail.com
  Subject: Re: Inserting into the blob
  In-Reply-To: <a2e94058-b409-b4d9-4044-53ccb02438be@aklaver.com>
  References: <CA+FnnTzRCOPGDjyfeR32c7btgtLES12t_k8RB7d-fU+2v9+CZQ@mail.gmail.com> <6cbb4f03-7c05-4473-330d-b220b0a9ec7b@aklaver.com> <CA+FnnTx-8TO-ny5UXhHVf8rXwS0vrU9EQtQHv0ZTbAfPz5HbcQ@mail.gmail.com> <a2e94058-b409-b4d9-4044-53ccb02438be@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox