[rt-devel] RT 1.3.48

ivan ivan-rt-devel at 420.am
Mon Mar 5 15:41:59 EST 2001


On Mon, Mar 05, 2001 at 09:47:31AM -0500, Alex Pilosov wrote:
> On Mon, 5 Mar 2001, ivan wrote:
> 
> > If we try to get bytea columns out of the database normally; the encoding
> > is incorrect and lossy;  nulls are *returned* as ASCII '\000' instead of a
> > zero byte. (s/\\000/\x00/g; ?  No.  Then you can't store the string
> > '\000'.) 
> No. String \000 will be stored in database as \\000, and it does differ
> from \000 which is a representation for a null character. 

Interesting, but completely unacceptable.  As I said, this is why the
bytea type is useless.

> Here's how you must correctly decode data after getting them out of Pg:

You shouldn't have to decode data after getting it out of the database. 
Similarly, you shouldn't have to encode or quote data when using
placeholders. 

If you'd like to fix this problem, provide a fix to DBD::Pg that speaks to
the backend correctly and post it to pgsql-interfaces at postgresql.org and
dbi-dev at perl.org.  RT is *not* the place to fix these problems.  Have a
nice day. 

> > I disagree.  Base64-encoding has a space penalty, and a *small*
> > performance penalty to encode/decode the data.  Sucking data out of the
> > database with individual get_byte() SQL transactions would come at a heavy
> > performance cost. 
> Make it generic. Write a db_quote/db_unquote which would transform binary
> into db-specific form. For Pg, it should use the functions above to do it.
> For other dbs, do base64.

You may wish to do so, but I don't.  For RT's purposes, I think it's the
wrong decision to include Pg-specific code that *will break* when the bugs
in DBD::Pg are fixed.

-- 
meow
_ivan





More information about the Rt-devel mailing list