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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Igor Korot <ikorot01(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: How can I insert the image as a blob in the table
Date: 2021-04-11 23:24:33
Message-ID: CAKFQuwaGT1UecowEuwkG3pWmzP_EJdQP=rAZ7iyaQ40wqpi-ZQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Apr 11, 2021 at 2:04 PM Igor Korot <ikorot01(at)gmail(dot)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 can produce 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 through how to do this using that
client interface.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Zhihong Yu 2021-04-11 23:33:52 Re: Have I found an interval arithmetic bug?
Previous Message Virendra Kumar 2021-04-11 23:14:24 Prepare Statement VS Literal Values