Re: [OT] PostgreSQL: bytea help needed.
From: Mike Cox (mikecoxlinux_at_yahoo.com)
Date: 02/03/05
- Next message: JGH: "Re: debian sarge 2.6.11 kernel?"
- Previous message: Martin Stingl: "Hyperthreading kernel 2.6"
- In reply to: Christopher Browne: "Re: [OT] PostgreSQL: bytea help needed."
- Next in thread: True211: "Re: [OT] PostgreSQL: bytea help needed."
- Reply: True211: "Re: [OT] PostgreSQL: bytea help needed."
- Reply: mlw: "Re: [OT] PostgreSQL: bytea help needed."
- Reply: Christopher Browne: "Re: [OT] PostgreSQL: bytea help needed."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 03 Feb 2005 13:10:27 -0800
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.
- Next message: JGH: "Re: debian sarge 2.6.11 kernel?"
- Previous message: Martin Stingl: "Hyperthreading kernel 2.6"
- In reply to: Christopher Browne: "Re: [OT] PostgreSQL: bytea help needed."
- Next in thread: True211: "Re: [OT] PostgreSQL: bytea help needed."
- Reply: True211: "Re: [OT] PostgreSQL: bytea help needed."
- Reply: mlw: "Re: [OT] PostgreSQL: bytea help needed."
- Reply: Christopher Browne: "Re: [OT] PostgreSQL: bytea help needed."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|