RE: Re: Storing images in PG?

From: "Andrew SNow" <andrew(at)modulus(dot)org>
To: <pgsql-general(at)postgresql(dot)org>
Subject: RE: Re: Storing images in PG?
Date: 2001-08-16 09:59:04
Message-ID: 000801c1263a$14cb9710$fa01b5ca@avon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> > Correct me if I'm wrong, but the only thing "lztext" can't store is
> > NULLs, which could escaped somehow with other (rare) characters.
> > Still overhead, but you shouldn't be storing large pieces of binary
> > data this way, I think.
>
> Here is not a problem with storing binary data to some
> datetype (like bytea), but problem is with other parts of PG.
> For example libpq
> functions read queries as string, other thing is query
> parsing where is needful set correct chars (like quote), etc.
> IMHO if you want to work with queries with no problems and limits is

Right, and I'm saying you can save that space by simply escaping all
your characters in the normal way, e.g. SELECT '\377' is the ASCII
character 0xFF. This would work for all characters except NULL, which
you could represent by \377\377 (and you could represent a real \377 by
\377\376 or something). Then the space wastage would be minimal
compared to using base 64.

I wrote a perl module which wraps around Pg, in which you can use
parameters in queries, and it automatically escapes extended ascii
characters as per above, however I have never tried storing binary data
using the whole 0x01 -> 0xFF range as I just described, but I think it
would work.

- Andrew

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ben-Nes Michael 2001-08-16 10:15:13 Roll Back dont roll back counters
Previous Message Eric Ridge 2001-08-16 09:32:24 RE: Re: Re: Storing images in PG?