Skip site navigation (1) Skip section navigation (2)

Re: Bytea question

From: Mike Goldner <mgoldner(at)agmednet(dot)com>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Cc: Chris Hoover <revoohc(at)gmail(dot)com>
Subject: Re: Bytea question
Date: 2007-04-11 13:40:13
Message-ID: 1176298813.1169.11.camel@mgoldner-desktop (view raw or flat)
Thread:
Lists: pgsql-admin
It sounds like you want to parse the contents of the bytea column within
a trigger/stored procedure.  I haven't done this myself (I process the
bytea data in java as an input stream after retrieving it from
postgres), but you could probably use a FOR loop over the bytea column
and then use some combination of the Binary String Functions
(http://www.postgresql.org/docs/current/static/functions-binarystring.html) to process the file data.

Mike

On Wed, 2007-04-11 at 09:22 -0400, Alvaro Herrera wrote:
> Chris Hoover escribió:
> > No, I need to store the entire file as received into the database.
> 
> Then you original question does not make any sense to me, because if you
> pass the entire file content, why would Postgres *not* be able to read
> it?
> 
> 
> > On 4/11/07, Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:
> > >
> > >Chris Hoover escribió:
> > >> Hopefully a quick question.
> > >>
> > >> If I store a file into a bytea field, is there anyway for postgres to
> > >read
> > >> the contents of the file?
> > >
> > >When you say "store a file", do you mean "store a filename"?
> > >
> > >> Here is my scenario:
> > >>
> > >> Receive text file
> > >> insert file into bytea field
> > >> insert trigger fires
> > >>  - read file contents
> > >>  - post contents into production tables
> > >>
> > >> Is this at all possible, or am I going to need to store the original
> > >file
> > >> and store/pass the file contents?
> 


In response to

pgsql-admin by date

Next:From: PankajDate: 2007-04-11 13:56:20
Subject: (pgsql-bugs) Ref. No: 3218: Problems in installing Postgresql on Windows
Previous:From: Chris HooverDate: 2007-04-11 13:32:31
Subject: Re: Bytea question

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group