Re: Picture with Postgres and Delphi

From: Network Administrator <netadmin(at)vcsn(dot)com>
To: Jonathan Bartlett <johnnyb(at)eskimo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Picture with Postgres and Delphi
Date: 2003-09-11 20:29:37
Message-ID: 1063312177.3f60db31283f9@webmail.vcsn.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ok, I went through my 7.3.3. and 7.3.4 tarball directories and I forget Pg.pm is
separate now (http://gborg.postgresql.org/project/pgperl/projdisplay.php) In
any event, I have the current version which is 2.0.2 (12/17/2002) and I don't
see any references to bytea in the documentation (the Pg.3 file). There is a
method to "put" an arbitary number of bytes to the back end but I don't that is it.

Perhaps I should fill out a feature request or maybe one of the developers (is
anyone on this list?) could tell me how to handle bytea types properly (i.e.
address the escaping concerns) in Pg.pm. Currently for the character types, I
do the parsing myself to make sure data is clean going to the database but it
would **really nice** if I could take data directly from its web input and
submit it (well, not directly but NOT have to escape "bad" characters like
apostrophes). There might be a way of doing this in the Pg.pm but it hasn't
revealed itself to me yet :)

Quoting Jonathan Bartlett <johnnyb(at)eskimo(dot)com>:

> > So then the "large object" function in the Pg.pm are not what I'm looking
> for.
> > I'm back to square one- How does one actually insert a file into a table
> using
> > Pg.pm or more importantly psql? I'm more concerned about doing this on
> the
> > system first since that is where I would be scripting the initial load of
> all
> > the images- something like that should not be done via a web client.
>
> See if you have a function like pg_escape_bytea and pg_unescape_bytea.
> If you do, you can escape the data, and then just stick it in quotes in
> your query.
>
> As far as selecting the data, I don't think Perl needs to unescape it, but
> I could be wrong.
>
> Jon
>
>
> >
> > Quoting Jonathan Bartlett <johnnyb(at)eskimo(dot)com>:
> >
> > > BLOBs are PostgreSQL wierdness from before PostgreSQL had TOAST (which
> > > removed the 8kb row limit). See
> > >
> > > http://www.postgresql.org/docs/7.3/static/largeobjects.html
> > >
> > > For info on the old BLOB interface.
> > >
> > > Jon
> > >
> > > On Thu, 11 Sep 2003, Network Administrator wrote:
> > >
> > > > I thought "bytea" was PG's version of BLOBs. I don't see a "blob" type
> in
> > > the
> > > > current docs.
> > > >
> > > > Also, I saw your example code as well. I use Perl as well but I use
> the
> > > native
> > > > Pg.pm module. There doesn't seem to be a way to switch the input to
> binary
> > > data
> > > > but there is support for what is called "large object" which is I
> think
> > > what I
> > > > might want. If you or anyone else out there has worked with bytea's
> with
> > > > module, I appreciate some direction and any other wisdom (e.g.
> pros/cons,
> > > > catch22's, etc). Thanks!
> > > >
> > > > Learning everyday...
> > > >
> > > >
> > > >
> > > > Quoting Jonathan Bartlett <johnnyb(at)eskimo(dot)com>:
> > > >
> > > > > > I'll try that out. I'll have to research that base64 encoding
> part
> > > because
> > > > > I'll
> > > > > > only every do text dumps.
> > > > >
> > > > > Oh yea, I forgot, bytea columns come out just fine in text dumps
> (BLOBs
> > > > > don't, however).
> > > > >
> > > > > Jon
> > > > > >
> > > > > > Keith-
> > > > > >
> > > > > > Quoting Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com>:
> > > > > >
> > > > > > > --- Jonathan Bartlett <johnnyb(at)eskimo(dot)com> wrote:
> > > > > > > > I'm a big fan of bytea. In every case where I've
> > > > > > > > done the filesystem
> > > > > > > > method I wished I hadn't.
> > > > > > >
> > > > > > > For the education of me and maybe others too, why was
> > > > > > > that? i.e. what problems did you run into, that bytea avoids?
> > > > > > >
> > > > > > > __________________________________
> > > > > > > Do you Yahoo!?
> > > > > > > Yahoo! SiteBuilder - Free, easy-to-use web site design software
> > > > > > > http://sitebuilder.yahoo.com
> > > > > > >
> > > > > > > ---------------------------(end of
> > > broadcast)---------------------------
> > > > > > > TIP 8: explain analyze is your friend
> > > > > > >
> > > > > >
> > > > > > --
> > > > > > Keith C. Perry
> > > > > > Director of Networks & Applications
> > > > > > VCSN, Inc.
> > > > > > http://vcsn.com
> > > > > >
> > > > > > ____________________________________
> > > > > > This email account is being host by:
> > > > > > VCSN, Inc : http://vcsn.com
> > > > > >
> > > > > > ---------------------------(end of
> > > broadcast)---------------------------
> > > > > > TIP 5: Have you checked our extensive FAQ?
> > > > > >
> > > > > > http://www.postgresql.org/docs/faqs/FAQ.html
> > > > > >
> > > > >
> > > > >
> > > > > ---------------------------(end of
> broadcast)---------------------------
> > > > > TIP 5: Have you checked our extensive FAQ?
> > > > >
> > > > > http://www.postgresql.org/docs/faqs/FAQ.html
> > > > >
> > > >
> > > >
> > > > --
> > > > Keith C. Perry
> > > > Director of Networks & Applications
> > > > VCSN, Inc.
> > > > http://vcsn.com
> > > >
> > > > ____________________________________
> > > > This email account is being host by:
> > > > VCSN, Inc : http://vcsn.com
> > > >
> > >
> >
> >
> > --
> > Keith C. Perry
> > Director of Networks & Applications
> > VCSN, Inc.
> > http://vcsn.com
> >
> > ____________________________________
> > This email account is being host by:
> > VCSN, Inc : http://vcsn.com
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>

--
Keith C. Perry
Director of Networks & Applications
VCSN, Inc.
http://vcsn.com

____________________________________
This email account is being host by:
VCSN, Inc : http://vcsn.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message N.K. 2003-09-11 20:42:26 Connecting to postgres from a romote machhine
Previous Message Tom Lane 2003-09-11 20:26:33 Re: 50K record DELETE Begins, 100% CPU, Never Completes 1 hour later