On Saturday, December 14, 2002, at 05:46  PM, Bruce Momjian wrote:

I thought you had that figured out, by flagging the param as bytea
somehow?  Are you thinking of something automatic?
No. Baldur Kristinsson points out that some people may pass a string with NUL characters to DBD::Pg to be inserted into something other than a bytea column. We have to figure out what to do when they do that. Baldur Kristinsson thinks we should just quietly strip them out (and throw a warning). Others think that it should throw an exception and croak. Tim said:

The driver should always try to be as transparent as possible.
The general principle is "don't mes with the users data unless
they've specifically asked you to (cf. ChopBlanks)".

Since, however, nulls aren't really allowed in any PostgreSQL data type (except bytea, and then only if specifically bound as such to a prepared statement), I'm not sure what to do about this. We can't leave the data alone unless we just want PostgreSQL to throw an error (likely to be a mysterious error, as the user won't know why her data is getting truncated).

I think...throw an exception, since PostgreSQL can't handle the null byte. Then it will be up to the user to clean up her data, and we won't have to touch it.

Thoughts?

David

--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
http://david.wheeler.net/ Yahoo!: dew7e
Jabber: [EMAIL PROTECTED]



Reply via email to