<p><strong>Summary:</strong><br>
This merge request removes the forced 2 precision and 8 digits size limit for floating point number data types in the MySQL field normalization and instead force removes size for these data types.</p>
<p>Some unit tests are updated to reflect this change.</p>
<p><strong>Reason for this change:</strong><br>
While sane size limits are useful for fixed point data types like decimal such limits make little sense for floating point data types. Setting the size for floating point data types does not result in less storage being used but will just try to badly truncate the input and mask the output (or raise an error in strict mode on bad input).</p>
<p>For use cases where size restricted data is required or desired it is highly recommended to use fixed point data types as they don't have impression errors in their given number space as opposed to IEEE 754 floating point numbers (As an example: 0.1 and 0.2 are not directly representable as IEEE 754 number no matter how good the precision is). IEEE 754 floating point numbers are simply not designed for such use cases but to closer approximate natural numbers.</p>
<p>Being able to set size limits to floating point numbers can also encourage the use of bad practices like the classic case of money represented as floating point numbers.</p>
<p>Lastly, the MySQL documentation recommends not using precision and number of digits for maximum portability.<br>
<a href="https://dev.mysql.com/doc/refman/en/floating-point-types.html" rel="nofollow">https://dev.mysql.com/doc/refman/en/floating-point-types.html</a></p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>&nbsp;&nbsp;<a href='https://github.com/dbsrgits/sql-translator/pull/110'>https://github.com/dbsrgits/sql-translator/pull/110</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Remove normalisation size on floating point types</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/110/files#diff-0">lib/SQL/Translator/Parser/MySQL.pm</a>
    (7)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/110/files#diff-1">t/30sqlt-new-diff-mysql.t</a>
    (14)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/110/files#diff-2">t/30sqlt-new-diff-sqlite.t</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/110/files#diff-3">t/data/diff/create1.yml</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/110/files#diff-4">t/data/diff/create2.yml</a>
    (3)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/dbsrgits/sql-translator/pull/110.patch'>https://github.com/dbsrgits/sql-translator/pull/110.patch</a></li>
  <li><a href='https://github.com/dbsrgits/sql-translator/pull/110.diff'>https://github.com/dbsrgits/sql-translator/pull/110.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/dbsrgits/sql-translator/pull/110">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AASeAv1H9ZkwPfARZl9aA0FtMxw2UryBks5uOHMugaJpZM4VwuWm">mute the thread</a>.<img src="https://github.com/notifications/beacon/AASeAswPqwN37Bhe1ASi6FDCRjrpTXiPks5uOHMugaJpZM4VwuWm.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/dbsrgits/sql-translator","title":"dbsrgits/sql-translator","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/dbsrgits/sql-translator"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Remove size on floating point data types during MySQL field normalization (#110)"}],"action":{"name":"View Pull Request","url":"https://github.com/dbsrgits/sql-translator/pull/110"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/dbsrgits/sql-translator/pull/110",
"url": "https://github.com/dbsrgits/sql-translator/pull/110",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "Remove size on floating point data types during MySQL field normalization (#110)",
"sections": [
{
"text": "",
"activityTitle": "**Johannes Piehler**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@jpiautinity",
"facts": [

]
},
{
"title": "Commit Summary",
"facts": [
{
"name": "d19e2c6",
"value": "Remove normalisation size on floating point types"
}
]
},
{
"title": "File Changes",
"facts": [
{
"name": "Modified",
"value": "[lib/SQL/Translator/Parser/MySQL.pm](https://github.com/dbsrgits/sql-translator/pull/110/files#diff-0) (7 changes)"
},
{
"name": "Modified",
"value": "[t/30sqlt-new-diff-mysql.t](https://github.com/dbsrgits/sql-translator/pull/110/files#diff-1) (14 changes)"
},
{
"name": "Modified",
"value": "[t/30sqlt-new-diff-sqlite.t](https://github.com/dbsrgits/sql-translator/pull/110/files#diff-2) (4 changes)"
},
{
"name": "Modified",
"value": "[t/data/diff/create1.yml](https://github.com/dbsrgits/sql-translator/pull/110/files#diff-3) (3 changes)"
},
{
"name": "Modified",
"value": "[t/data/diff/create2.yml](https://github.com/dbsrgits/sql-translator/pull/110/files#diff-4) (3 changes)"
}
]
}
],
"potentialAction": [
{
"name": "Add a comment",
"@type": "ActionCard",
"inputs": [
{
"isMultiLine": true,
"@type": "TextInput",
"id": "IssueComment",
"isRequired": false
}
],
"actions": [
{
"name": "Comment",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"dbsrgits/sql-translator\",\n\"issueId\": 110,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"name": "Close pull request",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"PullRequestClose\",\n\"repositoryFullName\": \"dbsrgits/sql-translator\",\n\"pullRequestId\": 110\n}"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/dbsrgits/sql-translator/pull/110"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/dbsrgits/sql-translator/pull/110.patch"
}
],
"@type": "OpenUri",
"name": "View patch"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/dbsrgits/sql-translator/pull/110.diff"
}
],
"@type": "OpenUri",
"name": "View diff"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 365094310\n}"
}
],
"themeColor": "26292E"
}
]</script>