Re: Insert image into bytea question - Mailing list pgsql-novice

From David G Johnston
Subject Re: Insert image into bytea question
Date
Msg-id CAKFQuwbZZYpUME6c_NW9Ek9Cm==+wJcLS2Ha9ES9wQ3tdU4Chw@mail.gmail.com
Whole thread Raw
In response to Re: Insert image into bytea question  (George Roberge <groberge@andforthelamb.org>)
Responses Re: Insert image into bytea question
Re: Insert image into bytea question
List pgsql-novice

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
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

pgsql-novice by date:

Previous
From: George Roberge
Date:
Subject: Re: Insert image into bytea question
Next
From: Dominik Moritz
Date:
Subject: Replace constants in subquery