hello!
    i want to insert jpeg pictures into a bytea field and i implemented a 
SPI extension. this function reads the jpeg-file from the filesystem, 
converts it into a octal-coded string to pass the sql-parser, and then 
exec's the insert statement. this is rather slow, and i'd like to insert 
using lower level postgres functions that handle binary data without base64- 
or escaped en-/decoding.

did anyone something like this in the past?

thanks,
    (reply to) wolfgang_reichart@hotmail.com

_________________________________________________________________
Schaffen Sie das Platzproblem in Ihrem E-Mail-Konto fï¿½r immer aus der Welt! 
http://join.msn.com/?pgmarket=de-at&DI=43&XAPID=1817


Mon, 10 May 2004 13:17:57 +0200
"Wolfgang Reichart" <wolfgang_reichart@hotmail.com>
SPI and bytea columns
Wolfgang Reichart wrote:

> hello!
>    i want to insert jpeg pictures into a bytea field and i implemented a 
> SPI extension. this function reads the jpeg-file from the filesystem, 
> converts it into a octal-coded string to pass the sql-parser, and then 
> exec's the insert statement. this is rather slow, and i'd like to insert 
> using lower level postgres functions that handle binary data without 
> base64- or escaped en-/decoding.
> 
> did anyone something like this in the past?

Does it necessarily have to be stored in a bytea field? Why not 
create your own type (CREATE TYPE) with utility functions to read 
the image file from disk?

PostgreSQL really needs a maintained type library as a single 
project where people can contribute types, functions, operators, and 
aggregates, such as the recently discussed email type.

Mike Mascari

<joke>
Just be sure not to actually compress/decompress the JPEG or you 
might get sued:

http://www.technewsworld.com/perl/story/33518.html
</joke>




Tue, 11 May 2004 15:38:41 -0400
Mike Mascari <mascarm@mascari.com>
Re: SPI and bytea columns