Re: Insert image into bytea question

From: George Roberge <groberge(at)andforthelamb(dot)org>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Insert image into bytea question
Date: 2014-05-02 12:16:32
Message-ID: f2495ca9c9ce2752ab4a96fd68d671a3@andforthelamb.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 2014-05-01 19:39, David G Johnston wrote:

>> Ok, very good, thanks to everyone who replied! I was hoping to see a methos within PostgreSQL itself (via INSERT or something), but I can test out a method using PHP instead, since that's the ultimate destination, anyhow.
>
> ​Not sure how you expected to be able to issue an INSERT w/o some kind of client interface. If you need to do this via "psql" (i.e. the official PostgreSQL client) there are ways - though I am not that familiar with them. Typically I'd store the data into a file then do something like:
>
> set variable_name `cat filename.ext`
> INSERT INTO tbl (col) VALUES (func_if_needed(:'variable_name'));
>
> In which case you might or might not find it easier to use some text intermediary in order to avoid difficulty with "cat".
>
> However, I assumed you were using something like PHP or Java and that you would most likely want to have any solution be within the same framework...
>
> ​David J.
>
> -------------------------
> View this message in context: Re: Insert image into bytea question [1]
> Sent from the PostgreSQL - novice mailing list archive [2] at Nabble.com.

I was going to test the table using exactly that. Since I'm still
relatively fresh into PostgreSQL and rusty with my web coding (and PHP),
I wanted to make sure that I was going to insert data properly into the
table the "easy way" before I started writing code to do it using a web
interface. After looking into it and finding next to no documentation
(syntax examples), it may be that it's better to "just do it" with PHP
to start.

George R.

Links:
------
[1]
http://postgresql.1045698.n5.nabble.com/Insert-image-into-bytea-question-tp5802084p5802189.html
[2]
http://postgresql.1045698.n5.nabble.com/PostgreSQL-novice-f2132464.html

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Yuksel Pinarbasi 2014-05-02 13:01:33 Database replication method
Previous Message Albe Laurenz 2014-05-02 09:58:14 Re: Replace constants in subquery