Re: [OT] PostgreSQL: bytea help needed.

From: True211 (true211_at_gmail.com)
Date: 02/03/05


Date: Thu, 3 Feb 2005 16:28:29 -0500


"Mike Cox" <mikecoxlinux@yahoo.com> wrote in message
news:m33bwdtkn0.fsf@linux.local...
> Christopher Browne <cbbrowne@acm.org> writes:
>
> > Centuries ago, Nostradamus foresaw when Mike Cox
<mikecoxlinux@yahoo.com> would write:
> > > Does anyone know how to add data to a bytea in PostgreSQL? I googled
> > > the archives, and they mostly talk about PHP. I'd like to put binary
> > > data in the bytea from my local filesystem, but google comes up empty
> > > other than using PHP.
> >
> > Well, you draw the data in, and then append it to the field.
>
> Well this is elementary stuff. Lets say I wanted to pull a jpg into
> the database from my local filesystem for example. How would what you
> just wrote help me in this regard? I already know how to append to a
> bytea from within the database and using an interface like JDBC, but
> what about the psql terminal?
>
> > tutorial=# create table ba1 (stuff bytea);
> > CREATE TABLE
> > tutorial=# insert into ba1 values ('foo');
> > INSERT 2749794 1
> > tutorial=# update ba1 set stuff = stuff || ' more stuff';
> > UPDATE 1
> > tutorial=# select * from ba1;
> > stuff
> > ----------------
> > foo more stuff
> > (1 row)
> >
> > Your application needs to be in some language; that presumably needs
> > to be where the data is loaded from disk into a variable. You would
> > then push the variable into the update query.
> >
> > When you were googling, you mostly found PHP details; can you suggest
> > details about what language you're planning to use instead, be that
> > Perl, C, Python, Java, or such?
>
> Well I wanted to grab binary data off my filesystem directly from the
> psql terminal. Something like lo_import that is used for BLOBS or the
> COPY command which is used to pull text data in.
>
> I know how to pull data from Java and those other interfaces, but then
> I'd have to get JDBC or install Apache, PHP etc. I want to be able
> to, like I posted, be able to do this within the psql terminal.
>
> > This isn't really a Linux question, by the way...
>
> There are *no* postgresql usenet newsgroups. Not a one. There are
> mailing lists gated to the pgsql hierarchy, but one needs to subscribe
> to the mailing list in order to post. Even if one elects not to get
emails,
> many people will email you regardless by changing some settings in
> their mailing client.
>
> The NAN moderators are dragging their feet about getting a PostgreSQL
> CFV through. So people who need help are forced to seek it where
> there may be a PostgreSQL user, like in the linux group. There is
> certainly an overlap between Linux users and PostgreSQL users.

Why is this db technical discussion crossposted to news.groups?

Follow-Ups Set



Relevant Pages

  • Re: [OT] PostgreSQL: bytea help needed.
    ... >> Well, you draw the data in, and then append it to the field. ... > the database from my local filesystem for example. ... > Well I wanted to grab binary data off my filesystem directly from the ... > COPY command which is used to pull text data in. ...
    (comp.os.linux.misc)
  • Re: Date ranking
    ... I'd probably create a new table with the proper structure. ... The first append query would pull all the records with an entry in the DATE1 ... It would pull the SSN field and the DATE1 field. ...
    (microsoft.public.access.queries)
  • RE: Append One Record with a button?
    ... Review the Append To row for any blanks. ... add criteria to pull the correct data. ... The reason for the history table is due to the size of the data. ... I have a current assignment log Table, which I have copied and pasted. ...
    (microsoft.public.access.queries)
  • RE: Append One Record with a button?
    ... Review the Append To row for any blanks. ... add criteria to pull the correct data. ... The reason for the history table is due to the size of the data. ... I have a current assignment log Table, which I have copied and pasted. ...
    (microsoft.public.access.queries)