summaryrefslogtreecommitdiff
path: root/docs/topics/db/sql.txt
diff options
context:
space:
mode:
authorErik Romijn <eromijn@solidlinks.nl>2014-04-20 16:32:48 -0400
committerTim Graham <timograham@gmail.com>2014-04-21 18:31:44 -0400
commitaa80f498de6d687e613860933ac58433ab71ea4b (patch)
tree44c7b0893c379d2284868ffc3cdcd33c98c19722 /docs/topics/db/sql.txt
parent1170f285ddd6a94a65f911a27788ba49ca08c0b0 (diff)
[1.4.x] Fixed queries that may return unexpected results on MySQL due to typecasting.
This is a security fix. Disclosure will follow shortly. Backport of 75c0d4ea3ae48970f788c482ee0bd6b29a7f1307 from master
Diffstat (limited to 'docs/topics/db/sql.txt')
-rw-r--r--docs/topics/db/sql.txt10
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/topics/db/sql.txt b/docs/topics/db/sql.txt
index 80038e547f..d387ad5520 100644
--- a/docs/topics/db/sql.txt
+++ b/docs/topics/db/sql.txt
@@ -69,6 +69,16 @@ options that make it very powerful.
database, but does nothing to enforce that. If the query does not
return rows, a (possibly cryptic) error will result.
+.. warning::
+
+ If you are performing queries on MySQL, note that MySQL's silent type coercion
+ may cause unexpected results when mixing types. If you query on a string
+ type column, but with an integer value, MySQL will coerce the types of all values
+ in the table to an integer before performing the comparison. For example, if your
+ table contains the values ``'abc'``, ``'def'`` and you query for ``WHERE mycolumn=0``,
+ both rows will match. To prevent this, perform the correct typecasting
+ before using the value in a query.
+
Mapping query fields to model fields
------------------------------------