[rt-devel] RT 1.3.48

Alex Pilosov alex at pilosoft.com
Mon Mar 5 00:55:05 EST 2001


On Sun, 4 Mar 2001, ivan wrote:

> The Pg backend is not prepared to handle nulls.  This is not news; this is
> a known limitation.  Please read the pgsql-hackers mailing list archives
> at postgresql.org if you are interested.
Nono, actually, Pg backend IS prepared. bytea datatype does not do any
interpretation of data passed to it, and does not use any C-string
functions. 

What may be happening is perl Pg frontend not being prepared for it, and
not properly quoting data before passing it to backend. 

Escaping binary data for Pg is a tricky thing. Essentially, this works for
psql: insert into foo values('\\000')

Note the double backslash and the three-digit-octal representation of a
character.  To verify that we actually inserted what you expected to, use
octet_length(x) and get_byte(x,n) functions. 

*checking in perl Pg driver*

Yep, the same trick works. I do get proper, non-mangled data.

Ivan, can you see if this solves your problem? You may need to write you
own quote_bytea method (to properly quote binary data as above), but it
sure beats base64 encoding ;)

-alex





More information about the Rt-devel mailing list