pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mike Goldner <mgoldner@agmednet.com>
To: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Cc: Chris Hoover <revoohc@gmail.com>
Subject: Re: Bytea question
Date: Wed, 11 Apr 2007 09:40:13 -0400
Message-ID: <1176298813.1169.11.camel@mgoldner-desktop> (raw)
In-Reply-To: <20070411132258.GF4896@alvh.no-ip.org>
References: <1d219a6f0704110602n5b9fe58dy34e05008b9bff0be@mail.gmail.com>
	<20070411130904.GD4896@alvh.no-ip.org>
	<1d219a6f0704110617y31780a75q8f783893acb6ef07@mail.gmail.com>
	<20070411132258.GF4896@alvh.no-ip.org>

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@commandprompt.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?
> 




view thread (6+ messages)

Message-ID: <1176298813.1169.11.camel@mgoldner-desktop>
Permalink:  ../1176298813.1169.11.camel@mgoldner-desktop/
Also on:    postgresql.org/message-id/1176298813.1169.11.camel@mgoldner-desktop

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: mgoldner@agmednet.com, revoohc@gmail.com
  Subject: Re: Bytea question
  In-Reply-To: <1176298813.1169.11.camel@mgoldner-desktop>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox