From: jon
Date: September 1 2006 1:28am
Subject: svn commit - mysqldoc@docsrva: r3186 - in trunk: refman-4.1 refman-5.0 refman-5.1
List-Archive: http://lists.mysql.com/commits/11208
Message-Id: <200609010128.k811S1B2028021@docsrva.mysql.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jstephens
Date: 2006-09-01 03:27:56 +0200 (Fri, 01 Sep 2006)
New Revision: 3186
Log:
Updated description of NO_UNSIGNED_SUBTRACTION and added example. (Thanks, Vladimir!)
Modified:
trunk/refman-4.1/database-administration.xml
trunk/refman-5.0/database-administration.xml
trunk/refman-5.1/database-administration.xml
Modified: trunk/refman-4.1/database-administration.xml
===================================================================
--- trunk/refman-4.1/database-administration.xml 2006-08-31 23:49:33 UTC (rev 3185)
+++ trunk/refman-4.1/database-administration.xml 2006-09-01 01:27:56 UTC (rev 3186)
Changed blocks: 11, Lines Added: 52, Lines Deleted: 19; 7074 bytes
@@ -8860,7 +8860,7 @@
with this mode enabled. With
ANSI_QUOTES enabled, you cannot use
double quotes to quote literal strings, because it is
- interpreted as an identifier. (New in MySQL 4.0.0)
+ interpreted as an identifier. (Added in MySQL 4.0.0)
@@ -8891,7 +8891,7 @@
- (New in MySQL 4.0.0)
+ (Added in MySQL 4.0.0)
@@ -8917,7 +8917,7 @@
NO_AUTO_VALUE_ON_ZERO suppresses this
behavior for 0 so that only
NULL generates the next sequence
- number. (New in MySQL 4.1.1)
+ number. (Added in MySQL 4.1.1)
@@ -8951,7 +8951,7 @@
When creating a table, ignore all INDEX
DIRECTORY and DATA DIRECTORY
directives. This option is useful on slave replication
- servers. (New in MySQL 4.0.15)
+ servers. (Added in MySQL 4.0.15)
@@ -8967,8 +8967,8 @@
Do not print MySQL-specific column options in the output
of SHOW CREATE TABLE. This mode is used
- by mysqldump in portability mode. (New
- in MySQL 4.1.1)
+ by mysqldump in portability mode.
+ (Added in MySQL 4.1.1)
@@ -8984,7 +8984,7 @@
Do not print MySQL-specific index options in the output of
SHOW CREATE TABLE. This mode is used by
- mysqldump in portability mode. (New in
+ mysqldump in portability mode. (Added in
MySQL 4.1.1)
@@ -9002,8 +9002,8 @@
Do not print MySQL-specific table options (such as
ENGINE) in the output of SHOW
CREATE TABLE. This mode is used by
- mysqldump in portability mode. (New in
- MySQL 4.1.1)
+ mysqldump in portability mode. (Added
+ in MySQL 4.1.1)
@@ -9019,21 +9019,54 @@
In integer subtraction operations, do not mark the result
as UNSIGNED if one of the operands is
- unsigned. Note that this makes BIGINT
- UNSIGNED not 100% usable in all contexts. See
- . (New in MySQL 4.0.2)
+ unsigned. In other words, the result of a
+ subtraction is always signed whenever this mode is in
+ effect, even if one of the operands is
+ unsigned. For example, compare the type of
+ column c2 in table t1
+ with that of column c2 in table
+ t2:
+
+
+mysql> SET SQL_MODE='';
+mysql> CREATE TABLE test (c1 BIGINT UNSIGNED NOT NULL);
+mysql> CREATE TABLE t1 SELECT c1 - 1 AS c2 FROM test;
+mysql> DESCRIBE t1;
++-------+---------------------+------+-----+---------+-------+
+| Field | Type | Null | Key | Default | Extra |
++-------+---------------------+------+-----+---------+-------+
+| c2 | bigint(21) unsigned | | | 0 | |
++-------+---------------------+------+-----+---------+-------+
+mysql> SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
+mysql> CREATE TABLE t2 SELECT c1 - 1 AS c2 FROM test;
+mysql> DESCRIBE t2;
++-------+------------+------+-----+---------+-------+
+| Field | Type | Null | Key | Default | Extra |
++-------+------------+------+-----+---------+-------+
+| c2 | bigint(21) | | | 0 | |
++-------+------------+------+-----+---------+-------+
+
+
+
+ Note that this means that BIGINT
+ UNSIGNED is not 100% usable in all contexts.
+ See . (Added in MySQL
+ 4.0.2)
+
+
-mysql>t; SET sql_mode = '';
-mysql>t; SELECT CAST(0 AS UNSIGNED) - 1;
+mysql> SET SQL_MODE = '';
+mysql> SELECT CAST(0 AS UNSIGNED) - 1;
+-------------------------+
| CAST(0 AS UNSIGNED) - 1 |
+-------------------------+
| 18446744073709551615 |
+-------------------------+
-mysql>t; SET sql_mode = 'NO_UNSIGNED_SUBTRACTION';
-mysql>t; SELECT CAST(0 AS UNSIGNED) - 1;
+
+mysql> SET SQL_MODE = 'NO_UNSIGNED_SUBTRACTION';
+mysql> SELECT CAST(0 AS UNSIGNED) - 1;
+-------------------------+
| CAST(0 AS UNSIGNED) - 1 |
+-------------------------+
@@ -9055,7 +9088,7 @@
Do not allow queries for which the
SELECT list refers to non-aggregated
columns that are not named in the GROUP
- BY clause. (New in MySQL 4.0.0) The following
+ BY clause. (Added in MySQL 4.0.0) The following
query is invalid with this mode enabled because
address is not named in the
GROUP BY clause:
@@ -9078,7 +9111,7 @@
Treat || as a string concatenation
operator (same as CONCAT()) rather than
- as a synonym for OR. (New in MySQL
+ as a synonym for OR. (Added in MySQL
4.0.0)
@@ -9096,7 +9129,7 @@
Treat REAL as a synonym for
FLOAT. By default, MySQL treats
REAL as a synonym for
- DOUBLE. (New in MySQL 4.0.0)
+ DOUBLE. (Added in MySQL 4.0.0)
Modified: trunk/refman-5.0/database-administration.xml
===================================================================
--- trunk/refman-5.0/database-administration.xml 2006-08-31 23:49:33 UTC (rev 3185)
+++ trunk/refman-5.0/database-administration.xml 2006-09-01 01:27:56 UTC (rev 3186)
Changed blocks: 1, Lines Added: 39, Lines Deleted: 7; 3186 bytes
@@ -10277,21 +10277,53 @@
In integer subtraction operations, do not mark the result
as UNSIGNED if one of the operands is
- unsigned. Note that this makes BIGINT
- UNSIGNED not 100% usable in all contexts. See
- .
+ unsigned. In other words, the result of a
+ subtraction is always signed whenever this mode is in
+ effect, even if one of the operands is
+ unsigned. For example, compare the type of
+ column c2 in table t1
+ with that of column c2 in table
+ t2:
+
+
+mysql> SET SQL_MODE='';
+mysql> CREATE TABLE test (c1 BIGINT UNSIGNED NOT NULL);
+mysql> CREATE TABLE t1 SELECT c1 - 1 AS c2 FROM test;
+mysql> DESCRIBE t1;
++-------+---------------------+------+-----+---------+-------+
+| Field | Type | Null | Key | Default | Extra |
++-------+---------------------+------+-----+---------+-------+
+| c2 | bigint(21) unsigned | | | 0 | |
++-------+---------------------+------+-----+---------+-------+
+mysql> SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
+mysql> CREATE TABLE t2 SELECT c1 - 1 AS c2 FROM test;
+mysql> DESCRIBE t2;
++-------+------------+------+-----+---------+-------+
+| Field | Type | Null | Key | Default | Extra |
++-------+------------+------+-----+---------+-------+
+| c2 | bigint(21) | | | 0 | |
++-------+------------+------+-----+---------+-------+
+
+
+
+ Note that this means that BIGINT
+ UNSIGNED is not 100% usable in all contexts.
+ See .
+
+
-mysql>t; SET sql_mode = '';
-mysql>t; SELECT CAST(0 AS UNSIGNED) - 1;
+mysql> SET SQL_MODE = '';
+mysql> SELECT CAST(0 AS UNSIGNED) - 1;
+-------------------------+
| CAST(0 AS UNSIGNED) - 1 |
+-------------------------+
| 18446744073709551615 |
+-------------------------+
-mysql>t; SET sql_mode = 'NO_UNSIGNED_SUBTRACTION';
-mysql>t; SELECT CAST(0 AS UNSIGNED) - 1;
+
+mysql> SET SQL_MODE = 'NO_UNSIGNED_SUBTRACTION';
+mysql> SELECT CAST(0 AS UNSIGNED) - 1;
+-------------------------+
| CAST(0 AS UNSIGNED) - 1 |
+-------------------------+
Modified: trunk/refman-5.1/database-administration.xml
===================================================================
--- trunk/refman-5.1/database-administration.xml 2006-08-31 23:49:33 UTC (rev 3185)
+++ trunk/refman-5.1/database-administration.xml 2006-09-01 01:27:56 UTC (rev 3186)
Changed blocks: 1, Lines Added: 39, Lines Deleted: 7; 3186 bytes
@@ -10457,21 +10457,53 @@
In integer subtraction operations, do not mark the result
as UNSIGNED if one of the operands is
- unsigned. Note that this makes BIGINT
- UNSIGNED not 100% usable in all contexts. See
- .
+ unsigned. In other words, the result of a
+ subtraction is always signed whenever this mode is in
+ effect, even if one of the operands is
+ unsigned. For example, compare the type of
+ column c2 in table t1
+ with that of column c2 in table
+ t2:
+
+
+mysql> SET SQL_MODE='';
+mysql> CREATE TABLE test (c1 BIGINT UNSIGNED NOT NULL);
+mysql> CREATE TABLE t1 SELECT c1 - 1 AS c2 FROM test;
+mysql> DESCRIBE t1;
++-------+---------------------+------+-----+---------+-------+
+| Field | Type | Null | Key | Default | Extra |
++-------+---------------------+------+-----+---------+-------+
+| c2 | bigint(21) unsigned | | | 0 | |
++-------+---------------------+------+-----+---------+-------+
+mysql> SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
+mysql> CREATE TABLE t2 SELECT c1 - 1 AS c2 FROM test;
+mysql> DESCRIBE t2;
++-------+------------+------+-----+---------+-------+
+| Field | Type | Null | Key | Default | Extra |
++-------+------------+------+-----+---------+-------+
+| c2 | bigint(21) | | | 0 | |
++-------+------------+------+-----+---------+-------+
+
+
+
+ Note that this means that BIGINT
+ UNSIGNED is not 100% usable in all contexts.
+ See .
+
+
-mysql>t; SET sql_mode = '';
-mysql>t; SELECT CAST(0 AS UNSIGNED) - 1;
+mysql> SET SQL_MODE = '';
+mysql> SELECT CAST(0 AS UNSIGNED) - 1;
+-------------------------+
| CAST(0 AS UNSIGNED) - 1 |
+-------------------------+
| 18446744073709551615 |
+-------------------------+
-mysql>t; SET sql_mode = 'NO_UNSIGNED_SUBTRACTION';
-mysql>t; SELECT CAST(0 AS UNSIGNED) - 1;
+
+mysql> SET SQL_MODE = 'NO_UNSIGNED_SUBTRACTION';
+mysql> SELECT CAST(0 AS UNSIGNED) - 1;
+-------------------------+
| CAST(0 AS UNSIGNED) - 1 |
+-------------------------+