<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: MySQL automatic data truncation can backfire</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/</link>
	<description>Everything about MySQL Performance</description>
	<lastBuildDate>Sun, 21 Mar 2010 02:39:05 +0000</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: php和mysql的crc32居然不兼容 : 博客湾</title>
		<link>http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/comment-page-1/#comment-162448</link>
		<dc:creator>php和mysql的crc32居然不兼容 : 博客湾</dc:creator>
		<pubDate>Mon, 03 Sep 2007 02:32:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/#comment-162448</guid>
		<description>[...] 网上找到一个评论： The problem I discovered however is some of these queries would take enormous amount of time while CRC32 conflicts are really rare. [...]</description>
		<content:encoded><![CDATA[<p>[...] 网上找到一个评论： The problem I discovered however is some of these queries would take enormous amount of time while CRC32 conflicts are really rare. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zillablog</title>
		<link>http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/comment-page-1/#comment-27962</link>
		<dc:creator>zillablog</dc:creator>
		<pubDate>Fri, 12 Jan 2007 16:59:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/#comment-27962</guid>
		<description>&lt;strong&gt;Log Buffer #27, A Carnival of the Vanities for DBAs...&lt;/strong&gt;

They tell me that my hosting this edition of Log Buffer; the weekly intersection of all things DBA and blog; has nothing to do with my birthday being on Sunday, but if it&#039;s all the same I&#039;d like to think of it as a pre-emptive strike against my birth...</description>
		<content:encoded><![CDATA[<p><strong>Log Buffer #27, A Carnival of the Vanities for DBAs&#8230;</strong></p>
<p>They tell me that my hosting this edition of Log Buffer; the weekly intersection of all things DBA and blog; has nothing to do with my birthday being on Sunday, but if it&#8217;s all the same I&#8217;d like to think of it as a pre-emptive strike against my birth&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/comment-page-1/#comment-26899</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Wed, 10 Jan 2007 18:22:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/#comment-26899</guid>
		<description>Thomas, 

Yes I can be wrong regarding what really happens internally. I just know if you just echo it out it will be signed on 32bit platforms and always positive on 64bit platforms.   It well may be wrapping around thing. 

I know about sprintf thing but in this case it was existing application with existing data so it was not changed. 

But you&#039;re right if I would be dealing with same problem today I would use sprintf  for compatibility reasons and have field unsigned.</description>
		<content:encoded><![CDATA[<p>Thomas, </p>
<p>Yes I can be wrong regarding what really happens internally. I just know if you just echo it out it will be signed on 32bit platforms and always positive on 64bit platforms.   It well may be wrapping around thing. </p>
<p>I know about sprintf thing but in this case it was existing application with existing data so it was not changed. </p>
<p>But you&#8217;re right if I would be dealing with same problem today I would use sprintf  for compatibility reasons and have field unsigned.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas</title>
		<link>http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/comment-page-1/#comment-26898</link>
		<dc:creator>Thomas</dc:creator>
		<pubDate>Wed, 10 Jan 2007 18:07:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/#comment-26898</guid>
		<description>@ peter

As far as I checked, the problem is not the conversion to string, but the fact 64bit php returns a 64 bit signed integer which wont wrap at the same position as a 32bit signed integer.
I&#039;ve solved my problems by using sprintf(&#039;%u&#039;,crcvalue) when crcvalue is negative and then store all crc32 values as unsigned integers in mysql.</description>
		<content:encoded><![CDATA[<p>@ peter</p>
<p>As far as I checked, the problem is not the conversion to string, but the fact 64bit php returns a 64 bit signed integer which wont wrap at the same position as a 32bit signed integer.<br />
I&#8217;ve solved my problems by using sprintf(&#8216;%u&#8217;,crcvalue) when crcvalue is negative and then store all crc32 values as unsigned integers in mysql.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/comment-page-1/#comment-26859</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Wed, 10 Jan 2007 10:03:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/#comment-26859</guid>
		<description>Joseph,  

You&#039;re right this is the problem and this is why MySQL 5.0 gets strict mode. 

If you however look at general pictures in many cases people select simple thing compared to reliable thing.  For example so widely popular PHP does not require variables to be declared neither has exact types which cause numerous security and reliability problems.

Same applies to MySQL most of MySQL user base loading some dirty data to MySQL would rather like it to be truncated int the case when unexpected data is found rather than ball out and require investigations on how to convert it right.

For other group reliability is more important, and they usually only started using MySQL in the recent years - this is where we get Strict mode and similar changes from.</description>
		<content:encoded><![CDATA[<p>Joseph,  </p>
<p>You&#8217;re right this is the problem and this is why MySQL 5.0 gets strict mode. </p>
<p>If you however look at general pictures in many cases people select simple thing compared to reliable thing.  For example so widely popular PHP does not require variables to be declared neither has exact types which cause numerous security and reliability problems.</p>
<p>Same applies to MySQL most of MySQL user base loading some dirty data to MySQL would rather like it to be truncated int the case when unexpected data is found rather than ball out and require investigations on how to convert it right.</p>
<p>For other group reliability is more important, and they usually only started using MySQL in the recent years &#8211; this is where we get Strict mode and similar changes from.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/comment-page-1/#comment-26856</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Wed, 10 Jan 2007 09:51:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/#comment-26856</guid>
		<description>Bolk, 

This is not the point. Things should be working with CRC32 as well.   For this task MD5 or SHA1 are not good fit as they are too long and what I need it short keys  even if it means a bit higher collision rate.</description>
		<content:encoded><![CDATA[<p>Bolk, </p>
<p>This is not the point. Things should be working with CRC32 as well.   For this task MD5 or SHA1 are not good fit as they are too long and what I need it short keys  even if it means a bit higher collision rate.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BOLK</title>
		<link>http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/comment-page-1/#comment-26848</link>
		<dc:creator>BOLK</dc:creator>
		<pubDate>Wed, 10 Jan 2007 07:56:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/#comment-26848</guid>
		<description>Use MD5 or SHA1 instead of CRC32.</description>
		<content:encoded><![CDATA[<p>Use MD5 or SHA1 instead of CRC32.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/comment-page-1/#comment-26822</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Tue, 09 Jan 2007 23:46:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/#comment-26822</guid>
		<description>Thomas, 

I  might be mistaken and it could be it is just int which wraps around in 32bit but not at 64bit, but the fact is if you  echo/convert it to string you&#039;ll get different value in 32bit and 64bit versions.</description>
		<content:encoded><![CDATA[<p>Thomas, </p>
<p>I  might be mistaken and it could be it is just int which wraps around in 32bit but not at 64bit, but the fact is if you  echo/convert it to string you&#8217;ll get different value in 32bit and 64bit versions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas</title>
		<link>http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/comment-page-1/#comment-26821</link>
		<dc:creator>Thomas</dc:creator>
		<pubDate>Tue, 09 Jan 2007 23:40:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/#comment-26821</guid>
		<description>Hmmmm, didn&#039;t know crc32 returned an &#039;unsigned 32 bit&#039; value on 64bit. It probably is a regular signed int, but since signed 64bit can store a much large value, it won&#039;t go negative.

Thanks for mentioning, am now recalculating all crc32 values in my mixed environment setup :)</description>
		<content:encoded><![CDATA[<p>Hmmmm, didn&#8217;t know crc32 returned an &#8216;unsigned 32 bit&#8217; value on 64bit. It probably is a regular signed int, but since signed 64bit can store a much large value, it won&#8217;t go negative.</p>
<p>Thanks for mentioning, am now recalculating all crc32 values in my mixed environment setup <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joseph Scott</title>
		<link>http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/comment-page-1/#comment-26815</link>
		<dc:creator>Joseph Scott</dc:creator>
		<pubDate>Tue, 09 Jan 2007 22:14:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/01/09/mysql-automatic-data-truncation-can-backfire/#comment-26815</guid>
		<description>This sounds like a great argument against ever truncating data.  Having a DBMS store different data that what I provided it with is just wrong.  Instead it should throw an error.</description>
		<content:encoded><![CDATA[<p>This sounds like a great argument against ever truncating data.  Having a DBMS store different data that what I provided it with is just wrong.  Instead it should throw an error.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
