------=_Part_6638_17969645.1176298351328
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
What I am needing to do is to store a file I receive, say file1.dat. I wan=
t
to store file1.dat into a bytea field so we can always go back and retrieve
the original file to verify if needed. However, I also need to process the
data that is in file1.dat (1234 johnny 1254.12). When I load file1.dat int=
o
the bytea field, I just have a large escaped record that represents the
file. What I am hoping is possible is to have postgres look into file1.dat=
's
byte a field and be able to read the data in file1.dat (assuming it's a
simple text file). That way, the database can do all of the heavy lifting
and loading.
so.
Insert file1.dat into a bytea field of table a.
Table a's insert trigger fires, and postgres looks at the bytea field and
see's file1.dat and its contents of "1234 johnny 1254.12".
Trigger runs logic on data and loads into appropriate tables
I hope this makes sense.
Chris
On 4/11/07, Chris Hooverwrote:
>
> No, I need to store the entire file as received into the database.
>
> Chris
>
> On 4/11/07, Alvaro Herrera < alvherre@commandprompt.com> wrote:
> >
> > Chris Hoover escribi=F3:
> > > 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?
> >
> >
> > --
> > Alvaro Herrera
> > http://www.CommandPrompt.com/
> > PostgreSQL Replication, Consulting, Custom Development, 24x7 support
> >
>
>
------=_Part_6638_17969645.1176298351328
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
What I am needing to do is to store a file I receive, say file1.dat. =
I want to store file1.dat into a bytea field so we can always go back and r=
etrieve the original file to verify if needed. However, I also need t=
o process the data that is in=20
file1.dat (1234 johnny 1254.12). When I load file1.dat into the bytea=
field, I just have a large escaped record that represents the file. =
What I am hoping is possible is to have postgres look into file1.dat's =
byte a field and be able to read the data in=20
file1.dat (assuming it's a simple text file). That way, the datab=
ase can do all of the heavy lifting and loading.
so.
Insert f=
ile1.dat into a bytea field of table a.
Table a's insert trigger fir=
es, and postgres looks at the bytea field and see's=20
file1.dat and its contents of "1234 johnny 1254.12".
Tr=
igger runs logic on data and loads into appropriate tables
I hope th=
is makes sense.
ChrisOn=
4/11/07,=20
Chris Hoover < c@gmail.com">revoohc@gmail.com> wrote: ail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt =
0pt 0pt 0.8ex; padding-left: 1ex;">
No, I need to store the entire file as received into the database.
class=3D"sg">
Chrisad_2">On 4/11/07, l_sendername">
Alvaro Herrera < =3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">
alvherre@commandprompt.com> wrote: quote" style=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt =
0pt 0.8ex; padding-left: 1ex;">Chris Hoover escribi=F3:
> 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 &quo=
t;store a file", do you mean "store a filename"?
> Here is my scenario:
>
> Receive text file
> insert =
file into bytea field
> insert trigger fires
> - rea=
d file contents
> - post contents into production tables r>>
> Is this at all possible, or am I going to need to store the =
original file
> and store/pass the file contents?
--
Alvaro Herrera&=
nbsp; &nbs=
p; &=
nbsp; t.com/" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event=
,this)">http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 suppor=
t
------=_Part_6638_17969645.1176298351328--