Re: MDB postgresql feature request

From: Date: Mon, 18 Aug 2003 07:44:37 +0000
Subject: Re: MDB postgresql feature request
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-19957@lists.php.net to get a copy of this message
Lukas Smith wrote:
From: Jeroen Houben [mailto:jeroen@terena.nl] Sent: Wednesday, August 13, 2003 12:47 PM
Postgresql 7.2 and above do not automatically truncate strings if they don't fit the field. Although this complies with the SQL specs, I
think
a lot of people find it annoying. It would be nice if you could set an option (auto_truncate_strings) to "on" or "off". Problem is that I don't know how to implement this, as MDB to my knowledge does not know about the length of a field. Perhaps in conjunction with the MDB manager it could be done. Or maybe this is
just
not possible, comments are welcome.
What would need to be done to create this option? Is it something that is defined at table creation? Or does this need to be defined per connection session? Hi Lukas,
I think MDB somehow has to know the length of the (var)char field and the length of the string to be inserted. If the string is longer the the length of the field then MDB can truncate the string so it fits and then insert it. Right now the insert would just fail if the data is to large for the field. A check for PG 7.2 or higher is also needed, because in < PG 7.2 the data will be silently truncated, just like in MySql so in that case MDB won't have to do anything. HTH Jeroen

« previous php.pear.dev (#19957) next »